From ce40a055d3d13de83c5c2115980587c975c0bfa9 Mon Sep 17 00:00:00 2001 From: lc <15038716315@163.com> Date: Wed, 19 Jun 2024 11:09: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=A0=B9=E6=8D=AE=E4=BC=81=E4=B8=9A=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=BB=9F=E8=AE=A1=E4=BC=81=E4=B8=9A=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseInformationController.java | 50 ++++++++++--------- .../EnterpriseInformationService.java | 16 ++++-- .../EnterpriseInformationServiceImpl.java | 38 +++++++++----- 3 files changed, 65 insertions(+), 39 deletions(-) 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 744531a..3670b81 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 @@ -1,33 +1,32 @@ package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation; -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; -import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; - -import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationPageReqVO; +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.service.enterpriseinformation.EnterpriseInformationService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +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; @Tag(name = "管理后台 - 企业信息") @RestController @@ -101,5 +100,10 @@ public class EnterpriseInformationController { ExcelUtils.write(response, "企业信息.xls", "数据", EnterpriseInformationRespVO.class, BeanUtils.toBean(list, EnterpriseInformationRespVO.class)); } - + @GetMapping("/statisticByEnterpriseType") + @Operation(summary = "根据企业类型统计企业数据") + public CommonResult> statisticByEnterpriseType(){ + Map integerLongMap = enterpriseInformationService.statisticByEnterpriseType(); + return success(integerLongMap); + } } 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 0b7db64..235d2e6 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 @@ -1,9 +1,13 @@ package cn.iocoder.yudao.module.fta.service.enterpriseinformation; -import javax.validation.*; -import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; -import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationPageReqVO; +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 javax.validation.Valid; +import java.util.Map; /** * 企业信息 Service 接口 @@ -72,4 +76,10 @@ public interface EnterpriseInformationService { * @return */ EnterpriseInformationRespVO selectCredentialManagement(EnterpriseInformationRespVO respVO); + + /** + * 根据企业类型统计企业数据 + * @return + */ + Map statisticByEnterpriseType(); } 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 58d229d..53447ea 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 @@ -2,32 +2,32 @@ package cn.iocoder.yudao.module.fta.service.enterpriseinformation; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.LocalDateTimeUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationPageReqVO; +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.CredentialManagementDO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; 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; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.springframework.stereotype.Service; -import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; -import java.time.ZoneId; -import java.util.*; -import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; -import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; - -import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.EnterpriseInformationMapper; +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; -import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_LEAVE_NOT_EXISTS; -import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.ENTERPRISE_INFORMATION_NOT_EXISTS; /** * 企业信息 Service 实现类 @@ -229,6 +229,18 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe return respVO; } + /** + * 根据企业类型统计企业数据 + * + * @return + */ + @Override + public Map statisticByEnterpriseType() { + List enterpriseInformationDOS = enterpriseInformationMapper.selectList(); + Map enterpriseTypeCounts = enterpriseInformationDOS.stream().collect(Collectors.groupingBy(EnterpriseInformationDO::getEnterpriseType, Collectors.counting())); + return enterpriseTypeCounts; + } + private void validateLeaveExists(Long id) { if (enterpriseInformationMapper.selectById(id) == null) { throw exception(ENTERPRISE_INFORMATION_NOT_EXISTS);