From 374d079e334b7c1b6aab764233c0d497799cd701 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 21 Jul 2025 10:08:24 +0800 Subject: [PATCH] 1 --- dl_admin/ruoyi-admin/pom.xml | 9 +++++- .../ruoyi/base/controller/WebController.java | 22 +++++++++----- .../busi/service/IBusiCategoryService.java | 8 +++++ .../service/impl/BusiCategoryServiceImpl.java | 30 +++++++++++++++++++ .../com/ruoyi/busi/vo/BusiCategoryVO.java | 5 ++++ .../src/main/resources/google-ads.properties | 6 ++++ .../statistics/thirdItem/inquiryChart.vue | 6 +++- 7 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 dl_admin/ruoyi-admin/src/main/resources/google-ads.properties diff --git a/dl_admin/ruoyi-admin/pom.xml b/dl_admin/ruoyi-admin/pom.xml index b4ab22d..132c9de 100644 --- a/dl_admin/ruoyi-admin/pom.xml +++ b/dl_admin/ruoyi-admin/pom.xml @@ -26,7 +26,7 @@ commons-io commons-io - 2.4 + 2.11.0 @@ -144,6 +144,13 @@ jsoup 1.11.3 + + + com.google.api-ads + google-ads + 28.0.0 + + diff --git a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/base/controller/WebController.java b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/base/controller/WebController.java index a9a05ef..93a7b84 100644 --- a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/base/controller/WebController.java +++ b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/base/controller/WebController.java @@ -85,7 +85,8 @@ public class WebController extends BaseController { public R> categoryList(@RequestParam(required = true) String tenantId){ BusiCategory category = new BusiCategory(); category.setTenantId(tenantId); - return R.ok(categoryService.treeCategory(category)); + List busiCategoryVOList = categoryService.treeCategory(category); + return R.ok(categoryService.dealFirstId(busiCategoryVOList)); } /** @@ -94,16 +95,23 @@ public class WebController extends BaseController { * @date 10:04 2025/7/8 * @return com.ruoyi.common.core.domain.AjaxResult **/ - @ApiOperation("获取站点产品分类树--产品分类") - @ApiImplicitParam(name = "tenantId", value = "站点唯一码", required = true, dataType = "string", paramType = "query", dataTypeClass = String.class) + @ApiOperation("获取站点分类树--根据一级分类ID查询所有子级分类树") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "tenantId", value = "站点唯一码", required = true, dataType = "string", paramType = "query", dataTypeClass = String.class), + @ApiImplicitParam(name = "catgId", value = "一级分类ID", required = true, dataType = "string", paramType = "query", dataTypeClass = String.class) + }) @GetMapping("/prodCategory") - public R> prodCategoryList(@RequestParam(required = true) String tenantId){ + public R> prodCategoryList(@RequestParam(required = true) String tenantId,@RequestParam(required = true) String catgId){ BusiCategory category = new BusiCategory(); category.setTenantId(tenantId); - category.setCatgType("cp"); - List list = categoryService.treeCategory(category); + List busiCategoryVOList = categoryService.treeCategory(category); + for (BusiCategoryVO categoryVO:busiCategoryVOList){ + if(catgId.equals(categoryVO.getId())){ + return R.ok(categoryVO.getChildren()); + } + } //最顶级的产品分类不反回 - return R.ok(list.get(0).getChildren()); + return R.ok(); } /** diff --git a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/IBusiCategoryService.java b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/IBusiCategoryService.java index 4e0c43b..63a7776 100644 --- a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/IBusiCategoryService.java +++ b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/IBusiCategoryService.java @@ -42,4 +42,12 @@ public interface IBusiCategoryService extends IService { **/ List getAllChildrenId(String id); + /** + * 给所有子级设置最父级ID + * @author vinjor-M + * @date 11:23 2025/7/19 + * @param busiCategoryVOList TODO + * @return java.util.List + **/ + List dealFirstId(List busiCategoryVOList); } diff --git a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/impl/BusiCategoryServiceImpl.java b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/impl/BusiCategoryServiceImpl.java index e04e932..4d4c1b6 100644 --- a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/impl/BusiCategoryServiceImpl.java +++ b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/service/impl/BusiCategoryServiceImpl.java @@ -196,4 +196,34 @@ public class BusiCategoryServiceImpl extends ServiceImpl getAllChildrenId(String id) { return baseMapper.selectAllChildren(id); } + + /** + * 给所有子级设置最父级ID + * + * @param busiCategoryVOList TODO + * @return java.util.List + * @author vinjor-M + * @date 11:22 2025/7/19 + **/ + @Override + public List dealFirstId(List busiCategoryVOList) { + busiCategoryVOList.forEach(item->{ + String thisMaxParentId = item.getId(); + item.setMaxParentId(thisMaxParentId); + if(null!=item.getChildren() && !item.getChildren().isEmpty()){ + //有子级 + this.setChildMaxParentId(item.getChildren(),thisMaxParentId); + } + }); + return busiCategoryVOList; + } + + private void setChildMaxParentId(List childList,String maxParentId){ + childList.forEach(item->{ + item.setMaxParentId(maxParentId); + if(null!=item.getChildren()&& !item.getChildren().isEmpty()){ + this.setChildMaxParentId(item.getChildren(),maxParentId); + } + }); + } } diff --git a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/vo/BusiCategoryVO.java b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/vo/BusiCategoryVO.java index cca67d8..8a7a461 100644 --- a/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/vo/BusiCategoryVO.java +++ b/dl_admin/ruoyi-admin/src/main/java/com/ruoyi/busi/vo/BusiCategoryVO.java @@ -25,6 +25,11 @@ import java.util.List; public class BusiCategoryVO extends BusiCategory { private String label; + /** + * 最父级ID + */ + @ApiModelProperty("最父级ID") + private String maxParentId; /** * 子集 diff --git a/dl_admin/ruoyi-admin/src/main/resources/google-ads.properties b/dl_admin/ruoyi-admin/src/main/resources/google-ads.properties new file mode 100644 index 0000000..5b96098 --- /dev/null +++ b/dl_admin/ruoyi-admin/src/main/resources/google-ads.properties @@ -0,0 +1,6 @@ +# Google Ads API ?? +api.googleads.clientId=76632811767-p4ieetlihrr311tfk7hchovo1kcqkh4o.apps.googleusercontent.com +api.googleads.clientSecret=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 +api.googleads.refreshToken=YOUR_REFRESH_TOKEN +api.googleads.developerToken=qwFA3dGfOGqEhSEHlCMorA +api.googleads.loginCustomerId=YOUR_MANAGER_ACCOUNT_ID # ??? MCC ?? diff --git a/dl_vue/src/views/statistics/thirdItem/inquiryChart.vue b/dl_vue/src/views/statistics/thirdItem/inquiryChart.vue index 7dee5dc..ff41035 100644 --- a/dl_vue/src/views/statistics/thirdItem/inquiryChart.vue +++ b/dl_vue/src/views/statistics/thirdItem/inquiryChart.vue @@ -18,7 +18,11 @@ 重置 - + + + + +