From f04cd81469477b43b55962c444f0966a282d1e30 Mon Sep 17 00:00:00 2001 From: lc <15038716315@163.com> Date: Thu, 20 Jun 2024 17:44:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E4=BF=A1=E6=81=AF=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=20=E6=9F=A5=E8=AF=A2=E4=BC=81=E4=B8=9A=E6=9C=88?= =?UTF-8?q?=E5=BA=A6=E6=B3=A8=E5=86=8C=E6=95=B0=E8=BF=94=E5=9B=9E=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseInformationController.java | 9 +- .../StatisticsResultData.java | 9 ++ .../EnterpriseInformationService.java | 4 +- .../EnterpriseInformationServiceImpl.java | 126 +++++++++++++++++- 4 files changed, 142 insertions(+), 6 deletions(-) create mode 100644 yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/StatisticsResultData.java diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java index f331d93..2bfe45c 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java @@ -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> selectEnterpriseByMonth(){ - Map stringLongMap = enterpriseInformationService.selectEnterpriseByMonth(); - return success(stringLongMap); + public CommonResult> selectEnterpriseByMonth(){ + //Map stringLongMap = enterpriseInformationService.selectEnterpriseByMonth(); + //return success(stringLongMap); + List statisticsResultData = enterpriseInformationService.selectEnterpriseByMonth(); + return success(statisticsResultData); } @GetMapping("/statisticByStatus") diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/StatisticsResultData.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/StatisticsResultData.java new file mode 100644 index 0000000..a86d69d --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/StatisticsResultData.java @@ -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; +} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java index 56fe038..86a6fca 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java @@ -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 selectEnterpriseByMonth(); + List selectEnterpriseByMonth(); /** * 根据审核状态统计企业数据 diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java index fa56bc0..789570c 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java @@ -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 selectEnterpriseByMonth() { + public List selectEnterpriseByMonth() { List enterpriseInformationDOS = enterpriseInformationMapper.selectList(); // 按月度分组并计算企业数量 Map 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 filteredCounts = monthlyCounts.entrySet().stream() + .filter(entry -> entry.getKey().contains(year+"")) + .collect(Collectors.toMap( + entry -> entry.getKey().substring(5), + Map.Entry::getValue + )); + List 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; } /**