企业信息统计 查询企业月度注册数返回格式调整
This commit is contained in:
parent
c1aa400445
commit
f04cd81469
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.Ent
|
|||
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationRespVO;
|
||||
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.StatisticsResultData;
|
||||
import cn.iocoder.yudao.module.fta.service.enterpriseinformation.EnterpriseInformationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
|
@ -122,9 +123,11 @@ public class EnterpriseInformationController {
|
|||
|
||||
@GetMapping("/selectEnterpriseByMonth")
|
||||
@Operation(summary = "查询平台企业月度注册数")
|
||||
public CommonResult<Map<String,Long>> selectEnterpriseByMonth(){
|
||||
Map<String, Long> stringLongMap = enterpriseInformationService.selectEnterpriseByMonth();
|
||||
return success(stringLongMap);
|
||||
public CommonResult<List<StatisticsResultData>> selectEnterpriseByMonth(){
|
||||
//Map<String, Long> stringLongMap = enterpriseInformationService.selectEnterpriseByMonth();
|
||||
//return success(stringLongMap);
|
||||
List<StatisticsResultData> statisticsResultData = enterpriseInformationService.selectEnterpriseByMonth();
|
||||
return success(statisticsResultData);
|
||||
}
|
||||
|
||||
@GetMapping("/statisticByStatus")
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StatisticsResultData {
|
||||
private Long value;
|
||||
private String name;
|
||||
}
|
|
@ -5,8 +5,10 @@ import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.Ent
|
|||
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationRespVO;
|
||||
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.StatisticsResultData;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -99,7 +101,7 @@ public interface EnterpriseInformationService {
|
|||
* 查询平台企业月度注册数
|
||||
* @return
|
||||
*/
|
||||
Map<String, Long> selectEnterpriseByMonth();
|
||||
List<StatisticsResultData> selectEnterpriseByMonth();
|
||||
|
||||
/**
|
||||
* 根据审核状态统计企业数据
|
||||
|
|
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.Ent
|
|||
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO;
|
||||
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.StatisticsResultData;
|
||||
import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.CredentialManagementMapper;
|
||||
import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.EnterpriseInformationMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -296,7 +299,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Long> selectEnterpriseByMonth() {
|
||||
public List<StatisticsResultData> selectEnterpriseByMonth() {
|
||||
List<EnterpriseInformationDO> enterpriseInformationDOS = enterpriseInformationMapper.selectList();
|
||||
// 按月度分组并计算企业数量
|
||||
Map<String, Long> monthlyCounts = enterpriseInformationDOS.stream()
|
||||
|
@ -305,7 +308,126 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
|
|||
((enterprise.getCreateTime().getMonthValue())),
|
||||
Collectors.counting()
|
||||
));
|
||||
return monthlyCounts;
|
||||
LocalDate today = LocalDate.now();
|
||||
int year = today.getYear();//当前年份
|
||||
Map<String, Long> filteredCounts = monthlyCounts.entrySet().stream()
|
||||
.filter(entry -> entry.getKey().contains(year+""))
|
||||
.collect(Collectors.toMap(
|
||||
entry -> entry.getKey().substring(5),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
List<StatisticsResultData> list = new ArrayList<>();
|
||||
|
||||
StatisticsResultData january = new StatisticsResultData();
|
||||
january.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("1")){
|
||||
january.setValue(filteredCounts.get("1"));
|
||||
}else {
|
||||
january.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData february = new StatisticsResultData();
|
||||
february.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("2")){
|
||||
february.setValue(filteredCounts.get("2"));
|
||||
}else {
|
||||
february.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData march = new StatisticsResultData();
|
||||
march.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("3")){
|
||||
march.setValue(filteredCounts.get("3"));
|
||||
}else {
|
||||
march.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData april = new StatisticsResultData();
|
||||
april.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("4")){
|
||||
april.setValue(filteredCounts.get("4"));
|
||||
}else {
|
||||
april.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData may = new StatisticsResultData();
|
||||
may.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("5")){
|
||||
may.setValue(filteredCounts.get("5"));
|
||||
}else {
|
||||
may.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData june = new StatisticsResultData();
|
||||
june.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("6")){
|
||||
june.setValue(filteredCounts.get("6"));
|
||||
}else {
|
||||
june.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData july = new StatisticsResultData();
|
||||
july.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("7")){
|
||||
july.setValue(filteredCounts.get("7"));
|
||||
}else {
|
||||
july.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData august = new StatisticsResultData();
|
||||
august.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("8")){
|
||||
august.setValue(filteredCounts.get("8"));
|
||||
}else {
|
||||
august.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData september = new StatisticsResultData();
|
||||
september.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("9")){
|
||||
september.setValue(filteredCounts.get("9"));
|
||||
}else {
|
||||
september.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData october = new StatisticsResultData();
|
||||
october.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("10")){
|
||||
october.setValue(filteredCounts.get("10"));
|
||||
}else {
|
||||
october.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData november = new StatisticsResultData();
|
||||
november.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("11")){
|
||||
november.setValue(filteredCounts.get("11"));
|
||||
}else {
|
||||
november.setValue(0L);
|
||||
}
|
||||
|
||||
StatisticsResultData december = new StatisticsResultData();
|
||||
december.setName("analysis.january");
|
||||
if(filteredCounts.containsKey("12")){
|
||||
december.setValue(filteredCounts.get("12"));
|
||||
}else {
|
||||
december.setValue(0L);
|
||||
}
|
||||
|
||||
list.add(january);
|
||||
list.add(february);
|
||||
list.add(march);
|
||||
list.add(april);
|
||||
list.add(may);
|
||||
list.add(june);
|
||||
list.add(july);
|
||||
list.add(august);
|
||||
list.add(september);
|
||||
list.add(october);
|
||||
list.add(november);
|
||||
list.add(december);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue