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

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

View File

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

View File

@ -367,10 +367,35 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
* @return * @return
*/ */
@Override @Override
public Map<Integer, Long> statisticByStatus() { public List<StatisticsResultData> statisticByStatus() {
List<EnterpriseInformationDO> enterpriseInformationDOS = enterpriseInformationMapper.selectList(); List<EnterpriseInformationDO> enterpriseInformationDOS = enterpriseInformationMapper.selectList();
Map<Integer, Long> statusCounts = enterpriseInformationDOS.stream().collect(Collectors.groupingBy(EnterpriseInformationDO::getStatus, Collectors.counting())); Map<Integer, Long> statusCounts = enterpriseInformationDOS.stream()
return statusCounts; .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) { private void validateLeaveExists(Long id) {