提交代码

dev_xds
姜玉琦 2023-10-15 15:43:27 +08:00
parent c1159de712
commit a384c08c10
2 changed files with 57 additions and 8 deletions

View File

@ -5,6 +5,8 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.SysRoleEnum;
import com.ruoyi.system.service.ISysDeptService;
import com.yanzhu.jh.video.domain.DevAiProjectData; import com.yanzhu.jh.video.domain.DevAiProjectData;
import com.yanzhu.jh.video.domain.SurProjectVideoConfig; import com.yanzhu.jh.video.domain.SurProjectVideoConfig;
import com.yanzhu.jh.video.service.IDevAiProjectDataService; import com.yanzhu.jh.video.service.IDevAiProjectDataService;
@ -30,6 +32,9 @@ public class VideoAiBoxController extends BaseController {
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private ISysDeptService sysDeptService;
@Autowired @Autowired
private IDevAiProjectDataService devAiProjectDataService; private IDevAiProjectDataService devAiProjectDataService;
@ -42,12 +47,19 @@ public class VideoAiBoxController extends BaseController {
@GetMapping("/listView") @GetMapping("/listView")
public AjaxResult listView(String deptId, String projectId) public AjaxResult listView(String deptId, String projectId)
{ {
String key="bgscreen_aiBoxVideo_listView_"+deptId+"_"+projectId; DevAiProjectData devAiProjectData = new DevAiProjectData();
devAiProjectData.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(devAiProjectData.getNowRole())){
devAiProjectData.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
devAiProjectData.setNowDept(Convert.toStr(getDeptId()));
}
devAiProjectData.setNowUser(Convert.toStr(getUserId()));
String key="bgscreen_aiBoxVideo_listView_"+deptId+"_"+projectId+"_"+devAiProjectData.getNowRole()+"_"+devAiProjectData.getNowDept()+"_"+devAiProjectData.getNowUser();
Object obj=redisCache.getCacheObject(key); Object obj=redisCache.getCacheObject(key);
if(obj!=null){ if(obj!=null){
return success(obj); return success(obj);
} }
DevAiProjectData devAiProjectData = new DevAiProjectData();
if(deptId!=null && !"0".equals(deptId)){ if(deptId!=null && !"0".equals(deptId)){
devAiProjectData.setProjectDeptId(deptId); devAiProjectData.setProjectDeptId(deptId);
} }
@ -69,12 +81,20 @@ public class VideoAiBoxController extends BaseController {
@GetMapping(value = "/getVideoPassage") @GetMapping(value = "/getVideoPassage")
public AjaxResult getVideoPassage(String deptId, String projectId, String passageType, String importance) public AjaxResult getVideoPassage(String deptId, String projectId, String passageType, String importance)
{ {
String key="bgscreen_aiBoxVideo_getVideoPassage_"+deptId+"_"+projectId+"_"+passageType+"_"+importance; Map<String, Object> map = new HashMap<>();
String nowRole = Convert.toStr(getUserFirstRole());
map.put("nowRole",nowRole);
if(SysRoleEnum.ZGS.getCode().equals(nowRole)){
map.put("nowDept",Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
map.put("nowDept",Convert.toStr(getDeptId()));
}
map.put("nowUser",Convert.toStr(getUserId()));
String key="bgscreen_aiBoxVideo_getVideoPassage_"+deptId+"_"+projectId+"_"+passageType+"_"+importance+"_"+map.get("nowRole")+"_"+map.get("nowDept")+"_"+map.get("nowUser");
Object obj=redisCache.getCacheObject(key); Object obj=redisCache.getCacheObject(key);
if(obj!=null){ if(obj!=null){
return success(obj); return success(obj);
} }
Map<String, Object> map = new HashMap<>();
if(deptId!=null && !"0".equals(deptId)){ if(deptId!=null && !"0".equals(deptId)){
map.put("deptId",deptId); map.put("deptId",deptId);
} }
@ -98,12 +118,19 @@ public class VideoAiBoxController extends BaseController {
@GetMapping("/groupCountByAlarmType") @GetMapping("/groupCountByAlarmType")
public AjaxResult groupCountByAlarmType(String deptId,String projectId,String now) public AjaxResult groupCountByAlarmType(String deptId,String projectId,String now)
{ {
String key="bgscreen_aiBoxVideo_groupCountByAlarmType_"+deptId+"_"+projectId+"_"+now; DevAiProjectData devAiProjectData = new DevAiProjectData();
devAiProjectData.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(devAiProjectData.getNowRole())){
devAiProjectData.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
devAiProjectData.setNowDept(Convert.toStr(getDeptId()));
}
devAiProjectData.setNowUser(Convert.toStr(getUserId()));
String key="bgscreen_aiBoxVideo_groupCountByAlarmType_"+deptId+"_"+projectId+"_"+now+"_"+devAiProjectData.getNowRole()+"_"+devAiProjectData.getNowDept()+"_"+devAiProjectData.getNowUser();
Object obj=redisCache.getCacheObject(key); Object obj=redisCache.getCacheObject(key);
if(obj!=null){ if(obj!=null){
return success(obj); return success(obj);
} }
DevAiProjectData devAiProjectData = new DevAiProjectData();
if(deptId!=null && !"0".equals(deptId)){ if(deptId!=null && !"0".equals(deptId)){
devAiProjectData.setProjectDeptId(deptId); devAiProjectData.setProjectDeptId(deptId);
} }
@ -127,12 +154,20 @@ public class VideoAiBoxController extends BaseController {
@GetMapping("/selectGroupCountVideoConfig") @GetMapping("/selectGroupCountVideoConfig")
public AjaxResult selectGroupCountVideoConfig(String deptId,String projectId) public AjaxResult selectGroupCountVideoConfig(String deptId,String projectId)
{ {
String key="bgscreen_aiBoxVideo_selectGroupCountVideoConfig_"+deptId+"_"+projectId; Map<String, Object> map = new HashMap<>();
String nowRole = Convert.toStr(getUserFirstRole());
map.put("nowRole",nowRole);
if(SysRoleEnum.ZGS.getCode().equals(nowRole)){
map.put("nowDept",Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
map.put("nowDept",Convert.toStr(getDeptId()));
}
map.put("nowUser",Convert.toStr(getUserId()));
String key="bgscreen_aiBoxVideo_selectGroupCountVideoConfig_"+deptId+"_"+projectId+"_"+map.get("nowRole")+"_"+map.get("nowDept")+"_"+map.get("nowUser");
Object obj=redisCache.getCacheObject(key); Object obj=redisCache.getCacheObject(key);
if(obj!=null){ if(obj!=null){
return success(obj); return success(obj);
} }
Map<String, Object> map = new HashMap<>();
if(deptId!=null && !"0".equals(deptId)){ if(deptId!=null && !"0".equals(deptId)){
map.put("deptId",deptId); map.put("deptId",deptId);
} }

View File

@ -106,6 +106,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null "> and p.dept_id = #{deptId}</if> <if test="deptId != null "> and p.dept_id = #{deptId}</if>
<if test='importance == "Y" '> and dacp.is_importance = #{importance}</if> <if test='importance == "Y" '> and dacp.is_importance = #{importance}</if>
<if test="passageType != null "> and FIND_IN_SET(#{passageType},dacp.passage_type) > 0</if> <if test="passageType != null "> and FIND_IN_SET(#{passageType},dacp.passage_type) > 0</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and p.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and p.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and p.id in (select DISTINCT spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept})</if>
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and p.id in (select DISTINCT spu.project_id from sur_project_userinfo spu where spu.user_id = #{nowUser} and spu.is_del=0)</if>
order by a.project_id asc,b.id asc order by a.project_id asc,b.id asc
<if test='importance != "Y" '> limit 6</if> <if test='importance != "Y" '> limit 6</if>
</select> </select>
@ -120,6 +127,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dacp.is_del=0 and dacp.channel_id is NOT NULL and dacp.channel_id!='' where dacp.is_del=0 and dacp.channel_id is NOT NULL and dacp.channel_id!=''
<if test="projectId != null "> and a.project_id = #{projectId}</if> <if test="projectId != null "> and a.project_id = #{projectId}</if>
<if test="deptId != null "> and p.dept_id = #{deptId}</if> <if test="deptId != null "> and p.dept_id = #{deptId}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and p.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and p.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and p.id in (select DISTINCT spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept})</if>
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and p.id in (select DISTINCT spu.project_id from sur_project_userinfo spu where spu.user_id = #{nowUser} and spu.is_del=0)</if>
order by a.project_id asc,b.id asc order by a.project_id asc,b.id asc
</select> </select>