From c3541440c55ebe2afe0380785c5b6eff8f4b4158 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Tue, 13 Sep 2022 17:42:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=9F=E8=AE=A1api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按照部门、能力类型、组件类型统计能力使用情况 --- .../common/controller/CensusController.java | 15 ++++++ .../modules/resource/dao/ResourceDao.java | 2 + .../resource/service/ResourceService.java | 2 + .../service/impl/ResourceServiceImpl.java | 14 ++++++ .../resources/mapper/resource/ResourceDao.xml | 50 +++++++++++++++++++ 5 files changed, 83 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index a6f61edf..e216b3f6 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -13,6 +13,8 @@ import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -344,4 +346,17 @@ public class CensusController { return new Result().ok(resourceService.selectResourceListByType(type)); } + @GetMapping("/selectApplyDeptDetailTypeCountList") + @ApiOperation("按照部门、能力类型、组件类型统计能力使用情况") + @LogOperation("按照部门、能力类型、组件类型统计能力使用情况") + @ApiImplicitParams({ + @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), + @ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"), + }) + public Result selectApplyDeptDetailTypeCountList(@RequestParam Map params) { + return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params)); + } + } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index 8295ddcc..fc01ed6d 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -185,4 +185,6 @@ public interface ResourceDao extends BaseDao { List getImgServices(@Param("deptid") Long deptid,@Param("type") String type); List cimAssemblyResources(@Param("deptid") Long deptid); + + List> selectApplyDeptDetailTypeCountList(Map params); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java index aaaae736..645b1fe4 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java @@ -138,4 +138,6 @@ public interface ResourceService extends CrudService> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); + Map>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); + ArrayList resultList = new ArrayList<>(); + typeCountListMap.forEach((k, v) -> { + HashMap map = new HashMap<>(); + map.put("name", k); + v.forEach(item -> map.put(item.get("type").toString(), item.get("count"))); + resultList.add(map); + }); + return resultList; + } + } \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index d9fcaf98..811ebf36 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1674,4 +1674,54 @@ AND (b.attr_type = '组件类型' AND MATCH (b.attr_value) AGAINST ( '智能算法' IN BOOLEAN MODE)) AND b.del_flag = 0 + + \ No newline at end of file From 3f0f344d5bf78074b76af6f43a8d6839563c46d6 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Wed, 14 Sep 2022 14:19:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E6=9E=B6?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按照部门、能力类型、组件类型统计能力上架情况 --- .../common/controller/CensusController.java | 13 +++++++ .../modules/resource/dao/ResourceDao.java | 5 +++ .../resource/service/ResourceService.java | 2 + .../service/impl/ResourceServiceImpl.java | 30 ++++++++++++++ .../resources/mapper/resource/ResourceDao.xml | 39 ++++++++++++++++++- 5 files changed, 88 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index e216b3f6..606c6aa7 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -359,4 +359,17 @@ public class CensusController { return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params)); } + @GetMapping("/selectDeptDetailTypeCountList") + @ApiOperation("按照部门、能力类型、组件类型统计能力上架情况") + @LogOperation("按照部门、能力类型、组件类型统计能力上架情况") + @ApiImplicitParams({ + @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), + @ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"), + }) + public Result selectDeptDetailTypeCountList(@RequestParam Map params) { + return new Result().ok(resourceService.selectDeptDetailTypeCountList(params)); + } + } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index fc01ed6d..d32053eb 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -187,4 +187,9 @@ public interface ResourceDao extends BaseDao { List cimAssemblyResources(@Param("deptid") Long deptid); List> selectApplyDeptDetailTypeCountList(Map params); + + List> selectDeptDetailTypeCountList(@Param("delFlags") List delFlags, + @Param("deptId") Long deptId, + @Param("startDate") String startDate, + @Param("endDate") String endDate); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java index 645b1fe4..3c0510d3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java @@ -140,4 +140,6 @@ public interface ResourceService extends CrudService delFlags=new ArrayList<>(); + if(params.get("approveStatus") != null){ + if("审核完成".equals(params.get("approveStatus"))){ + delFlags.add(0); + }else if("审核中".equals(params.get("approveStatus"))){ + delFlags.add(2); + delFlags.add(3); + } + }else { + delFlags.add(0); + delFlags.add(2); + delFlags.add(3); + } + List> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(delFlags, deptId, startDate, endDate); + Map>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); + ArrayList resultList = new ArrayList<>(); + typeCountListMap.forEach((k, v) -> { + HashMap map = new HashMap<>(); + map.put("name", k); + v.forEach(item -> map.put(item.get("type").toString(), item.get("count"))); + resultList.add(map); + }); + return resultList; + } + } \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 811ebf36..fdb83a31 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1701,7 +1701,7 @@ END ) AS "type" FROM - (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型') tdr, + (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr, sys_dept sd, sys_user su, t_ability_application taa @@ -1724,4 +1724,41 @@ sd.id, tdr.type + + \ No newline at end of file