This commit is contained in:
Vinjor 2025-07-21 10:08:24 +08:00
parent 437224cad5
commit 374d079e33
7 changed files with 77 additions and 9 deletions

View File

@ -26,7 +26,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.11.0</version>
</dependency>
<!--微信支付SDK-->
@ -144,6 +144,13 @@
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>google-ads</artifactId>
<version>28.0.0</version> <!-- 使用最新版本 -->
</dependency>
</dependencies>
<build>

View File

@ -85,7 +85,8 @@ public class WebController extends BaseController {
public R<List<BusiCategoryVO>> categoryList(@RequestParam(required = true) String tenantId){
BusiCategory category = new BusiCategory();
category.setTenantId(tenantId);
return R.ok(categoryService.treeCategory(category));
List<BusiCategoryVO> 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<List<BusiCategoryVO>> prodCategoryList(@RequestParam(required = true) String tenantId){
public R<List<BusiCategoryVO>> prodCategoryList(@RequestParam(required = true) String tenantId,@RequestParam(required = true) String catgId){
BusiCategory category = new BusiCategory();
category.setTenantId(tenantId);
category.setCatgType("cp");
List<BusiCategoryVO> list = categoryService.treeCategory(category);
List<BusiCategoryVO> 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();
}
/**

View File

@ -42,4 +42,12 @@ public interface IBusiCategoryService extends IService<BusiCategory> {
**/
List<String> getAllChildrenId(String id);
/**
* 给所有子级设置最父级ID
* @author vinjor-M
* @date 11:23 2025/7/19
* @param busiCategoryVOList TODO
* @return java.util.List<com.ruoyi.busi.vo.BusiCategoryVO>
**/
List<BusiCategoryVO> dealFirstId(List<BusiCategoryVO> busiCategoryVOList);
}

View File

@ -196,4 +196,34 @@ public class BusiCategoryServiceImpl extends ServiceImpl<BusiCategoryMapper, Bus
public List<String> getAllChildrenId(String id) {
return baseMapper.selectAllChildren(id);
}
/**
* 给所有子级设置最父级ID
*
* @param busiCategoryVOList TODO
* @return java.util.List<com.ruoyi.busi.vo.BusiCategoryVO>
* @author vinjor-M
* @date 11:22 2025/7/19
**/
@Override
public List<BusiCategoryVO> dealFirstId(List<BusiCategoryVO> 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<BusiCategoryVO> childList,String maxParentId){
childList.forEach(item->{
item.setMaxParentId(maxParentId);
if(null!=item.getChildren()&& !item.getChildren().isEmpty()){
this.setChildMaxParentId(item.getChildren(),maxParentId);
}
});
}
}

View File

@ -25,6 +25,11 @@ import java.util.List;
public class BusiCategoryVO extends BusiCategory {
private String label;
/**
* 最父级ID
*/
@ApiModelProperty("最父级ID")
private String maxParentId;
/**
* 子集

View File

@ -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 ??

View File

@ -18,7 +18,11 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<line-chart ref="lineChart"></line-chart>
<el-row :gutter="10" class="mb8">
<el-col :span="24">
<line-chart ref="lineChart"></line-chart>
</el-col>
</el-row>
</div>
</template>