新增功能:基础设施部门最大申请限制
This commit is contained in:
parent
ea141edbfa
commit
7163b83c2a
File diff suppressed because one or more lines are too long
|
@ -86,6 +86,8 @@ public class TAbilityApplicationController {
|
|||
private TaskService taskService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Value("${infrastructure.dept-can-apply-max}")
|
||||
private Integer infrastructureMax;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -410,4 +412,17 @@ public class TAbilityApplicationController {
|
|||
ExcelUtils.exportExcelToTarget(response, null, "能力申请表单", list, TAbilityApplicationExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("canApply/{number}")
|
||||
@ApiOperation("判断资源是否可以申请")
|
||||
@LogOperation("判断资源是否可以申请,当前限制为:一个部门最多申请10个基础设施")
|
||||
public Result canApply(@PathVariable("number") Integer number){
|
||||
Integer count=tAbilityApplicationService.getDeptInfrastructureApply(SecurityUser.getDeptId());
|
||||
if(count>=infrastructureMax){
|
||||
return new Result().error("当前部门申请基础设施数量已达上限!");
|
||||
}else if (count+number>infrastructureMax){
|
||||
return new Result().error("部门已申请基础设施数量"+count+",当前最多可申请"+(infrastructureMax-count)+"个!");
|
||||
}
|
||||
return new Result();
|
||||
}
|
||||
|
||||
}
|
|
@ -43,4 +43,6 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
|
|||
* @return
|
||||
*/
|
||||
Long countUserResourceApply(Long userId, Long resourceId);
|
||||
|
||||
Integer getDeptInfrastructureApply(Long deptId);
|
||||
}
|
|
@ -43,4 +43,11 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
|
|||
* @return
|
||||
*/
|
||||
Long countUserResourceApply(Long userId, Long resourceId);
|
||||
|
||||
/**
|
||||
* 查询部门申请的基础设施个数(审核中、通过)
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
Integer getDeptInfrastructureApply(Long deptId);
|
||||
}
|
|
@ -126,5 +126,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
|
|||
return baseDao.countUserResourceApply(userId, resourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDeptInfrastructureApply(Long deptId) {
|
||||
return baseDao.getDeptInfrastructureApply(deptId);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -145,3 +145,7 @@ cas:
|
|||
front:
|
||||
url: http://10.16.16.159:4444
|
||||
|
||||
# 基础设施,部门最大申请数量
|
||||
infrastructure:
|
||||
dept-can-apply-max: 10
|
||||
|
||||
|
|
|
@ -281,4 +281,16 @@
|
|||
AND t_ability_application.resource_id = #{resourceId}
|
||||
AND tb_data_resource.type != '基础设施'
|
||||
</select>
|
||||
|
||||
<select id="getDeptInfrastructureApply" resultType="java.lang.Integer">
|
||||
SELECT count(*) FROM t_ability_application taa
|
||||
LEFT JOIN sys_user su ON taa.creator = su.id
|
||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.id
|
||||
WHERE 1=1
|
||||
AND taa.camera_list IS NOT NULL
|
||||
AND taa.del_flag = 0
|
||||
AND (taa.approve_status = '审核中' OR taa.approve_status = '通过')
|
||||
AND taa.expire_date > now()
|
||||
AND sd.id = #{deptId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue