Prechádzať zdrojové kódy

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

xuzuoyun 5 rokov pred
rodič
commit
35e76a4153
23 zmenil súbory, kde vykonal 957 pridanie a 261 odobranie
  1. 179 179
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java
  2. 24 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  3. 3 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  4. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  5. 9 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java
  6. 0 1
      module-common/pom.xml
  7. 11 3
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  8. 50 49
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  9. 1 3
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  10. 1 0
      module-kuaishou/pom.xml
  11. 20 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  12. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreateServiceImpl.java
  13. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  14. 21 2
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/AccountReportMapper.java
  15. 213 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/AccountReportMapper.xml
  16. 56 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/AccountReportServiceImpl.java
  17. 2 1
      module-toutiao/src/main/resources/bytedance_config.properties
  18. 243 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/controller/UserEfficientVideoMapController.java
  19. 65 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java
  20. 17 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  21. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml
  22. 14 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/IUserEfficientVideoMapService.java
  23. 19 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/impl/UserEfficientVideoMapServiceImpl.java

+ 179 - 179
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java

@@ -6,15 +6,6 @@ import com.auth0.jwt.algorithms.Algorithm;
 import com.auth0.jwt.exceptions.JWTDecodeException;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.google.common.base.Joiner;
-
-import java.util.Date;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-
-import org.jeecg.common.constant.DataBaseConstant;
-import org.jeecg.common.exception.JeecgBootException;
-
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
@@ -23,6 +14,10 @@ import org.jeecg.common.system.vo.SysUserCacheInfo;
 import org.jeecg.common.util.SpringContextUtils;
 import org.jeecg.common.util.oConvertUtils;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Date;
+
 /**
  * @Author Scott
  * @Date 2018-07-12 14:23
@@ -33,174 +28,179 @@ public class JwtUtil {
     /**
      * 过期时间30分钟
      */
