Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-09-13 18:03:42 +08:00
commit cccb0b4a59
6 changed files with 86 additions and 1 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,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<String, Object> params) {
return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params));
}
}

View File

@ -185,4 +185,6 @@ 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);
}

View File

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

View File

@ -2007,4 +2007,18 @@ 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;
}
}

View File

@ -25,6 +25,7 @@ import io.renren.modules.sys.enums.JhDeptEnum;
import io.renren.modules.sys.enums.JhDeptsEnum;
import io.renren.modules.sys.enums.SuperAdminEnum;
import io.renren.modules.sys.service.*;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -41,6 +42,7 @@ import java.util.concurrent.atomic.AtomicLong;
* 系统用户
*/
@Service
@Log4j2
public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntity> implements SysUserService {
@Autowired
private SysRoleUserService sysRoleUserService;
@ -435,7 +437,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
});
return new Result().ok("保存成功");
} catch (Exception e) {
e.printStackTrace();
log.error("人员同步失败", e);
return new Result().error("保存失败");
}
}

View File

@ -1674,4 +1674,54 @@
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='组件类型') 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>
</mapper>