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..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 @@ -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,30 @@ 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)); + } + + @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 8295ddcc..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 @@ -185,4 +185,11 @@ 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); + + 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 aaaae736..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 @@ -138,4 +138,8 @@ 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; + } + + @Override + public Object selectDeptDetailTypeCountList(Map params) { + String startDate= (String) params.get("startDate"); + String endDate= (String) params.get("endDate"); + Long deptId= Long.parseLong((String) params.get("deptId")); + List 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 d9fcaf98..fdb83a31 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1674,4 +1674,91 @@ AND (b.attr_type = '组件类型' AND MATCH (b.attr_value) AGAINST ( '智能算法' IN BOOLEAN MODE)) AND b.del_flag = 0 + + + + \ No newline at end of file