申请、上架全局统计优化

This commit is contained in:
lizhicheng 2022-09-14 19:38:51 +08:00
parent 4e027e9f04
commit e539922487
4 changed files with 46 additions and 72 deletions

View File

@ -353,7 +353,7 @@ public class CensusController {
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectApplyDeptDetailTypeCountList(@RequestParam Map<String, Object> params) { public Result selectApplyDeptDetailTypeCountList(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params)); return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params));
@ -366,7 +366,7 @@ public class CensusController {
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectDeptDetailTypeCountList(@RequestParam Map<String, Object> params) { public Result selectDeptDetailTypeCountList(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectDeptDetailTypeCountList(params)); return new Result().ok(resourceService.selectDeptDetailTypeCountList(params));
@ -380,7 +380,7 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectCensusResourceTable(@RequestParam Map<String, Object> params){ public Result selectCensusResourceTable(@RequestParam Map<String, Object> params){
return new Result().ok(resourceService.selectCensusResourceTable(params)); return new Result().ok(resourceService.selectCensusResourceTable(params));
@ -394,7 +394,7 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectCensusApplyTable(@RequestParam Map<String, Object> params){ public Result selectCensusApplyTable(@RequestParam Map<String, Object> params){
return new Result().ok(resourceService.selectCensusApplyTable(params)); return new Result().ok(resourceService.selectCensusApplyTable(params));

View File

@ -188,16 +188,9 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map<String, Object>> selectApplyDeptDetailTypeCountList(Map params); List<Map<String, Object>> selectApplyDeptDetailTypeCountList(Map params);
List<Map<String, Object>> selectDeptDetailTypeCountList(@Param("delFlags") List<Integer> delFlags, List<Map<String, Object>> selectDeptDetailTypeCountList(Map params);
@Param("deptId") Long deptId,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
List<Map> selectCensusResourceTable(@Param("delFlags") List<Integer> delFlags, List<Map> selectCensusResourceTable(Map params);
@Param("deptId") Long deptId,
@Param("type") String type,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
List<Map> selectCensusApplyTable(Map params); List<Map> selectCensusApplyTable(Map params);
} }

View File

@ -2023,26 +2023,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectDeptDetailTypeCountList(Map params) { public Object selectDeptDetailTypeCountList(Map params) {
String startDate= (String) params.get("startDate"); List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
String endDate= (String) params.get("endDate");
Long deptId=null;
if(params.get("deptId") != null){
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())); Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>(); ArrayList<Map> resultList = new ArrayList<>();
typeCountListMap.forEach((k, v) -> { typeCountListMap.forEach((k, v) -> {
@ -2056,27 +2037,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectCensusResourceTable(Map params){ public Object selectCensusResourceTable(Map params){
String startDate= (String) params.get("startDate"); return resourceDao.selectCensusResourceTable(params);
String endDate= (String) params.get("endDate");
Long deptId=null;
if(params.get("deptId") != null){
deptId= Long.parseLong((String) params.get("deptId"));
}
String type= (String) params.get("type");
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);
}
return resourceDao.selectCensusResourceTable(delFlags, deptId, type, startDate, endDate);
} }
@Override @Override

View File

@ -1711,9 +1711,14 @@
AND taa.user_id = su.id AND taa.user_id = su.id
AND su.dept_id = sd.id AND su.dept_id = sd.id
AND taa.resource_id = tdr.id AND taa.resource_id = tdr.id
<if test="approveStatus != null and approveStatus != ''"> <choose>
<when test="approveStatus != null and approveStatus != ''">
AND taa.approve_status = #{approveStatus} AND taa.approve_status = #{approveStatus}
</if> </when>
<otherwise>
AND taa.approve_status != '不通过'
</otherwise>
</choose>
<if test="deptId != null and approveStatus != ''"> <if test="deptId != null and approveStatus != ''">
AND sd.id = #{deptId} AND sd.id = #{deptId}
</if> </if>
@ -1745,12 +1750,17 @@
WHERE WHERE
1 = 1 1 = 1
AND tdr.dept_id = sd.id AND tdr.dept_id = sd.id
<if test="null != delFlags"> <choose>
AND tdr.del_flag in <when test="approveStatus != null and approveStatus == '通过'">
<foreach item="delFlag" collection="delFlags" open="(" separator="," close=")"> AND tdr.del_flag = 0
#{delFlag} </when>
</foreach> <when test="approveStatus != null and approveStatus == '审核中'">
</if> AND tdr.del_flag in (2, 3)
</when>
<otherwise>
AND tdr.del_flag in (0, 2, 3)
</otherwise>
</choose>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND sd.id = #{deptId} AND sd.id = #{deptId}
</if> </if>
@ -1769,12 +1779,17 @@
WHERE d.type NOT IN ('知识库','基础设施','数据资源')) tdr, WHERE d.type NOT IN ('知识库','基础设施','数据资源')) tdr,
sys_dept sd sys_dept sd
WHERE 1=1 AND tdr.dept_id=sd.id WHERE 1=1 AND tdr.dept_id=sd.id
<if test="null != delFlags"> <choose>
AND tdr.del_flag in <when test="approveStatus != null and approveStatus == '通过'">
<foreach item="delFlag" collection="delFlags" open="(" separator="," close=")"> AND tdr.del_flag = 0
#{delFlag} </when>
</foreach> <when test="approveStatus != null and approveStatus == '审核中'">
</if> AND tdr.del_flag in (2, 3)
</when>
<otherwise>
AND tdr.del_flag in (0, 2, 3)
</otherwise>
</choose>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND sd.id = #{deptId} AND sd.id = #{deptId}
</if> </if>
@ -1800,9 +1815,14 @@
AND taa.user_id = su.id AND taa.user_id = su.id
AND su.dept_id = sd.id AND su.dept_id = sd.id
AND taa.resource_id = tdr.id AND taa.resource_id = tdr.id
<if test="approveStatus != null and approveStatus != ''"> <choose>
<when test="approveStatus != null and approveStatus != ''">
AND taa.approve_status = #{approveStatus} AND taa.approve_status = #{approveStatus}
</if> </when>
<otherwise>
AND taa.approve_status != '不通过'
</otherwise>
</choose>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND sd.id = #{deptId} AND sd.id = #{deptId}
</if> </if>