-	public static final long EXPIRE_TIME = 30 * 60 * 1000;
-
-	/**
-	 * 校验token是否正确
-	 *
-	 * @param token  密钥
-	 * @param secret 用户的密码
-	 * @return 是否正确
-	 */
-	public static boolean verify(String token, String username, String secret) {
-		try {
-			// 根据密码生成JWT效验器
-			Algorithm algorithm = Algorithm.HMAC256(secret);
-			JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
-			// 效验TOKEN
-			DecodedJWT jwt = verifier.verify(token);
-			return true;
-		} catch (Exception exception) {
-			return false;
-		}
-	}
-
-	/**
-	 * 获得token中的信息无需secret解密也能获得
-	 *
-	 * @return token中包含的用户名
-	 */
-	public static String getUsername(String token) {
-		try {
-			DecodedJWT jwt = JWT.decode(token);
-			return jwt.getClaim("username").asString();
-		} catch (JWTDecodeException e) {
-			return null;
-		}
-	}
-
-	/**
-	 * 生成签名,5min后过期
-	 *
-	 * @param username 用户名
-	 * @param secret   用户的密码
-	 * @return 加密的token
-	 */
-	public static String sign(String username, String secret) {
-		Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
-		Algorithm algorithm = Algorithm.HMAC256(secret);
-		// 附带username信息
-		return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
-
-	}
-
-	/**
-	 * 根据request中的token获取用户账号
-	 * 
-	 * @param request
-	 * @return
-	 * @throws JeecgBootException
-	 */
-	public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
-		String accessToken = request.getHeader("X-Access-Token");
-		String username = getUsername(accessToken);
-		if (oConvertUtils.isEmpty(username)) {
-			throw new JeecgBootException("未获取到用户");
-		}
-		return username;
-	}
-	
-	/**
-	  *  从session中获取变量
-	 * @param key
-	 * @return
-	 */
-	public static String getSessionData(String key) {
-		//${myVar}%
-		//得到${} 后面的值
-		String moshi = "";
-		if(key.indexOf("}")!=-1){
-			 moshi = key.substring(key.indexOf("}")+1);
-		}
-		String returnValue = null;
-		if (key.contains("#{")) {
-			key = key.substring(2,key.indexOf("}"));
-		}
-		if (oConvertUtils.isNotEmpty(key)) {
-			HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
-			returnValue = (String) session.getAttribute(key);
-		}
-		//结果加上${} 后面的值
-		if(returnValue!=null){returnValue = returnValue + moshi;}
-		return returnValue;
-	}
-	
-	/**
-	  * 从当前用户中获取变量
-	 * @param key
-	 * @param user
-	 * @return
-	 */
-
-	//TODO 急待改造 sckjkdsjsfjdk
-
-	public static String getUserSystemData(String key,SysUserCacheInfo user) {
-		if(user==null) {
-			user = JeecgDataAutorUtils.loadUserInfo();
-		}
-		//#{sys_user_code}%
-
-		// 获取登录用户信息
-		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-
-		String moshi = "";
-		if(key.indexOf("}")!=-1){
-			 moshi = key.substring(key.indexOf("}")+1);
-		}
-		String returnValue = null;
-		//针对特殊标示处理#{sysOrgCode},判断替换
-		if (key.contains("#{")) {
-			key = key.substring(2,key.indexOf("}"));
-		} else {
-			key = key;
-		}
-		//替换为系统登录用户帐号
-		if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
-			if(user==null) {
-				returnValue = sysUser.getUsername();
-			}else {
-				returnValue = user.getSysUserCode();
-			}
-		}
-		//替换为系统登录用户真实名字
-		if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
-			if(user==null) {
-				returnValue = sysUser.getRealname();
-			}else {
-				returnValue = user.getSysUserName();
-			}
-		}
-		
-		//替换为系统用户登录所使用的机构编码
-		if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
-			if(user==null) {
-				returnValue = sysUser.getOrgCode();
-			}else {
-				returnValue = user.getSysOrgCode();
-			}
-
-		}
-		//替换为系统用户所拥有的所有机构编码
-		if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)) {
-			if(user.isOneDepart()) {
-				returnValue = user.getSysMultiOrgCode().get(0);
-			}else {
-				returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
-			}
-		}
-		//替换为当前系统时间(年月日)
-		if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
-			returnValue = user.getSysDate();
-		}
-		//替换为当前系统时间(年月日时分秒)
-		if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
-			returnValue = user.getSysTime();
-		}
-		//流程状态默认值(默认未发起)
-		if (key.equals(DataBaseConstant.BPM_STATUS_TABLE)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
-			returnValue = "1";
-		}
-		if(returnValue!=null){returnValue = returnValue + moshi;}
-		return returnValue;
-	}
+    public static final long EXPIRE_TIME = 30 * 60 * 1000;
+
+    /**
+     * 校验token是否正确
+     *
+     * @param token  密钥
+     * @param secret 用户的密码
+     * @return 是否正确
+     */
+    public static boolean verify(String token, String username, String secret) {
+        try {
+            // 根据密码生成JWT效验器
+            Algorithm algorithm = Algorithm.HMAC256(secret);
+            JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
+            // 效验TOKEN
+            DecodedJWT jwt = verifier.verify(token);
+            return true;
+        } catch (Exception exception) {
+            return false;
+        }
+    }
+
+    /**
+     * 获得token中的信息无需secret解密也能获得
+     *
+     * @return token中包含的用户名
+     */
+    public static String getUsername(String token) {
+        try {
+            DecodedJWT jwt = JWT.decode(token);
+            return jwt.getClaim("username").asString();
+        } catch (JWTDecodeException e) {
+            return null;
+        }
+    }
+
+    /**
+     * 生成签名,5min后过期
+     *
+     * @param username 用户名
+     * @param secret   用户的密码
+     * @return 加密的token
+     */
+    public static String sign(String username, String secret) {
+        Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
+        Algorithm algorithm = Algorithm.HMAC256(secret);
+        // 附带username信息
+        return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
+
+    }
+
+    /**
+     * 根据request中的token获取用户账号
+     *
+     * @param request
+     * @return
+     * @throws JeecgBootException
+     */
+    public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
+        String accessToken = request.getHeader("X-Access-Token");
+        String username = getUsername(accessToken);
+        if (oConvertUtils.isEmpty(username)) {
+            throw new JeecgBootException("未获取到用户");
+        }
+        return username;
+    }
+
+    /**
+     * 从session中获取变量
+     *
+     * @param key
+     * @return
+     */
+    public static String getSessionData(String key) {
+        //${myVar}%
+        //得到${} 后面的值
+        String moshi = "";
+        if (key.indexOf("}") != -1) {
+            moshi = key.substring(key.indexOf("}") + 1);
+        }
+        String returnValue = null;
+        if (key.contains("#{")) {
+            key = key.substring(2, key.indexOf("}"));
+        }
+        if (oConvertUtils.isNotEmpty(key)) {
+            HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
+            returnValue = (String) session.getAttribute(key);
+        }
+        //结果加上${} 后面的值
+        if (returnValue != null) {
+            returnValue = returnValue + moshi;
+        }
+        return returnValue;
+    }
+
+    /**
+     * 从当前用户中获取变量
+     *
+     * @param key
+     * @param user
+     * @return
+     */
+
+    //TODO 急待改造 sckjkdsjsfjdk
+    public static String getUserSystemData(String key, SysUserCacheInfo user) {
+        if (user == null) {
+            user = JeecgDataAutorUtils.loadUserInfo();
+        }
+        //#{sys_user_code}%
+
+        // 获取登录用户信息
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        String moshi = "";
+        if (key.indexOf("}") != -1) {
+            moshi = key.substring(key.indexOf("}") + 1);
+        }
+        String returnValue = null;
+        //针对特殊标示处理#{sysOrgCode},判断替换
+        if (key.contains("#{")) {
+            key = key.substring(2, key.indexOf("}"));
+        } else {
+            key = key;
+        }
+        //替换为系统登录用户帐号
+        if (key.equals(DataBaseConstant.SYS_USER_CODE) || key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
+            if (user == null) {
+                returnValue = sysUser.getUsername();
+            } else {
+                returnValue = user.getSysUserCode();
+            }
+        }
+        //替换为系统登录用户真实名字
+        if (key.equals(DataBaseConstant.SYS_USER_NAME) || key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
+            if (user == null) {
+                returnValue = sysUser.getRealname();
+            } else {
+                returnValue = user.getSysUserName();
+            }
+        }
+
+        //替换为系统用户登录所使用的机构编码
+        if (key.equals(DataBaseConstant.SYS_ORG_CODE) || key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
+            if (user == null) {
+                returnValue = sysUser.getOrgCode();
+            } else {
+                returnValue = user.getSysOrgCode();
+            }
+
+        }
+        //替换为系统用户所拥有的所有机构编码
+        if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE) || key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)) {
+            if (user.isOneDepart()) {
+                returnValue = user.getSysMultiOrgCode().get(0);
+            } else {
+                returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
+            }
+        }
+        //替换为当前系统时间(年月日)
+        if (key.equals(DataBaseConstant.SYS_DATE) || key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
+            returnValue = user.getSysDate();
+        }
+        //替换为当前系统时间(年月日时分秒)
+        if (key.equals(DataBaseConstant.SYS_TIME) || key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
+            returnValue = user.getSysTime();
+        }
+        //流程状态默认值(默认未发起)
+        if (key.equals(DataBaseConstant.BPM_STATUS_TABLE) || key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
+            returnValue = "1";
+        }
+        if (returnValue != null) {
+            returnValue = returnValue + moshi;
+        }
+        return returnValue;
+    }
 }

