Browse Source

bytedance init

yangzian 3 years ago
parent
commit
953222e3cf
15 changed files with 100 additions and 124 deletions
  1. 2 2
      jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java
  2. 2 2
      jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/common/system/api/fallback/SysBaseAPIFallback.java
  3. 6 0
      jeecg-boot-base/jeecg-boot-base-core/pom.xml
  4. 2 2
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java
  5. 0 47
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/desform/ISysTranslateAPI.java
  6. 2 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/dto/LogDTO.java
  7. 0 5
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/dto/message/MessageDTO.java
  8. 1 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/dto/message/TemplateMessageDTO.java
  9. 15 28
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/vo/Result.java
  10. 20 36
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/DictAspect.java
  11. 18 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/Dict.java
  12. 12 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  13. 19 0
      jeecg-boot-bytedance-ad/pom.xml
  14. 0 2
      jeecg-boot-bytedance-ad/src/main/java/ctop/bytedance/ad/report/service/impl/BytedanceAdvertiserHourlyReportServiceImpl.java
  15. 1 0
      pom.xml

+ 2 - 2
jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java

@@ -353,7 +353,7 @@ public interface ISysBaseAPI extends CommonAPI {
      * @return
      */
     @GetMapping("/sys/api/translateDictFromTable")
-    String translateDictFromTable(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("key") String key);
+    String translateDictFromTable(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("key") String key,@RequestParam("extendsKey") String extendsKey, @RequestParam("extendsValue") String extendsValue);
 
     /**
      * 41普通字典的翻译
@@ -362,7 +362,7 @@ public interface ISysBaseAPI extends CommonAPI {
      * @return
      */
     @GetMapping("/sys/api/translateDict")
-    String translateDict(@RequestParam("code") String code, @RequestParam("key") String key);
+    String translateDict(@RequestParam("code") String code, @RequestParam("key") String key,@RequestParam("extendsKey") String extendsKey, @RequestParam("extendsValue") String extendsValue);
 
     /**
      * 42查询数据权限

+ 2 - 2
jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/common/system/api/fallback/SysBaseAPIFallback.java

@@ -221,12 +221,12 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
     }
 
     @Override
-    public String translateDictFromTable(String table, String text, String code, String key) {
+    public String translateDictFromTable(String table, String text, String code, String key,String ekey,String evalue) {
         return null;
     }
 
     @Override
-    public String translateDict(String code, String key) {
+    public String translateDict(String code, String key,String ekey,String evalue) {
         return null;
     }
 

+ 6 - 0
jeecg-boot-base/jeecg-boot-base-core/pom.xml

@@ -234,6 +234,12 @@
 			<scope>compile</scope>
 		</dependency>
 
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+			<version>2.8.6</version>
+		</dependency>
+
 	</dependencies>
 
 </project>

+ 2 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java

@@ -54,7 +54,7 @@ public interface CommonAPI {
      * @param key
      * @return
      */
-    String translateDictFromTable(String table, String text, String code, String key);
+    String translateDictFromTable(String table, String text, String code, String key,String extendsKey,String extendsValue);
 
     /**
      * 7普通字典的翻译
@@ -62,7 +62,7 @@ public interface CommonAPI {
      * @param key
      * @return
      */
-    String translateDict(String code, String key);
+    String translateDict(String code, String key,String extendsKey,String extendsValue);
 
     /**
      * 8查询数据权限

+ 0 - 47
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/desform/ISysTranslateAPI.java

@@ -1,47 +0,0 @@
-package org.jeecg.common.api.desform;
-
-import org.jeecg.common.system.vo.DictModel;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 表单设计器【System】翻译API接口
- *
- * @author sunjianlei
- */
-public interface ISysTranslateAPI {
-
-    /**
-     * 查询分类字典翻译
-     */
-    List<String> categoryLoadDictItem(String ids);
-
-    /**
-     * 根据字典code加载字典text
-     *
-     * @param dictCode 顺序:tableName,text,code
-     * @param keys     要查询的key
-     * @return
-     */
-    List<String> dictLoadDictItem(String dictCode, String keys);
-
-    /**
-     * 获取字典数据
-     *
-     * @param dictCode 顺序:tableName,text,code
-     * @param dictCode 要查询的key
-     * @return
-     */
-    List<DictModel> dictGetDictItems(String dictCode);
-
-    /**
-     * 【JSearchSelectTag下拉搜索组件专用接口】
-     * 大数据量的字典表 走异步加载  即前端输入内容过滤数据
-     *
-     * @param dictCode 字典code格式:table,text,code
-     * @return
-     */
-    List<DictModel> dictLoadDict(String dictCode, String keyword, Integer pageSize);
-
-}

+ 2 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/dto/LogDTO.java

@@ -1,6 +1,8 @@
 package org.jeecg.common.api.dto;
+
 import lombok.Data;
 import org.jeecg.common.system.vo.LoginUser;
+
 import java.io.Serializable;
 import java.util.Date;
 

+ 0 - 5
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/dto/message/MessageDTO.java

@@ -24,11 +24,6 @@ public class MessageDTO implements Serializable {
     protected String toUser;
 
     /**
-     * 发送给所有人
-     */
-    protected boolean toAll;
-
-    /**
      * 消息主题
      */
     protected String title;

+ 1 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/dto/message/TemplateMessageDTO.java

@@ -1,6 +1,7 @@
 package org.jeecg.common.api.dto.message;
 
 import lombok.Data;
+
 import java.io.Serializable;
 import java.util.Map;
 

+ 15 - 28
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/vo/Result.java

@@ -113,15 +113,26 @@ public class Result<T> implements Serializable {
 		return r;
 	}
 
-	public static<T> Result<T> error(String msg, T data) {
+	public static<T> Result<T> successMsg(String msg,T t) {
 		Result<T> r = new Result<T>();
-		r.setSuccess(false);
-		r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
+		r.setSuccess(true);
+		r.setCode(CommonConstant.STATUS_NORMAL);
+		r.setResult(t);
 		r.setMessage(msg);
-		r.setResult(data);
 		return r;
 	}
 
+	public static<T> Result<T> errorMsg(String msg) {
+		Result<T> r = new Result<T>();
+		r.setSuccess(true);
+		r.setCode(CommonConstant.STATUS_DISABLE);
+		//r.setResult(t);
+		r.setMessage(msg);
+		return r;
+	}
+
+
+	
 	public static Result<Object> error(String msg) {
 		return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
 	}
@@ -150,28 +161,4 @@ public class Result<T> implements Serializable {
 	@JsonIgnore
 	private String onlTable;
 
-
-
-
-
-
-	public static<T> Result<T> successMsg(String msg,T t) {
-		Result<T> r = new Result<T>();
-		r.setSuccess(true);
-		r.setCode(CommonConstant.STATUS_NORMAL);
-		r.setResult(t);
-		r.setMessage(msg);
-		return r;
-	}
-
-
-	public static<T> Result<T> errorMsg(String msg) {
-		Result<T> r = new Result<T>();
-		r.setSuccess(false);
-		r.setCode(CommonConstant.STATUS_DISABLE);
-		//r.setResult(t);
-		r.setMessage(msg);
-		return r;
-	}
-
 }

+ 20 - 36
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/DictAspect.java

@@ -14,18 +14,18 @@ import org.jeecg.common.api.CommonAPI;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecg.common.constant.CommonConstant;
-import org.jeecg.modules.base.service.BaseCommonService;
 import org.jeecg.common.util.oConvertUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.StringUtils;
+
 import java.lang.reflect.Field;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+
 /**
  * @Description: 字典aop类
  * @Author: dangzhenghui
@@ -36,20 +36,19 @@ import java.util.List;
 @Component
 @Slf4j
 public class DictAspect {
-
     @Autowired
     private CommonAPI commonAPI;
-    @Autowired
-    public RedisTemplate redisTemplate;
 
-    // 定义切点Pointcut
-    @Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..))")
+    /**
+     * 定义切点Pointcut
+     */
+    @Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..))||execution(public * cn.com.ctop..*.*Controller.*(..))")
     public void excudeService() {
     }
 
     @Around("excudeService()")
     public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
-    	long time1=System.currentTimeMillis();	
+        long time1 = System.currentTimeMillis();
         Object result = pjp.proceed();
         long time2=System.currentTimeMillis();
         log.debug("获取JSON数据 耗时:"+(time2-time1)+"ms");
@@ -104,17 +103,24 @@ public class DictAspect {
                             String code = field.getAnnotation(Dict.class).dicCode();
                             String text = field.getAnnotation(Dict.class).dicText();
                             String table = field.getAnnotation(Dict.class).dictTable();
+                            String extendsKey = field.getAnnotation(Dict.class).extendsKey();
+                            if("".equals(extendsKey.trim())){
+                                extendsKey = null;
+                            }
+                            String extendsValue = field.getAnnotation(Dict.class).extendsValue();
+                            if("".equals(extendsValue.trim())){
+                                extendsValue = null;
+                            }
                             String key = String.valueOf(item.get(field.getName()));
-
                             //翻译字典值对应的txt
-                            String textValue = translateDictValue(code, text, table, key);
+                            String textValue = translateDictValue(code, text, table, key,extendsKey,extendsValue);
 
                             log.debug(" 字典Val : "+ textValue);
                             log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
                             item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                         }
                         //date类型默认转换string格式化日期
-                        if (field.getType().getName().equals("java.util.Date")&&field.getAnnotation(JsonFormat.class)==null&&item.get(field.getName())!=null){
+                        if ("java.util.Date".equals(field.getType().getName()) && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                             SimpleDateFormat aDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                             item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                         }
@@ -135,7 +141,7 @@ public class DictAspect {
      * @param key
      * @return
      */
-    private String translateDictValue(String code, String text, String table, String key) {
+    private String translateDictValue(String code, String text, String table, String key,String extendsKey,String extendsValue) {
     	if(oConvertUtils.isEmpty(key)) {
     		return null;
     	}
@@ -147,32 +153,11 @@ public class DictAspect {
             if (k.trim().length() == 0) {
                 continue; //跳过循环
             }
-            //update-begin--Author:scott -- Date:20210531 ----for: !56 优化微服务应用下存在表字段需要字典翻译时加载缓慢问题-----
             if (!StringUtils.isEmpty(table)){
-                log.info("--DictAspect------dicTable="+ table+" ,dicText= "+text+" ,dicCode="+code);
-                String keyString = String.format("sys:cache:dictTable::SimpleKey [%s,%s,%s,%s]",table,text,code,k.trim());
-                if (redisTemplate.hasKey(keyString)){
-                    try {
-                        tmpValue = oConvertUtils.getString(redisTemplate.opsForValue().get(keyString));
-                    } catch (Exception e) {
-                        log.warn(e.getMessage());
-                    }
-                }else {
-                    tmpValue= commonAPI.translateDictFromTable(table,text,code,k.trim());
-                }
+                tmpValue= commonAPI.translateDictFromTable(table,text,code,k.trim(),extendsKey,extendsValue);
             }else {
-                String keyString = String.format("sys:cache:dict::%s:%s",code,k.trim());
-                if (redisTemplate.hasKey(keyString)){
-                    try {
-                        tmpValue = oConvertUtils.getString(redisTemplate.opsForValue().get(keyString));
-                    } catch (Exception e) {
-                       log.warn(e.getMessage());
-                    }
-                }else {
-                    tmpValue = commonAPI.translateDict(code, k.trim());
-                }
+                tmpValue = commonAPI.translateDict(code, k.trim(),extendsKey,extendsValue);
             }
-            //update-end--Author:scott -- Date:20210531 ----for: !56 优化微服务应用下存在表字段需要字典翻译时加载缓慢问题-----
 
             if (tmpValue != null) {
                 if (!"".equals(textValue.toString())) {
@@ -184,5 +169,4 @@ public class DictAspect {
         }
         return textValue.toString();
     }
-
 }

+ 18 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/Dict.java

@@ -39,4 +39,22 @@ public @interface Dict {
      * @return 返回类型: String
      */
     String dictTable() default "";
+
+    /**
+     * 方法描述: 数据字典表
+     * 作    者: dangzhenghui
+     * 日    期: 2019年03月17日-下午9:37:16
+     *
+     * @return 返回类型: String
+     */
+    String extendsKey() default "";
+
+    /**
+     * 方法描述: 数据字典表
+     * 作    者: dangzhenghui
+     * 日    期: 2019年03月17日-下午9:37:16
+     *
+     * @return 返回类型: String
+     */
+    String extendsValue() default "";
 }

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

@@ -101,6 +101,13 @@ public class DateUtils extends PropertyEditorSupport {
     // 各种方式获取的Date
     // ////////////////////////////////////////////////////////////////////////////
 
+    public static Date addSecond(Date date, int seconds) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.SECOND, seconds);
+        return calendar.getTime();
+    }
+
     /**
      * 当前日期
      *
@@ -363,6 +370,11 @@ public class DateUtils extends PropertyEditorSupport {
         return datetimeFormat.get().format(getCalendar().getTime());
     }
 
+    public static String formatDateTime(Long time) {
+        return datetimeFormat.get().format(time);
+    }
+
+
     /**
      * 获取时间字符串
      */

+ 19 - 0
jeecg-boot-bytedance-ad/pom.xml

@@ -23,6 +23,25 @@
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-system-local-api</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5.10</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.tony19</groupId>
+            <artifactId>apktool-lib</artifactId>
+            <version>1.4.4-3</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.googlecode.plist</groupId>
+            <artifactId>dd-plist</artifactId>
+            <version>1.16</version>
+            <scope>compile</scope>
+        </dependency>
+
     </dependencies>
     <build>
         <plugins>

+ 0 - 2
jeecg-boot-bytedance-ad/src/main/java/ctop/bytedance/ad/report/service/impl/BytedanceAdvertiserHourlyReportServiceImpl.java

@@ -5,11 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.sun.xml.bind.v2.TODO;
 import org.jeecg.common.api.vo.Result;
 import ctop.bytedance.ad.advertise.entity.AiBytedanceAdvertiserStrategy;
 import ctop.bytedance.ad.advertise.entity.ByteDanceAdvertisePlan;
-import ctop.bytedance.ad.advertise.entity.RuleDataAccount;
 import ctop.bytedance.ad.advertise.mapper.AiBytedanceAdvertiserStrategyMapper;
 import ctop.bytedance.ad.advertise.mapper.ByteDanceAdvertisePlanMapper;
 import ctop.bytedance.ad.advertise.vo.IndustryVo;

+ 1 - 0
pom.xml

@@ -51,6 +51,7 @@
         <module>jeecg-boot-base</module>
         <module>jeecg-boot-module-demo</module>
         <module>jeecg-boot-module-system</module>
+        <module>jeecg-boot-bytedance-ad</module>
 
        <!-- 需要微服务,请打开注释-->
        <module>jeecg-boot-starter</module>