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