+ 24 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -887,5 +887,29 @@ public class DateUtils extends PropertyEditorSupport {
 
     }
 
+    /**
+     * 根据时间获取季度
+     * 1即Q1(1,2,3月),以此类推
+     * @param date
+     * @return
+     */
+    public static int getQuarter(Date date){
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        //获取当前月份
+        int month = cal.get(Calendar.MONDAY+1);
+        if(month<=3){
+            return 1;
+        }else if(month <=6){
+            return 2;
+        }else if(month<=9){
+            return 3;
+        }else if(month<=12){
+            return 4;
+        }
+
+        return 0;
+    }
+
 
 }

+ 3 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -13,16 +13,6 @@ import cn.com.ctop.toutiao.entity.ByteDanceAdvertiser;
 import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.val;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
-import me.chanjar.weixin.cp.api.WxCpUserService;
-import me.chanjar.weixin.cp.api.impl.WxCpOAuth2ServiceImpl;
-import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
-import me.chanjar.weixin.cp.api.impl.WxCpUserServiceImpl;
-import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
-import me.chanjar.weixin.cp.bean.WxCpUser;
-import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -119,6 +109,7 @@ public class CallbackController {
         result.success("登录成功");
         return result;
     }
+
     /**
      * TODO 授权绑定成功/失败 需要跳转特定页面
      *
@@ -255,6 +246,7 @@ public class CallbackController {
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "auth_code");
         param.put("auth_code", authCode);
+        logger.info("authCode:{}", authCode);
         logger.info("state:{}", state);
         Map<String, Object> returnMap = new HashMap<>();
         try {
@@ -264,6 +256,7 @@ public class CallbackController {
             }
             String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
             JSONObject resultObject = JSONObject.parseObject(result);
+            logger.info("返回信息:{}", resultObject);
             Integer code = resultObject.getInteger("code");
             String message = resultObject.getString("message");
             if (null == code || code != 0) {

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -132,7 +132,7 @@ public class ProjectController {
 
         String roleCode = materialReportMapper.getRoleCodeByUserId(sysUser.getId());
         if (!"admin".equals(roleCode)) {
-            queryWrapper.eq("responsible_id", sysUser.getId());
+            queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.orderByDesc("create_time");
         }
         IPage<Project> pageList = projectService.page(page, queryWrapper);

+ 9 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.shiro.authc;
 
-import java.util.Set;
-
+import cn.com.ctop.common.module.utils.Check;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
 import org.apache.shiro.authc.AuthenticationToken;
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Component;
 
-import lombok.extern.slf4j.Slf4j;
+import java.util.Set;
 
 /**
  * @Description: 用户登录鉴权和获取用户授权
@@ -99,13 +99,18 @@ public class ShiroRealm extends AuthorizingRealm {
      * @param token
      */
     public LoginUser checkUserTokenIsEffect(String token) throws AuthenticationException {
+        if (Check.isNull(token)) {
+            log.error("token为空");
+            return null;
+
+        }
+
         // 解密获得username,用于和数据库进行对比
         String username = JwtUtil.getUsername(token);
         if (username == null) {
             log.error("token非法无效!");
             // throw new AuthenticationException("token非法无效!");
         }
-
         // 查询用户信息
         LoginUser loginUser = new LoginUser();
         SysUser sysUser = sysUserService.getUserByName(username);

+ 0 - 1
module-common/pom.xml

@@ -83,6 +83,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-
     </build>
 </project>

+ 11 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java

@@ -1,11 +1,12 @@
 package cn.com.ctop.common.module.service.impl;
 
-import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.common.module.entity.BindAccountAuth;
 import cn.com.ctop.common.module.mapper.BindAccountAuthMapper;
 import cn.com.ctop.common.module.service.IBindAccountAuthService;
+import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,10 +71,17 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
     @Override
     public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
         StringBuffer sb = new StringBuffer();
+        JSONArray jsonArray = new JSONArray();
+        jsonArray.add("100");
+        jsonArray.add("2");
+        jsonArray.add("3");
+        jsonArray.add("4");
+        jsonArray.add("5");
         sb.append(PropertiesUtils.getValue("bytedance_config", "bytedance_auth_url"))
                 .append(BytedanceInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("bytedance_config", "bytedance_appid"))
                 .append("&state=" + URLEncoder.encode(state))
+                .append("&scope=" + jsonArray)
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
         return sb.toString();
     }

