* 'dev' of http://221.0.232.152:9393/ability-center/share-platform:
  新增上架统计api
  新增统计api
This commit is contained in:
huangweixiong 2022-09-14 17:05:58 +08:00
commit 7cbdb1c555
5 changed files with 170 additions and 0 deletions

View File

@ -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<String, Object> 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<String, Object> params) {
return new Result().ok(resourceService.selectDeptDetailTypeCountList(params));
}
}

View File

@ -185,4 +185,11 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map> getImgServices(@Param("deptid") Long deptid,@Param("type") String type);
List<Map> cimAssemblyResources(@Param("deptid") Long deptid);
List<Map<String, Object>> selectApplyDeptDetailTypeCountList(Map params);
List<Map<String, Object>> selectDeptDetailTypeCountList(@Param("delFlags") List<Integer> delFlags,
@Param("deptId") Long deptId,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
}

View File

@ -138,4 +138,8 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectAppList(Map params);
Object getCountByFuzzyQuery(String keyWorld);
Object selectApplyDeptDetailTypeCountList(Map params);
Object selectDeptDetailTypeCountList(Map params);
}

View File

@ -2007,4 +2007,48 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resultList;
}
@Override
public Object selectApplyDeptDetailTypeCountList(Map params) {
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> 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<Integer> 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<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(delFlags, deptId, startDate, endDate);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("name", k);
v.forEach(item -> map.put(item.get("type").toString(), item.get("count")));
resultList.add(map);
});
return resultList;
}
}

View File

@ -1674,4 +1674,91 @@
AND (b.attr_type = '组件类型' AND MATCH (b.attr_value) AGAINST ( '智能算法' IN BOOLEAN MODE))
AND b.del_flag = 0
</select>
<select id="selectApplyDeptDetailTypeCountList" resultType="java.util.Map">
SELECT
COUNT( taa.resource_id ) AS "count",
sd.NAME AS "deptName",
(
CASE
tdr.type
WHEN '应用资源' THEN
'yyzy'
WHEN '智能算法' THEN
'znsf'
WHEN '图层服务' THEN
'tcfw'
WHEN '开发组件' THEN
'kfzj'
WHEN '业务组件' THEN
'ywzj'
WHEN '基础设施' THEN
'jcss'
WHEN '知识库' THEN
'zsk'
WHEN '数据资源' THEN
'sjzy' ELSE 'yyzy'
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='组件类型' AND a.del_flag=0) tdr,
sys_dept sd,
sys_user su,
t_ability_application taa
WHERE
1 = 1
AND tdr.del_flag = 0
AND taa.user_id = su.id
AND su.dept_id = sd.id
AND taa.resource_id = tdr.id
<if test="approveStatus != null and approveStatus != ''">
AND taa.approve_status = #{approveStatus}
</if>
<if test="deptId != null and approveStatus != ''">
AND sd.id = #{deptId}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if>
GROUP BY
sd.id,
tdr.type
</select>
<select id="selectDeptDetailTypeCountList" resultType="java.util.Map">
SELECT
COUNT( tdr.id ) AS "count",
sd.NAME AS "deptName",
(CASE tdr.type
WHEN '应用资源' THEN 'yyzy'
WHEN '智能算法' THEN 'znsf'
WHEN '图层服务' THEN 'tcfw'
WHEN '开发组件' THEN 'kfzj'
WHEN '业务组件' THEN 'ywzj'
WHEN '基础设施' THEN 'jcss'
WHEN '知识库' THEN 'zsk'
WHEN '数据资源' THEN 'sjzy'
ELSE 'yyzy' END)AS "type"
FROM
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date 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
WHERE
1 = 1
AND tdr.dept_id = sd.id
<if test="null != delFlags">
AND tdr.del_flag in
<foreach item="delFlag" collection="delFlags" open="(" separator="," close=")">
#{delFlag}
</foreach>
</if>
<if test="deptId != null and deptId != ''">
AND sd.id = #{deptId}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(tdr.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if>
GROUP BY
tdr.dept_id,
tdr.type
</select>
</mapper>