Browse Source

事项top10

master
PoffyZhang 11 months ago
parent
commit
397e0eb72a
4 changed files with 60 additions and 2 deletions
  1. +8
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java
  2. +31
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/entity/vo/MatterTopVO.java
  3. +20
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java
  4. +1
    -2
      kqapi/src/test/java/com/ningdatech/kqapi/menu/DuplicationTest.java

+ 8
- 0
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java View File

@@ -2,6 +2,8 @@ package com.ningdatech.kqapi.zzsfw.controller;


import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.manage.MatterManage;
import io.swagger.annotations.Api;
@@ -37,4 +39,10 @@ public class NdKqZzsfwMenuController {
public List<TreeVO> getMatters() {
return matterManage.getMatters();
}

@ApiOperation(value = "top10事项", notes = "top10事项")
@GetMapping("/top10")
public List<MatterTopVO> topTen() {
return matterManage.topTen();
}
}

+ 31
- 0
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/entity/vo/MatterTopVO.java View File

@@ -0,0 +1,31 @@
package com.ningdatech.kqapi.zzsfw.entity.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* <p>
* 事项
* </p>
*
* @author ZPF
* @since 2023-10-25
*/
@Data
@ApiModel(value = "MatterTopVO", description = "事项top")
public class MatterTopVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("事项名称")
private String matterName;

@ApiModelProperty("事项链接")
private String webapplyurl;

@ApiModelProperty("数量")
private Integer count;
}

+ 20
- 0
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java View File

@@ -1,11 +1,15 @@
package com.ningdatech.kqapi.zzsfw.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.kqapi.common.enumeration.CommonEnum;
import com.ningdatech.kqapi.zzsfw.constants.ZzsfwMenuConstant;
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMattersDeduplicate;
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu;
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMatterDeduplicateService;
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -28,8 +32,11 @@ public class MatterManage {

private final INdKqZzsfwMenuService menuService;

private final INdKqZzsfwMatterDeduplicateService matterDeduplicateService;

public List<TreeVO> getMatters() {
List<NdKqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)
.isNotNull(NdKqZzsfwMenu::getWebapplyurl)
.orderByAsc(NdKqZzsfwMenu::getSort));
if(CollUtil.isEmpty(matters)){
return Collections.emptyList();
@@ -87,4 +94,17 @@ public class MatterManage {
return matter;
}).collect(Collectors.toList());
}

public List<MatterTopVO> topTen() {
List<NdKqZzsfwMattersDeduplicate> topTen = matterDeduplicateService.list(Wrappers.lambdaQuery(NdKqZzsfwMattersDeduplicate.class)
.orderByDesc(NdKqZzsfwMattersDeduplicate::getCountNum)
.last("limit 10"));
return topTen.stream().map(m -> {
MatterTopVO vo = new MatterTopVO();
vo.setMatterName(m.getQlName());
vo.setWebapplyurl(m.getWebapplyurl());
vo.setCount(m.getCountNum());
return vo;
}).collect(Collectors.toList());
}
}

+ 1
- 2
kqapi/src/test/java/com/ningdatech/kqapi/menu/DuplicationTest.java View File

@@ -78,8 +78,7 @@ public class DuplicationTest extends AppTests {

@Test
public void syncUrl(){
List<NdKqZzsfwMenu> menus = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)
.isNull(NdKqZzsfwMenu::getWebapplyurl));
List<NdKqZzsfwMenu> menus = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class));

List<NdKqZzsfwMattersDeduplicate> list = matterDeduplicateService.list();



Loading…
Cancel
Save