+ 50 - 49
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -14,7 +14,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-// import it.sauronsoftware.jave.Encoder;
+ // import it.sauronsoftware.jave.Encoder;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -146,7 +146,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     }
                 }
             }
-          //  getFile(info);
+            //  getFile(info);
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
@@ -253,60 +253,61 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private MaterialParameterMapper materialParameterMapper;
 
    /* public void getFile(MaterialInfo materialInfo) {
-        uploadExecutorService.submit(new Runnable() {
+       *//* uploadExecutorService.submit(new Runnable() {
             @Override
-            public void run() {
-                try {
-                    System.err.println("开始获取素材基本信息");
-                    System.err.println(materialInfo);
-                    if (!Check.isNull(materialInfo)) {
-                        String url = materialInfo.getUrl();
-                        long l = System.currentTimeMillis();
-                        //PropertiesUtils.getValue("kuaishou_config", "video_sava_path")
-                        String localUrl = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                        File file = new File(localUrl);
-                        it.sauronsoftware.jave.Encoder encoder = new Encoder();
-                        *//*try {*//*
-                        it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
-                        long duration = m.getDuration();
-                        long secondDuration = duration / 1000;
-                        MaterialParameter materialParameter = new MaterialParameter();
-                        materialParameter.setMaterialId(materialInfo.getId());
-                        // 视频秒数
-                        materialParameter.setSecond(secondDuration);
-                        // 视频格式
-                        materialParameter.setFormat(m.getFormat());
-                        // 视频宽
-                        materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
-                        // 视频高
-                        materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
-
-                        FileInputStream fis = new FileInputStream(file);
-                        FileChannel fc = fis.getChannel();
-                        BigDecimal fileSize = new BigDecimal(fc.size());
-                        String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
-                        materialParameter.setSize(size);
-
-                        Map<String, Object> deleteMap = new HashMap<>();
-                        deleteMap.put("material_id", materialInfo.getId());
-                        materialParameterMapper.deleteByMap(deleteMap);
-
-                        int insert = materialParameterMapper.insert(materialParameter);
-                        if (insert > 0) {
-                            log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
-
-                        }
+            public void run() {*//*
+        try {
+            System.err.println("开始获取素材基本信息");
+            System.err.println(materialInfo);
+            if (!Check.isNull(materialInfo)) {
+                String url = materialInfo.getUrl();
+                long l = System.currentTimeMillis();
+                //PropertiesUtils.getValue("kuaishou_config", "video_sava_path")
+                String localUrl = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                File file = new File(localUrl);
+                it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                *//*try {*//*
+                it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
+                long duration = m.getDuration();
+                long secondDuration = duration / 1000;
+                MaterialParameter materialParameter = new MaterialParameter();
+                materialParameter.setMaterialId(materialInfo.getId());
+                // 视频秒数
+                materialParameter.setSecond(secondDuration);
+                // 视频格式
+                materialParameter.setFormat(m.getFormat());
+                // 视频宽
+                materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
+                // 视频高
+                materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
+
+                FileInputStream fis = new FileInputStream(file);
+                FileChannel fc = fis.getChannel();
+                BigDecimal fileSize = new BigDecimal(fc.size());
+                String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
+                materialParameter.setSize(size);
+
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("material_id", materialInfo.getId());
+                materialParameterMapper.deleteByMap(deleteMap);
+
+                int insert = materialParameterMapper.insert(materialParameter);
+                if (insert > 0) {
+                    log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
+
+                }
+                System.err.println(2222222);
                *//* } catch (Exception e) {
                     e.printStackTrace();
                 } *//**//*finally {
                     file.delete();
                 }*//*
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
             }
-        });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+       *//*     }
+        });*//*
     }*/
 
 

