Browse Source

Merge branch 'develop' into 'master'

Develop

See merge request dcuc-tjdsj/app-service!85
马志强 2 years ago
parent
commit
10f8ae6f33

+ 12 - 0
dcuc-app-api/src/main/java/com/dragoninfo/dcuc/app/facade/IApplyInfoFacade.java

@@ -8,6 +8,7 @@ import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -314,4 +315,15 @@ public interface IApplyInfoFacade {
     @PutMapping("updateOrgInfos")
     ResponseStatus updateOrgInfos(@RequestParam("targetOrgCode") String targetOrgCode, @RequestParam("fullName") String fullName,
                                   @RequestParam("code") String code);
+
+    /**
+     * 应用数量统计
+     *
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @GetMapping("count")
+    Long count(@RequestParam(value = "startTime", required = false) Date startTime,
+               @RequestParam(value = "endTime", required = false) Date endTime);
 }

+ 19 - 0
dcuc-app-api/src/main/java/com/dragoninfo/dcuc/app/facade/IResourceFacade.java

@@ -2,6 +2,7 @@ package com.dragoninfo.dcuc.app.facade;
 
 
 import com.dragoninfo.dcuc.app.dto.*;
+import com.dragoninfo.dcuc.app.dto.statistics.ResourceStatisticsDto;
 import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.entity.ServiceResource;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
@@ -11,7 +12,9 @@ import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -77,6 +80,7 @@ public interface IResourceFacade {
 
     /**
      * 资源同步表同步到应用表、服务表
+     *
      * @return
      */
     @PostMapping(value = "resourceSync")
@@ -90,8 +94,10 @@ public interface IResourceFacade {
      */
     @PostMapping(value = "serviceResourcePage")
     Page<ServiceResourceDTO> serviceResourcePage(@RequestBody SearchDTO searchDTO);
+
     /**
      * 从总线获取应用、服务、菜单资源
+     *
      * @param requestParam
      * @return
      */
@@ -100,6 +106,7 @@ public interface IResourceFacade {
 
     /**
      * 主客体授权-服务数据同步
+     *
      * @return
      */
     @GetMapping(value = "subSerSync")
@@ -107,8 +114,20 @@ public interface IResourceFacade {
 
     /**
      * 主客体授权-应用和功能数据同步
+     *
      * @return
      */
     @GetMapping(value = "subAppSync")
     ResponseStatus subAppSync();
+
+    /**
+     * 资源数量统计
+     *
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @GetMapping("count")
+    ResourceStatisticsDto count(@RequestParam(value = "startTime", required = false) Date startTime,
+                                @RequestParam(value = "endTime", required = false) Date endTime);
 }

+ 27 - 0
dcuc-app-model/src/main/java/com/dragoninfo/dcuc/app/dto/statistics/ResourceStatisticsDto.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.app.dto.statistics;
+
+import lombok.Data;
+
+/**
+ * 资源统计dto
+ * @author mazq
+ * @date 2023/6/8
+ */
+@Data
+public class ResourceStatisticsDto {
+
+    /**
+     * 应用资源数量
+     */
+    private Long appNum = 0L;
+
+    /**
+     * 服务资源数量
+     */
+    private Long serviceNum = 0L;
+
+    /**
+     * 数据资源数量
+     */
+    private Long dataNum = 0L;
+}

+ 9 - 2
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/business/IResourceBusiness.java

@@ -2,8 +2,10 @@ package com.dragoninfo.dcuc.app.business;
 
 import com.dragoninfo.dcuc.app.dto.ResourceRequestParamDTO;
 import com.dragoninfo.dcuc.app.dto.ResourceRequestResultDTO;
+import com.dragoninfo.dcuc.app.dto.statistics.ResourceStatisticsDto;
 
 import java.lang.reflect.Type;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -98,6 +100,11 @@ public interface IResourceBusiness {
      */
     boolean cancelService(String serviceCode);
 
-
-
+    /**
+     * 资源数量统计
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    ResourceStatisticsDto count(Date startTime, Date endTime);
 }

+ 16 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/business/impl/ResourceBusiness.java

@@ -11,6 +11,7 @@ import com.dragoninfo.dcuc.app.config.DcucResourceConfig;
 import com.dragoninfo.dcuc.app.cons.ServiceStatusCons;
 import com.dragoninfo.dcuc.app.dto.*;
 import com.dragoninfo.dcuc.app.dto.dataresource.BaseResp;
+import com.dragoninfo.dcuc.app.dto.statistics.ResourceStatisticsDto;
 import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.entity.ResourceSync;
 import com.dragoninfo.dcuc.app.entity.ServiceResource;
@@ -20,6 +21,7 @@ import com.dragoninfo.dcuc.app.service.IResourceService;
 import com.dragoninfo.dcuc.app.service.IResourceSyncService;
 import com.dragoninfo.dcuc.app.service.IServiceResourceService;
 import com.dragoninfo.dcuc.app.service.impl.ResourceServiceImpl;
+import com.dragoninfo.dcuc.app.service.sub.IAppDataItemInfoService;
 import com.dragoninfo.dcuc.app.vo.BusSendReqVO;
 import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
 import com.dragoninfo.dcuc.common.Constants;
@@ -76,6 +78,8 @@ public class ResourceBusiness implements IResourceBusiness {
     private IServiceResourceService serviceResourceService;
     @Autowired
     private IBimBusinessFacade bimBusinessFacade;
+    @Autowired
+    private IAppDataItemInfoService appDataItemInfoService;
     /**
      * 使用线程池异步获取应用菜单
      */
@@ -239,6 +243,18 @@ public class ResourceBusiness implements IResourceBusiness {
         return true;
     }
 
+    @Override
+    public ResourceStatisticsDto count(Date startTime, Date endTime) {
+        ResourceStatisticsDto dto = new ResourceStatisticsDto();
+        Long appCount = applyInfoService.count(startTime, endTime);
+        Long serviceCount = serviceResourceService.count(startTime, endTime);
+        Long dataCount = appDataItemInfoService.count(startTime, endTime);
+        dto.setAppNum(appCount);
+        dto.setServiceNum(serviceCount);
+        dto.setDataNum(dataCount);
+        return dto;
+    }
+
 
     private String getServiceRemoteDetailByCode(String serviceCode) {
 

+ 6 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/facade/ApplyInfoFacade.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -81,6 +82,11 @@ public class ApplyInfoFacade implements IApplyInfoFacade {
         return ResponseStatus.success();
     }
 
+    @Override
+    public Long count(Date startTime, Date endTime) {
+        return applyInfoService.count(startTime, endTime);
+    }
+
     @Override
     public String getNewSort() {
         return applyInfoService.getNewSort();

+ 7 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/facade/ResourceFacade.java

@@ -2,6 +2,7 @@ package com.dragoninfo.dcuc.app.facade;
 
 import com.dragoninfo.dcuc.app.business.IResourceBusiness;
 import com.dragoninfo.dcuc.app.dto.*;
+import com.dragoninfo.dcuc.app.dto.statistics.ResourceStatisticsDto;
 import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.entity.ResourceSync;
 import com.dragoninfo.dcuc.app.entity.ServiceResource;
@@ -21,6 +22,7 @@ import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 
@@ -107,6 +109,11 @@ public class ResourceFacade implements IResourceFacade {
         return ResponseStatus.success();
     }
 
+    @Override
+    public ResourceStatisticsDto count(Date startTime, Date endTime) {
+        return iResourceBusiness.count(startTime, endTime);
+    }
+
     @Override
     public ResponseStatus subSerSync() {
         List<String> list = new ArrayList<>();

+ 9 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/IApplyInfoService.java

@@ -6,6 +6,7 @@ import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import org.springframework.data.domain.Page;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -261,4 +262,12 @@ public interface IApplyInfoService {
      * @param code          机构代码
      */
     void updateOrgInfos(String targetOrgCode, String fullName, String code);
+
+    /**
+     * 统计应用数量
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    Long count(Date startTime, Date endTime);
 }

+ 9 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/IServiceResourceService.java

@@ -8,6 +8,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.service.IBaseService;
 import org.springframework.data.domain.Page;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -75,4 +76,12 @@ public interface IServiceResourceService extends IBaseService<ServiceResource, S
      * @param id
      */
     ResponseStatus deleteServiceResourceById(String id);
+
+    /**
+     * 服务资源数量统计
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    Long count(Date startTime, Date endTime);
 }

+ 14 - 1
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/impl/ApplyInfoServiceImpl.java

@@ -287,7 +287,7 @@ public class ApplyInfoServiceImpl implements IApplyInfoService {
     @Override
     public ApplyInfo getAppByAppUrl(String applyUrl) {
         LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(ApplyInfo::getApplyUrl, applyUrl);
+        queryWrapper.like(ApplyInfo::getApplyUrl, applyUrl);
         List<ApplyInfo> applyInfos = applyInfoMapper.selectList(queryWrapper);
         if (CollectionUtils.isNotEmpty(applyInfos)) {
             return applyInfos.get(0);
@@ -470,6 +470,19 @@ public class ApplyInfoServiceImpl implements IApplyInfoService {
         applyInfoMapper.update(applyInfo, queryWrapper);
     }
 
+    @Override
+    public Long count(Date startTime, Date endTime) {
+        LambdaQueryWrapper<ApplyInfo> query = Wrappers.lambdaQuery();
+        if (null != startTime) {
+            query.ge(ApplyInfo::getRegistrationTime, startTime);
+        }
+        if (null != endTime) {
+            query.le(ApplyInfo::getRegistrationTime, endTime);
+        }
+
+        return Long.valueOf(applyInfoMapper.selectCount(query));
+    }
+
     @Override
     public List<ApplyInfo> findList(String applyStatus) {
         LambdaQueryWrapper<ApplyInfo> queryWrapper = new LambdaQueryWrapper<>();

+ 13 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/impl/ServiceResourceServiceImpl.java

@@ -260,6 +260,19 @@ public class ServiceResourceServiceImpl extends BaseMybatisService<ServiceResour
         return new ResponseStatus();
     }
 
+    @Override
+    public Long count(Date startTime, Date endTime) {
+        LambdaQueryWrapper<ServiceResource> query = Wrappers.lambdaQuery();
+        if (null != startTime) {
+            query.ge(ServiceResource::getCreateTime, startTime);
+        }
+        if (null != endTime) {
+            query.le(ServiceResource::getCreateTime, endTime);
+        }
+
+        return Long.valueOf(serviceResourceMapper.selectCount(query));
+    }
+
     /**
      * 构建服务资源数组
      * @param inputStream

+ 8 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/sub/IAppDataItemInfoService.java

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -71,4 +72,11 @@ public interface IAppDataItemInfoService {
      */
     List<AppDataItemInfo> selectByTableId(String tableId);
 
+    /**
+     * 数量统计
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    Long count(Date startTime, Date endTime);
 }

+ 15 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/sub/impl/AppDataItemInfoServiceImpl.java

@@ -2,6 +2,7 @@ package com.dragoninfo.dcuc.app.service.sub.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.dragoninfo.dcuc.app.entity.ServiceResource;
 import com.dragoninfo.dcuc.app.entity.sub.AppDataItemInfo;
 import com.dragoninfo.dcuc.app.mapper.sub.AppDataItemInfoMapper;
 import com.dragoninfo.dcuc.app.service.sub.IAppDataItemInfoService;
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -70,6 +72,19 @@ public class AppDataItemInfoServiceImpl implements IAppDataItemInfoService {
         return appDataItemInfoMapper.selectList(lambdaQueryWrapper);
     }
 
+    @Override
+    public Long count(Date startTime, Date endTime) {
+        LambdaQueryWrapper<AppDataItemInfo> query = Wrappers.lambdaQuery();
+        if (null != startTime) {
+            query.ge(AppDataItemInfo::getCreateTime, startTime);
+        }
+        if (null != endTime) {
+            query.le(AppDataItemInfo::getCreateTime, endTime);
+        }
+
+        return Long.valueOf(appDataItemInfoMapper.selectCount(query));
+    }
+
     @Override
     public List<AppDataItemInfo> getHasClassifyColInfos() {
         LambdaQueryWrapper<AppDataItemInfo> query = Wrappers.lambdaQuery();