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);