+ 1 - 3
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -180,7 +180,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             }
                                         }
 
-                                        log.info("素材同步完成,accountId:{},code:{}", accountId, materialInfo.getCode());
+                                        log.info("素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
                                     } else {
                                         log.error("同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
                                     }
@@ -209,8 +209,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     }
 
 
-
-
     @Autowired
     private RestTemplate rest;
 

+ 1 - 0
module-kuaishou/pom.xml

@@ -52,4 +52,5 @@
             </resource>
         </resources>
     </build>
+
 </project>

+ 20 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -5,11 +5,9 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
-import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -43,6 +41,9 @@ public class BatchController {
     @Autowired
     private ICtopOauthTokenService tokenService;
 
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
+
 
     /**
      * 获取花费信息
@@ -98,6 +99,7 @@ public class BatchController {
                                                            HttpServletRequest req) {
         Result<IPage<KuaiShouCampaign>> result = new Result<IPage<KuaiShouCampaign>>();
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());
+        queryWrapper.orderByDesc("put_create_time");
         Page<KuaiShouCampaign> page = new Page<KuaiShouCampaign>(pageNo, pageSize);
         IPage<KuaiShouCampaign> pageList = kuaiShouCampaignService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -146,4 +148,18 @@ public class BatchController {
     }
 
 
+    @PostMapping(value = "/getUnitList")
+    public Result<IPage<KuaiShouGroup>> getUnitList(KuaiShouGroup kuaiShouGroup,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
+        Result<IPage<KuaiShouGroup>> result = new Result<IPage<KuaiShouGroup>>();
+        QueryWrapper<KuaiShouGroup> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroup, req.getParameterMap());
+        Page<KuaiShouGroup> page = new Page<KuaiShouGroup>(pageNo, pageSize);
+        IPage<KuaiShouGroup> pageList = kuaiShouGroupService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
 }

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreateServiceImpl.java

@@ -381,7 +381,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     imageJson.put("positionType", requestJson.getString("positionType"));
                     String imagePath = imageService.localInsert(imageJson);
 
-                    Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
+                    Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 2);
                     if ((Integer) imageMap.get("code") != 0) {
                         return imageMap;
                     }
@@ -479,7 +479,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                         imageJson.put("loginId", requestJson.getString("loginId"));
                         imageJson.put("videoUploadType", requestJson.getString("singlePicTiepianType"));
                         String imagePath = imageService.localInsert(imageJson);
-                        Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
+                        Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 3);
                         if ((Integer) imageMap.get("code") != 0) {
                             log.error("上传后贴片单张图片素材失败,accountId:{}", accountId);
                             return imageMap;

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -2041,7 +2041,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             }
                         }
                     }
-                    log.info("获取视频信息完成,advertiserId:{}", advertiserId);
+                    log.info("获取视频信息完成,advertiserId:{},返回信息:{}", advertiserId,resultJson);
                 } else {
                     log.error("获取广告视频失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
                 }

+ 21 - 2
module-report/src/main/java/cn/com/ctop/bytedance/mapper/AccountReportMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author jeecg-boot
@@ -26,7 +27,7 @@ public interface AccountReportMapper {
     /**
      * 今日消耗
      *
-     * @param date 日期
+     * @param date       日期
      * @param accountIds
      * @return 今日消耗
      */
@@ -36,7 +37,7 @@ public interface AccountReportMapper {
     /**
      * 查询明细
      *
-     * @param date 日期
+     * @param date       日期
      * @param accountIds
      * @return 查询明细
      */
@@ -54,6 +55,7 @@ public interface AccountReportMapper {
 
     /**
      * 查询全部消耗 包括今日消耗
+     *
      * @param accountIds
      * @return
      */
@@ -94,6 +96,7 @@ public interface AccountReportMapper {
 
     /**
      * 查询所有按月统计数据
+     *
      * @param accountIds
      * @return
      */
@@ -124,6 +127,7 @@ public interface AccountReportMapper {
 
     /**
      * 用户报表信息
+     *
      * @param accountIds
      * @param discount
      * @return
@@ -145,10 +149,25 @@ public interface AccountReportMapper {
 
     /**
      * 按月统计
+     *
      * @param startDate
      * @param endDate
      * @param accountIds
      * @return
      */
     List<JSONObject> selectDayDetailByMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") JSONArray accountIds);
+
+
+    /**
+     * 查询分天汇总
+     *
+     * @param queryMap
+     * @return
+     */
+
+    JSONObject selectSummaryByMap(Map<String, Object> queryMap);
+
+    List<JSONObject> selectReportDetailGroupAccountIdByDate(@Param("statDate") String anotherDay,@Param("accountIds") JSONArray accountIds);
+
+    JSONObject selectHourSummaryByMap(Map<String, Object> queryMap);
 }

+ 213 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/AccountReportMapper.xml

@@ -120,6 +120,34 @@
     </select>
 
 
+    <select id="selectReportDetailGroupAccountIdByDate" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        sum(charge) cost, -- 消耗
+        sum(photo_show) photoShow, -- 封面展示
+        sum(photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+        (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
+        (sum(form_count) / sum(bclick)) cvr,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
+        sum(bclick) bClick,-- 行为数
+        sum(form_count) formCount,
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        sum(activation) activationCount, -- 激活数
+        (sum(charge) / sum(activation)) activationPrice, -- 激活单价
+        account_id accountId,
+        (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
+        from
+        ctop_kuaishou_report_daily_account
+        where stat_date = #{statDate}
+        and account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by account_id;
+    </select>
+
+
     <select id="selectMaxHourByDate" resultType="java.lang.Integer">
         select
         max(stat_hour)
@@ -298,4 +326,189 @@
     </select>
 
 
+    <select id="selectSummaryByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        sum(charge) cost, -- 消耗
+        (case
+        when sum(charge) != 0
+        then (sum(charge) / #{discount})
+        else 0
+        end
+        ) discountCost, -- 封面点击率
+
+        sum(photo_show) photoShow, -- 封面展示
+        sum(photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+
+        (case
+        when sum(photo_show) != 0
+        then (sum(photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(bclick) != 0
+        then (sum(form_count) / sum(bclick))
+        else 0
+        end
+        ) cvr,
+
+        (case
+        when sum(photo_show) != 0
+        then ((sum(charge) / (sum(photo_show)) * 1000))
+        else 0
+        end
+        ) cpm,
+
+        sum(bclick) bClick,-- 行为数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(activation)
+        ELSE
+        0
+        END
+        ) conversions, -- 转化数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(charge) / sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(charge) / sum(activation)
+        ELSE
+        0
+        END
+        ) conversionPrice, -- 转化单价
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        (sum(charge) / sum(form_count)) / #{discount}
+        WHEN sum(activation) != 0 THEN
+        (sum(charge) / sum(activation)) / #{discount}
+        ELSE
+        0
+        END
+        ) discountConversionPrice
+
+        from
+        ctop_kuaishou_report_daily_account
+
+        <where>
+            <if test="statDate != null">
+                and stat_date = #{statDate}
+            </if>
+            <if test="startDate != null">
+                and stat_date &gt;= #{startDate}
+            </if>
+            <if test="endDate != null">
+                and stat_date &lt;= #{endDate}
+            </if>
+
+            <if test="accountIds != null">
+                and account_id in
+                <foreach collection="accountIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+
+            </if>
+        </where>
+    </select>
+
+
+    <select id="selectHourSummaryByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+
+        select
+        sum(charge) cost, -- 消耗
+        (case
+        when sum(charge) != 0
+        then (sum(charge) / #{discount})
+        else 0
+        end
+        ) discountCost, -- 封面点击率
+
+        sum(photo_show) photoShow, -- 封面展示
+        sum(photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+
+        (case
+        when sum(photo_show) != 0
+        then (sum(photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(bclick) != 0
+        then (sum(form_count) / sum(bclick))
+        else 0
+        end
+        ) cvr,
+
+        (case
+        when sum(photo_show) != 0
+        then ((sum(charge) / (sum(photo_show)) * 1000))
+        else 0
+        end
+        ) cpm,
+
+        sum(bclick) bClick,-- 行为数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(activation)
+        ELSE
+        0
+        END
+        ) conversions, -- 转化数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(charge) / sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(charge) / sum(activation)
+        ELSE
+        0
+        END
+        ) conversionPrice, -- 转化单价
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        (sum(charge) / sum(form_count)) / #{discount}
+        WHEN sum(activation) != 0 THEN
+        (sum(charge) / sum(activation)) / #{discount}
+        ELSE
+        0
+        END
+        ) discountConversionPrice
+
+        from
+        ctop_kuaishou_report_hourly_account
+
+        <where>
+            <if test="statDate != null">
+                and stat_date = #{statDate}
+            </if>
+            <if test="statHour != null">
+                and stat_hour &lt;= #{statHour}
+            </if>
+
+            <if test="accountIds != null">
+                and account_id in
+                <foreach collection="accountIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+
+            </if>
+        </where>
+
+
+    </select>
+
 </mapper>

+ 56 - 1
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/AccountReportServiceImpl.java

@@ -12,7 +12,9 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author yumeng
@@ -257,6 +259,9 @@ public class AccountReportServiceImpl implements IAccountReportService {
                 return null;
             }
 
+            Map<String, Object> queryMap = new HashMap<>();
+            queryMap.put("discount", discount);
+            String statDate = "";
             List<JSONObject> accountDetail = new ArrayList<>();
             Integer statHour = json.getInteger("statHour");
             Integer hour;
@@ -270,6 +275,7 @@ public class AccountReportServiceImpl implements IAccountReportService {
                 }
                 JSONObject chainRatioJson = new JSONObject();
                 accountDetail = accountReportMapper.selectReportDetailGroupAccountId(nowDate, accountIds, hour);
+                statDate = nowDate;
                 JSONObject nowAccountSummary = accountReportMapper.selectSummaryByAccountId(nowDate, accountIds, hour, discount);
                 if (!Check.isNull(nowAccountSummary)) {
                     returnJson.put("now", nowAccountSummary);
@@ -493,33 +499,82 @@ public class AccountReportServiceImpl implements IAccountReportService {
                     }
                 }
             } else if (type == 2) {
+                queryMap.put("statDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
+                JSONObject ratioJson;
                 if (Check.isNull(statHour)) {
-                    accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, 23);
+                    accountDetail = accountReportMapper.selectReportDetailGroupAccountIdByDate(anotherDay, accountIds);
+                    statDate = anotherDay;
+                    ratioJson = accountReportMapper.selectSummaryByMap(queryMap);
+
                 } else {
                     accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, statHour);
+                    queryMap.put("statHour", statHour);
+                    statDate = anotherDay;
+                    ratioJson = accountReportMapper.selectHourSummaryByMap(queryMap);
                 }
+
+                returnJson.put("ratioJson", ratioJson);
             } else if (type == 3) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+
+
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
+
+
             } else if (type == 4) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
+
             } else if (type == 5) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
             } else if (type == 6) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
             } else if (type == 7) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -6);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
             } else if (type == 8) {
                 accountDetail = accountReportMapper.selectAccountReport(accountIds, discount);
+                statDate = "合计";
+                queryMap.put("accountIds", accountIds);
             } else if (type == 9) {
                 String startDate = json.getString("startDate");
                 String endDate = json.getString("endDate");
                 accountDetail = accountReportMapper.selectAccountReportByDate(startDate, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + startDate;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", startDate);
+                queryMap.put("accountIds", accountIds);
             }
+
+            if ((type != 1 && type != 2) && type != null) {
+                JSONObject ratioJson = accountReportMapper.selectSummaryByMap(queryMap);
+                returnJson.put("ratioJson", ratioJson);
+            }
+
+            returnJson.put("statDate", statDate);
             returnJson.put("accountDetail", accountDetail);
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 1
module-toutiao/src/main/resources/bytedance_config.properties

@@ -1,6 +1,8 @@
 #release
 bytedance_appid=1635316529903624
+# bytedance_appid=1634953881401358
 bytedance_secret=0c51523e90d6166418fc8421a4896808e90e26f4
+# bytedance_secret=34bc59f53955c66871ce111a1f15a6051cfa3f12
 #release
 bytedance_api_url=https://ad.oceanengine.com/open_api
 bytedance_auth_url=https://ad.oceanengine.com/openapi
@@ -22,7 +24,6 @@ bytedance_v2_campaign_update=/2/campaign/update
 bytedance_v2_dmp_custom_audience_select=/2/dmp/custom_audience/select/
 bytedance_v2_file_video_ad=/2/file/video/ad/
 bytedance_v2_file_image_ad=/2/file/image/ad/
-
 bytedance_v2_creative_update_status=/2/creative/update/status/
 bytedance_v2_creative_material_get=/2/creative/material/read
 bytedance_v2_creative_create_v2=/2/creative/create_v2/

+ 243 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/controller/UserEfficientVideoMapController.java

@@ -0,0 +1,243 @@
+package cn.com.ctop.userefficientvideomap.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import cn.com.ctop.userefficientvideomap.service.IUserEfficientVideoMapService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="有效视频与角色对应表")
+@RestController
+@RequestMapping("/userefficientvideomap/userEfficientVideoMap")
+public class UserEfficientVideoMapController {
+	@Autowired
+	private IUserEfficientVideoMapService userEfficientVideoMapService;
+	
+	/**
+	  * 分页列表查询
+	 * @param userEfficientVideoMap
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-分页列表查询")
+	@ApiOperation(value="有效视频与角色对应表-分页列表查询", notes="有效视频与角色对应表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<UserEfficientVideoMap>> queryPageList(UserEfficientVideoMap userEfficientVideoMap,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<UserEfficientVideoMap>> result = new Result<IPage<UserEfficientVideoMap>>();
+		QueryWrapper<UserEfficientVideoMap> queryWrapper = QueryGenerator.initQueryWrapper(userEfficientVideoMap, req.getParameterMap());
+		Page<UserEfficientVideoMap> page = new Page<UserEfficientVideoMap>(pageNo, pageSize);
+		IPage<UserEfficientVideoMap> pageList = userEfficientVideoMapService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param userEfficientVideoMap
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-添加")
+	@ApiOperation(value="有效视频与角色对应表-添加", notes="有效视频与角色对应表-添加")
+	@PostMapping(value = "/add")
+	public Result<UserEfficientVideoMap> add(@RequestBody UserEfficientVideoMap userEfficientVideoMap) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		try {
+			userEfficientVideoMapService.save(userEfficientVideoMap);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param userEfficientVideoMap
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-编辑")
+	@ApiOperation(value="有效视频与角色对应表-编辑", notes="有效视频与角色对应表-编辑")
+	@PutMapping(value = "/edit")
+	public Result<UserEfficientVideoMap> edit(@RequestBody UserEfficientVideoMap userEfficientVideoMap) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		UserEfficientVideoMap userEfficientVideoMapEntity = userEfficientVideoMapService.getById(userEfficientVideoMap.getId());
+		if(userEfficientVideoMapEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = userEfficientVideoMapService.updateById(userEfficientVideoMap);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-通过id删除")
+	@ApiOperation(value="有效视频与角色对应表-通过id删除", notes="有效视频与角色对应表-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			userEfficientVideoMapService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-批量删除")
+	@ApiOperation(value="有效视频与角色对应表-批量删除", notes="有效视频与角色对应表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<UserEfficientVideoMap> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.userEfficientVideoMapService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-通过id查询")
+	@ApiOperation(value="有效视频与角色对应表-通过id查询", notes="有效视频与角色对应表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<UserEfficientVideoMap> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		UserEfficientVideoMap userEfficientVideoMap = userEfficientVideoMapService.getById(id);
+		if(userEfficientVideoMap==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(userEfficientVideoMap);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<UserEfficientVideoMap> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              UserEfficientVideoMap userEfficientVideoMap = JSON.parseObject(deString, UserEfficientVideoMap.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(userEfficientVideoMap, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<UserEfficientVideoMap> pageList = userEfficientVideoMapService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "有效视频与角色对应表列表");
+      mv.addObject(NormalExcelConstants.CLASS, UserEfficientVideoMap.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("有效视频与角色对应表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<UserEfficientVideoMap> listUserEfficientVideoMaps = ExcelImportUtil.importExcel(file.getInputStream(), UserEfficientVideoMap.class, params);
+              userEfficientVideoMapService.saveBatch(listUserEfficientVideoMaps);
+              return Result.ok("文件导入成功!数据行数:" + listUserEfficientVideoMaps.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 65 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java

@@ -0,0 +1,65 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_user_efficient_video_map")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_user_efficient_video_map对象", description="有效视频与角色对应表")
+public class UserEfficientVideoMap {
+
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**有效视频md5*/
+	@Excel(name = "有效视频md5", width = 15)
+    @ApiModelProperty(value = "有效视频md5")
+	private String efficientVideoSignature;
+	/**角色id*/
+	@Excel(name = "角色id", width = 15)
+    @ApiModelProperty(value = "角色id")
+	private String roleId;
+	/**用户id*/
+	@Excel(name = "用户id", width = 15)
+    @ApiModelProperty(value = "用户id")
+	private String userId;
+	/**季度*/
+	@Excel(name = "季度", width = 15)
+    @ApiModelProperty(value = "季度")
+	private Integer quarter;
+	/**年*/
+	@Excel(name = "年", width = 15)
+    @ApiModelProperty(value = "年")
+	private Integer year;
+	/**媒体类型1_快手2_头条*/
+	@Excel(name = "媒体类型1_快手2_头条", width = 15)
+    @ApiModelProperty(value = "媒体类型1_快手2_头条")
+	private Integer appType;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 17 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.userefficientvideomap.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 有效视频与角色对应表
+ * @author: jeecg-boot
+ * @date:   2019-12-16
+ * @cersion: V1.0
+ */
+public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVideoMap> {
+
+}

+ 5 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper">
+
+</mapper>

+ 14 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/IUserEfficientVideoMapService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.userefficientvideomap.service;
+
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+public interface IUserEfficientVideoMapService extends IService<UserEfficientVideoMap> {
+
+}

+ 19 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/impl/UserEfficientVideoMapServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.userefficientvideomap.service.impl;
+
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
+import cn.com.ctop.userefficientvideomap.service.IUserEfficientVideoMapService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Service
+public class UserEfficientVideoMapServiceImpl extends ServiceImpl<UserEfficientVideoMapMapper, UserEfficientVideoMap> implements IUserEfficientVideoMapService {
+
+}