Quellcode durchsuchen

三方对外接口

yumeng vor 4 Jahren
Ursprung
Commit
db3eceecc3
14 geänderte Dateien mit 689 neuen und 34 gelöschten Zeilen
  1. 33 30
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 6 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  3. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/controller/ThirtConfigAdvertiserController.java
  4. 134 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/controller/ThirtConfigController.java
  5. 57 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/entity/ThirtConfig.java
  6. 57 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/entity/ThirtConfigAdvertiser.java
  7. 22 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/ThirtConfigAdvertiserMapper.java
  8. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/ThirtConfigMapper.java
  9. 24 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/xml/ThirtConfigAdvertiserMapper.xml
  10. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/xml/ThirtConfigMapper.xml
  11. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/IThirtConfigAdvertiserService.java
  12. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/IThirtConfigService.java
  13. 35 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/impl/ThirtConfigAdvertiserServiceImpl.java
  14. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/impl/ThirtConfigServiceImpl.java

+ 33 - 30
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -43,6 +43,7 @@ public class ShiroConfig {
 
     @Value("${spring.redis.password}")
     private String redisPassword;
+
     /**
      * Filter Chain定义说明
      * <p>
@@ -169,6 +170,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
         filterChainDefinitionMap.put("/job/test/*", "anon");
+        filterChainDefinitionMap.put("//thirt/*", "anon");
         //filterChainDefinitionMap.put("/kuaishou/**", "anon");
 
         // 添加自己的过滤器并且取名为jwt
@@ -204,35 +206,36 @@ public class ShiroConfig {
         return securityManager;
     }
 
-	/**
-	 * 下面的代码是添加注解支持
-	 * @return
-	 */
-	@Bean
-	@DependsOn("lifecycleBeanPostProcessor")
-	public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
-		DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
-		defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
-		/**
-		* 解决重复代理问题 github#994
-		* 添加前缀判断 不匹配 任何Advisor
-		*/
-		defaultAdvisorAutoProxyCreator.setUsePrefix(true);
-		defaultAdvisorAutoProxyCreator.setAdvisorBeanNamePrefix("_no_advisor");
-		return defaultAdvisorAutoProxyCreator;
-	}
+    /**
+     * 下面的代码是添加注解支持
+     *
+     * @return
+     */
+    @Bean
+    @DependsOn("lifecycleBeanPostProcessor")
+    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+        /**
+         * 解决重复代理问题 github#994
+         * 添加前缀判断 不匹配 任何Advisor
+         */
+        defaultAdvisorAutoProxyCreator.setUsePrefix(true);
+        defaultAdvisorAutoProxyCreator.setAdvisorBeanNamePrefix("_no_advisor");
+        return defaultAdvisorAutoProxyCreator;
+    }
 
-	@Bean
-	public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
-		return new LifecycleBeanPostProcessor();
-	}
+    @Bean
+    public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
 
