企业信息统计 根据审核状态统计企业数据接口返回格式调整

This commit is contained in:
lc 2024-06-21 17:39:12 +08:00
parent 11a80dd985
commit eca03dada7
3 changed files with 31 additions and 8 deletions

View File

@ -24,7 +24,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -132,8 +131,8 @@ public class EnterpriseInformationController {
@GetMapping("/statisticByStatus")
@Operation(summary = "根据审核状态统计企业数据")
public CommonResult<Map<Integer,Long>> statisticByStatus(){
Map<Integer, Long> integerLongMap = enterpriseInformationService.statisticByStatus();
public CommonResult<List<StatisticsResultData>> statisticByStatus(){
List<StatisticsResultData> integerLongMap = enterpriseInformationService.statisticByStatus();
return success(integerLongMap);
}
}

View File

@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.Statisti
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 企业信息 Service 接口
@ -107,5 +106,5 @@ public interface EnterpriseInformationService {
* 根据审核状态统计企业数据
* @return
*/
Map<Integer,Long> statisticByStatus();
List<StatisticsResultData> statisticByStatus();
}

View File

@ -367,10 +367,35 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
* @return
*/
@Override
public Map<Integer, Long> statisticByStatus() {
public List<StatisticsResultData> statisticByStatus() {
List<EnterpriseInformationDO> enterpriseInformationDOS = enterpriseInformationMapper.selectList();
Map<Integer, Long> statusCounts = enterpriseInformationDOS.stream().collect(Collectors.groupingBy(EnterpriseInformationDO::getStatus, Collectors.counting()));
return statusCounts;
Map<Integer, Long> statusCounts = enterpriseInformationDOS.stream()
.collect(Collectors.groupingBy(EnterpriseInformationDO::getStatus, Collectors.counting()));
List<StatisticsResultData> list = new ArrayList<>();
StatisticsResultData running = new StatisticsResultData();
running.setName("analysis.running");
running.setValue(statusCounts.get(1));//审批中
StatisticsResultData approve = new StatisticsResultData();
approve.setName("analysis.approve");
approve.setValue(statusCounts.get(2));//审批通过
StatisticsResultData reject = new StatisticsResultData();
reject.setName("analysis.reject");
reject.setValue(statusCounts.get(4));//审批不通过
StatisticsResultData cancel = new StatisticsResultData();
cancel.setName("analysis.cancel");
cancel.setValue(statusCounts.get(4));//已取消
list.add(running);
list.add(approve);
list.add(reject);
list.add(cancel);
return list;
}
private void validateLeaveExists(Long id) {