-	@Bean
-	public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
-		AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
-		advisor.setSecurityManager(securityManager);
-		return advisor;
-	}
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
+        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+        advisor.setSecurityManager(securityManager);
+        return advisor;
+    }
 
     /**
      * cacheManager 缓存 redis实现
@@ -259,9 +262,9 @@ public class ShiroConfig {
     @Bean
     public RedisManager redisManager() {
         RedisManager redisManager = new RedisManager();
-		redisManager.setHost(host);
-		redisManager.setPort(oConvertUtils.getInt(port));
-		redisManager.setTimeout(0);
+        redisManager.setHost(host);
+        redisManager.setPort(oConvertUtils.getInt(port));
+        redisManager.setTimeout(0);
         if (!StringUtils.isEmpty(redisPassword)) {
             redisManager.setPassword(redisPassword);
         }

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

@@ -35,10 +35,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Slf4j
 @RestController
@@ -228,6 +225,11 @@ public class CallbackController {
         return "授权绑定失败!";
     }
 
+
+    public static void main(String[] args) {
+        System.err.println(UUID.randomUUID().toString().replace("-", ""));
+    }
+
     @RequestMapping("/bytedance")
     public String bytedance(HttpServletRequest request,
                             HttpServletResponse response,

+ 248 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/controller/ThirtConfigAdvertiserController.java

@@ -0,0 +1,248 @@
+package org.jeecg.modules.thirt.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.thirt.entity.ThirtConfigAdvertiser;
+import org.jeecg.modules.thirt.server.IThirtConfigAdvertiserService;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Slf4j
+@Api(tags = "对外配置关联广告主")
+@RestController
+@RequestMapping("/n/thirtConfigAdvertiser")
+public class ThirtConfigAdvertiserController {
+    @Autowired
+    private IThirtConfigAdvertiserService thirtConfigAdvertiserService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param thirtConfigAdvertiser
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "对外配置关联广告主-分页列表查询")
+    @ApiOperation(value = "对外配置关联广告主-分页列表查询", notes = "对外配置关联广告主-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ThirtConfigAdvertiser>> queryPageList(ThirtConfigAdvertiser thirtConfigAdvertiser,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<ThirtConfigAdvertiser>> result = new Result<>();
+        QueryWrapper<ThirtConfigAdvertiser> queryWrapper = QueryGenerator.initQueryWrapper(thirtConfigAdvertiser, req.getParameterMap());
+        Page<ThirtConfigAdvertiser> page = new Page<ThirtConfigAdvertiser>(pageNo, pageSize);
+        IPage<ThirtConfigAdvertiser> pageList = thirtConfigAdvertiserService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param thirtConfigAdvertiser
+     * @return
+     */
+    @AutoLog(value = "对外配置关联广告主-添加")
+    @ApiOperation(value = "对外配置关联广告主-添加", notes = "对外配置关联广告主-添加")
+    @PostMapping(value = "/add")
+    public Result<ThirtConfigAdvertiser> add(@RequestBody ThirtConfigAdvertiser thirtConfigAdvertiser) {
+        Result<ThirtConfigAdvertiser> result = new Result<>();
+        try {
+            thirtConfigAdvertiserService.save(thirtConfigAdvertiser);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param thirtConfigAdvertiser
+     * @return
+     */
+    @AutoLog(value = "对外配置关联广告主-编辑")
+    @ApiOperation(value = "对外配置关联广告主-编辑", notes = "对外配置关联广告主-编辑")
+    @PutMapping(value = "/edit")
+    public Result<ThirtConfigAdvertiser> edit(@RequestBody ThirtConfigAdvertiser thirtConfigAdvertiser) {
+        Result<ThirtConfigAdvertiser> result = new Result<ThirtConfigAdvertiser>();
+        ThirtConfigAdvertiser thirtConfigAdvertiserEntity = thirtConfigAdvertiserService.getById(thirtConfigAdvertiser.getId());
+        if (thirtConfigAdvertiserEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = thirtConfigAdvertiserService.updateById(thirtConfigAdvertiser);
+            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 {
+            thirtConfigAdvertiserService.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<ThirtConfigAdvertiser> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<ThirtConfigAdvertiser> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.thirtConfigAdvertiserService.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<ThirtConfigAdvertiser> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<ThirtConfigAdvertiser> result = new Result<>();
+        ThirtConfigAdvertiser thirtConfigAdvertiser = thirtConfigAdvertiserService.getById(id);
+        if (thirtConfigAdvertiser == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(thirtConfigAdvertiser);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<ThirtConfigAdvertiser> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                ThirtConfigAdvertiser thirtConfigAdvertiser = JSON.parseObject(deString, ThirtConfigAdvertiser.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(thirtConfigAdvertiser, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<ThirtConfigAdvertiser> pageList = thirtConfigAdvertiserService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "对外配置关联广告主列表");
+        mv.addObject(NormalExcelConstants.CLASS, ThirtConfigAdvertiser.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<ThirtConfigAdvertiser> listThirtConfigAdvertisers = ExcelImportUtil.importExcel(file.getInputStream(), ThirtConfigAdvertiser.class, params);
+                thirtConfigAdvertiserService.saveBatch(listThirtConfigAdvertisers);
+                return Result.ok("文件导入成功!数据行数:" + listThirtConfigAdvertisers.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("文件导入失败!");
+    }
+
+}

+ 134 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/controller/ThirtConfigController.java

@@ -0,0 +1,134 @@
+package org.jeecg.modules.thirt.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.thirt.entity.ThirtConfig;
+import org.jeecg.modules.thirt.entity.ThirtConfigAdvertiser;
+import org.jeecg.modules.thirt.server.IThirtConfigAdvertiserService;
+import org.jeecg.modules.thirt.server.IThirtConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 对外配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Slf4j
+@Api(tags = "对外配置")
+@RestController
+@RequestMapping("/thirt")
+public class ThirtConfigController {
+    @Autowired
+    private IThirtConfigService thirtConfigService;
+    @Autowired
+    private IThirtConfigAdvertiserService thirtConfigAdvertiserService;
+
+    @PostMapping(value = "/getAdvertiserList")
+    public Result<List<String>> getAdvertiserList(@RequestBody JSONObject requestJson) {
+
+        Result<List<String>> result = new Result<>();
+        try {
+            Long appId = requestJson.getLong("appId");
+            if (Check.isNull(appId)) {
+                throw new Exception("必传参数appId不能为空");
+            }
+            QueryWrapper<ThirtConfig> thirtConfigQueryWrapper = new QueryWrapper<>();
+            thirtConfigQueryWrapper.eq("app_id", appId);
+            ThirtConfig config = thirtConfigService.getOne(thirtConfigQueryWrapper);
+            if (Check.isNull(config)) {
+                throw new Exception("appId不正确");
+            }
+            String secret = requestJson.getString("secret");
+            if (Check.isNull(secret)) {
+                throw new Exception("secret不能为空");
+            }
+            if (!secret.equals(config.getSecret())) {
+                throw new Exception("secret不正确");
+            }
+
+            List<String> advertiserList = thirtConfigAdvertiserService.getAdvertiserListByAppId(appId);
+            result.setResult(advertiserList);
+
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+            result.setCode(-1);
+
+        }
+        return result;
+    }
+
+
+    @PostMapping(value = "/getAdvertiserCost")
+    public Result<List<JSONObject>> getAdvertiserCost(@RequestBody JSONObject requestJson) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+
+            Long appId = requestJson.getLong("appId");
+            if (Check.isNull(appId)) {
+                throw new Exception("必传参数appId不能为空");
+            }
+            QueryWrapper<ThirtConfig> thirtConfigQueryWrapper = new QueryWrapper<>();
+            thirtConfigQueryWrapper.eq("app_id", appId);
+            ThirtConfig config = thirtConfigService.getOne(thirtConfigQueryWrapper);
+            if (Check.isNull(config)) {
+                throw new Exception("appId不正确");
+            }
+            String secret = requestJson.getString("secret");
+            if (Check.isNull(secret)) {
+                throw new Exception("secret不能为空");
+            }
+            if (!secret.equals(config.getSecret())) {
+                throw new Exception("secret不正确");
+            }
+
+            String advertiserName = requestJson.getString("advertiserName");
+            if (Check.isNull(advertiserName)) {
+                throw new Exception("请输入需要查询广告主名称");
+            }
+
+            QueryWrapper<ThirtConfigAdvertiser> thirtConfigAdvertiserQueryWrapper = new QueryWrapper<>();
+            thirtConfigAdvertiserQueryWrapper.eq("app_id", appId);
+            thirtConfigAdvertiserQueryWrapper.eq("advertiser_name", advertiserName);
+            thirtConfigAdvertiserQueryWrapper.last("limit 1");
+            ThirtConfigAdvertiser configAdvertiser = thirtConfigAdvertiserService.getOne(thirtConfigAdvertiserQueryWrapper);
+            if (Check.isNull(configAdvertiser)) {
+                throw new Exception("此appId下暂无此广告主信息");
+
+            }
+            String startDate = requestJson.getString("startDate");
+            if (Check.isNull(startDate)) {
+                throw new Exception("请输入查询开始时间");
+            }
+
+            String endDate = requestJson.getString("endDate");
+            if (Check.isNull(endDate)) {
+                throw new Exception("请输入查询结束时间");
+            }
+
+
+            List<JSONObject> costList = thirtConfigAdvertiserService.getAdvertiserCost(appId, advertiserName, startDate, endDate);
+            result.setResult(costList);
+        } catch (Exception e) {
+            result.setCode(-1);
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+}

+ 57 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/entity/ThirtConfig.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.thirt.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 对外配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Data
+@TableName("ctop_thirt_config")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_thirt_config对象", description = "对外配置")
+public class ThirtConfig {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * appId
+     */
+    @Excel(name = "appId", width = 15)
+    @ApiModelProperty(value = "appId")
+    private Long appId;
+    /**
+     * secret
+     */
+    @Excel(name = "secret", width = 15)
+    @ApiModelProperty(value = "secret")
+    private String secret;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * update
+     */
+    @ApiModelProperty(value = "update")
+    private Date updateTime;
+}

+ 57 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/entity/ThirtConfigAdvertiser.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.thirt.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Data
+@TableName("ctop_thirt_config_advertiser")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_thirt_config_advertiser对象", description = "对外配置关联广告主")
+public class ThirtConfigAdvertiser {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * appId
+     */
+    @Excel(name = "appId", width = 15)
+    @ApiModelProperty(value = "appId")
+    private Integer appId;
+    /**
+     * advertsierName
+     */
+    @Excel(name = "advertsierName", width = 15)
+    @ApiModelProperty(value = "advertiserName")
+    private String advertiserName;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * update
+     */
+    @ApiModelProperty(value = "update")
+    private Date updateTime;
+}

+ 22 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/ThirtConfigAdvertiserMapper.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.thirt.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.thirt.entity.ThirtConfigAdvertiser;
+
+import java.util.List;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author: jeecg-boot
+ * @date: 2020-08-14
+ * @cersion: V1.0
+ */
+public interface ThirtConfigAdvertiserMapper extends BaseMapper<ThirtConfigAdvertiser> {
+
+    List<JSONObject> getAdvertiserCost(@Param("appId") Long appId, @Param("advertiserName") String advertiserName, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<String> getAdvertiserListByAppId(@Param("appId") Long appId);
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/ThirtConfigMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.thirt.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.thirt.entity.ThirtConfig;
+
+/**
+ * 对外配置
+ *
+ * @author: jeecg-boot
+ * @date: 2020-08-14
+ * @cersion: V1.0
+ */
+public interface ThirtConfigMapper extends BaseMapper<ThirtConfig> {
+
+}

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/xml/ThirtConfigAdvertiserMapper.xml

@@ -0,0 +1,24 @@
+<?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="org.jeecg.modules.thirt.mapper.ThirtConfigAdvertiserMapper">
+
+    <select id="getAdvertiserListByAppId" resultType="java.lang.String">
+     select advertiser_name
+      from ctop_thirt_config_advertiser
+     where  app_id = #{appId}
+     group by advertiser_name
+    </select>
+
+    <select id="getAdvertiserCost" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(t2.charge) as 'charge',
+        stat_date as 'statDate'
+        from ctop_kuaishou_advertiser_base_info t1
+        LEFT JOIN ctop_kuaishou_report_daily_account t2
+        ON t1.account_id = t2.account_id
+        WHERE t1.corporation_name = #{advertiserName}
+        and t2.stat_date &gt;= #{startDate}
+        AND t2.stat_date &lt;= #{endDate}
+        GROUP BY t2.stat_date
+    </select>
+
+</mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/mapper/xml/ThirtConfigMapper.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="org.jeecg.modules.thirt.mapper.ThirtConfigMapper">
+
+</mapper>

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/IThirtConfigAdvertiserService.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.thirt.server;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.thirt.entity.ThirtConfigAdvertiser;
+
+import java.util.List;
+
+/**
+ * @Description: 对外配置关联广告主
+ * @Author: jeecg-boot
+ * @Date: 2020-08-14
+ * @Version: V1.0
+ */
+public interface IThirtConfigAdvertiserService extends IService<ThirtConfigAdvertiser> {
+
+    List<String> getAdvertiserListByAppId(Long appId);
+
+    List<JSONObject> getAdvertiserCost(Long appId, String advertiserName, String startDate, String endDate);
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/IThirtConfigService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.thirt.server;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.thirt.entity.ThirtConfig;
+
+/**
+ * @Description: 对外配置
+ * @Author: jeecg-boot
+ * @Date: 2020-08-14
+ * @Version: V1.0
+ */
+public interface IThirtConfigService extends IService<ThirtConfig> {
+
+}

+ 35 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/impl/ThirtConfigAdvertiserServiceImpl.java

@@ -0,0 +1,35 @@
+package org.jeecg.modules.thirt.server.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.thirt.entity.ThirtConfigAdvertiser;
+import org.jeecg.modules.thirt.mapper.ThirtConfigAdvertiserMapper;
+import org.jeecg.modules.thirt.server.IThirtConfigAdvertiserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Service
+public class ThirtConfigAdvertiserServiceImpl extends ServiceImpl<ThirtConfigAdvertiserMapper, ThirtConfigAdvertiser> implements IThirtConfigAdvertiserService {
+    @Autowired
+    private ThirtConfigAdvertiserMapper thirtConfigAdvertiserMapper;
+
+
+    @Override
+    public List<String> getAdvertiserListByAppId(Long appId) {
+        return thirtConfigAdvertiserMapper.getAdvertiserListByAppId(appId);
+    }
+
+    @Override
+    public List<JSONObject> getAdvertiserCost(Long appId, String advertiserName, String startDate, String endDate) {
+        return thirtConfigAdvertiserMapper.getAdvertiserCost(appId, advertiserName, startDate, endDate);
+    }
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/thirt/server/impl/ThirtConfigServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.thirt.server.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.thirt.entity.ThirtConfig;
+import org.jeecg.modules.thirt.mapper.ThirtConfigMapper;
+import org.jeecg.modules.thirt.server.IThirtConfigService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 对外配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Service
+public class ThirtConfigServiceImpl extends ServiceImpl<ThirtConfigMapper, ThirtConfig> implements IThirtConfigService {
+
+}