diff --git a/renren-admin/src/main/java/io/renren/common/annotation/LogOperation.java b/renren-admin/src/main/java/io/renren/common/annotation/LogOperation.java index 63c2191f..81882346 100644 --- a/renren-admin/src/main/java/io/renren/common/annotation/LogOperation.java +++ b/renren-admin/src/main/java/io/renren/common/annotation/LogOperation.java @@ -15,6 +15,13 @@ import java.lang.annotation.Target; @Documented public @interface LogOperation { + /** + * 操作名称 + */ String value() default ""; + + /** + * 操作数据库表 + */ String operationTable() default ""; } diff --git a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java index 8e030f4f..5adc0930 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java @@ -43,9 +43,11 @@ import java.util.concurrent.Executors; @Aspect @Component public class ActivitiNoticeAspect { - private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); + + private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm * 3); - private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class); + private static final Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class); + @Autowired private SysNoticeService sysNoticeService; @Autowired @@ -56,6 +58,7 @@ public class ActivitiNoticeAspect { private SysDeptService sysDeptService; @Autowired private SysRoleService sysRoleService; + private Set work_ = new CopyOnWriteArraySet<>(); @Value("${big_date.name}") diff --git a/renren-admin/src/main/java/io/renren/common/config/TomcatConfig.java b/renren-admin/src/main/java/io/renren/common/config/TomcatConfig.java index 860cbd37..99fb86c2 100644 --- a/renren-admin/src/main/java/io/renren/common/config/TomcatConfig.java +++ b/renren-admin/src/main/java/io/renren/common/config/TomcatConfig.java @@ -1,16 +1,10 @@ package io.renren.common.config; -import org.apache.catalina.connector.Connector; -import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.List; - -import static com.google.common.collect.Lists.newArrayList; - /** * Swagger配置 * @@ -21,12 +15,7 @@ public class TomcatConfig { @Bean public ConfigurableServletWebServerFactory webServerFactory() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); - factory.addConnectorCustomizers(new TomcatConnectorCustomizer() { - @Override - public void customize(Connector connector) { - connector.setProperty("relaxedQueryChars", "^|{}[]"); - } - }); + factory.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "^|{}[]")); return factory; } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java index 90aa0ac5..59cf5ebf 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java @@ -4,6 +4,7 @@ package io.renren.common.controller; import cn.hutool.core.util.ObjectUtil; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; +import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.group.AddGroup; @@ -44,7 +45,7 @@ import java.util.stream.Collectors; @RestController @RequestMapping("/ability/center") public class AbilityCenterController { - private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); + private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class); @@ -57,6 +58,8 @@ public class AbilityCenterController { private TAbilityApplicationService tAbilityApplicationService; @Autowired private ActRunningService actRunningService; + @Autowired + private CodeGenerationUtils codeGenerationUtils; private static final String key = "abilityprocess"; @@ -83,6 +86,7 @@ public class AbilityCenterController { if (page.getTotal() <= 0) { // return new Result().error("联系管理员添加流程"); } + String applyNumber = codeGenerationUtils.getApplyNumber("NLSY"); return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> { if (index.get("resourceId") == null) { logger.error("未携带资源id"); @@ -93,6 +97,7 @@ public class AbilityCenterController { return null; } TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO(); + tAbilityApplicationDTO.setApplyNumber(applyNumber); tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea()); tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment()); tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis()); diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index 3444980b..fa8fb357 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import io.renren.common.dto.AuditingBaseDTO; import io.renren.common.page.PageData; +import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.group.AddGroup; @@ -29,6 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Lazy; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -62,10 +64,14 @@ public class AbilityCenterControllerV2 { private ActRunningService actRunningService; @Autowired private ResourceService resourceService; + @Lazy @Autowired private JdbcTemplate jdbcTemplate; @Autowired private SysDeptService sysDeptService; + @Autowired + private CodeGenerationUtils codeGenerationUtils; + @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 private static final String key = "abilityprocess_v2"; @@ -90,6 +96,7 @@ public class AbilityCenterControllerV2 { } final String applyFlag = UUID.randomUUID().toString(); abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识 + String applyNumber = codeGenerationUtils.getApplyNumber("NLSY"); final Optional deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final UserDetail user = SecurityUser.getUser(); @@ -99,6 +106,7 @@ public class AbilityCenterControllerV2 { return null; } TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO(); + tAbilityApplicationDTO.setApplyNumber(applyNumber); tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea()); tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment()); tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis()); @@ -115,7 +123,7 @@ public class AbilityCenterControllerV2 { tAbilityApplicationDTO.setApproveStatus("审核中"); tAbilityApplicationDTO.setDelFlag(0); // v2 新增字段 - tAbilityApplicationDTO.setCameraList(index.get("cameraId")); + tAbilityApplicationDTO.setCameraList(index.get("cameraId").toString()); tAbilityApplicationDTO.setTitle(abilityBatchApplicationDTO.getTitle()); tAbilityApplicationDTO.setApplicationBackground(abilityBatchApplicationDTO.getApplicationBackground()); tAbilityApplicationDTO.setApplicationScene(abilityBatchApplicationDTO.getApplicationScene()); diff --git a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java index dd0bfed8..86626e7b 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java @@ -3,6 +3,7 @@ package io.renren.common.controller; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; +import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.Result; import io.renren.modules.activiti.dto.ProcessInstanceDTO; import io.renren.modules.activiti.dto.ProcessStartDTO; @@ -47,6 +48,8 @@ public class CommentController { private TDemandCommentService tDemandCommentService; @Autowired private JdbcTemplate jdbcTemplate; + @Autowired + private CodeGenerationUtils codeGenerationUtils; private static final Logger logger = LoggerFactory.getLogger(CommentController.class); @@ -81,6 +84,7 @@ public class CommentController { if (tDemandCommentDTO.getId() == null) { return new Result().error("该评论不存在"); } + tDemandCommentDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("XQPL")); tDemandCommentDTO.setDelFlag(2); // 待审核 tDemandCommentDTO.setCompleteEntry(Boolean.TRUE); tDemandCommentService.update(tDemandCommentDTO); diff --git a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java index d98e1e42..18b2b7b0 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java @@ -4,6 +4,7 @@ package io.renren.common.controller; import com.alibaba.fastjson.JSONObject; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; +import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.group.AddGroup; @@ -43,6 +44,8 @@ public class DemandDataController { private ActRunningService actRunningService; @Autowired private TDemandDataService tDemandDataService; + @Autowired + private CodeGenerationUtils codeGenerationUtils; private static final String key = "abilitydemandapply"; @@ -66,6 +69,7 @@ public class DemandDataController { logger.info(JSONObject.toJSONString(tDemandDataDTO)); logger.info("####################################################"); tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag()); + tDemandDataDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXQ")); ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class); tDemandDataService.save(tDemandDataDTO); diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 1e4f3889..a215647a 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -6,6 +6,7 @@ import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSONObject; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; +import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.group.AddGroup; @@ -57,6 +58,8 @@ public class ResourceMountController { private ResourceService resourceService; @Autowired private SysUserService sysUserService; + @Autowired + private CodeGenerationUtils codeGenerationUtils; @Autowired protected TaskService taskService; @@ -102,6 +105,7 @@ public class ResourceMountController { tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSONObject.toJSONString(index))); tResourceMountApplyDTO.setResourceDTO(index); tResourceMountApplyDTO.setEnclosure(index.getEnclosure()); + tResourceMountApplyDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLSJ")); try { tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId()); } catch (Exception e) { @@ -184,6 +188,7 @@ public class ResourceMountController { } dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason()); dto.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); // 设置为正常 + dto.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXJ")); String userId = SecurityUser.getUserId().toString(); Optional userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId))); userDTO.ifPresent(user -> { diff --git a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java index 1922e406..4ca445b3 100644 --- a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java +++ b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java @@ -4,7 +4,6 @@ import lombok.Data; import java.io.Serializable; - /** * 审核流程各数据类 基础DTO */ diff --git a/renren-admin/src/main/java/io/renren/common/interceptor/ShangTangTaskProperties.java b/renren-admin/src/main/java/io/renren/common/interceptor/ShangTangTaskProperties.java index f00e5ab5..43172349 100644 --- a/renren-admin/src/main/java/io/renren/common/interceptor/ShangTangTaskProperties.java +++ b/renren-admin/src/main/java/io/renren/common/interceptor/ShangTangTaskProperties.java @@ -1,6 +1,5 @@ package io.renren.common.interceptor; - import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; diff --git a/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java b/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java index af839f5f..35878a58 100644 --- a/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java +++ b/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java @@ -1,6 +1,5 @@ package io.renren.common.listener; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializer; @@ -22,7 +21,8 @@ import java.util.Map; */ @Component public class InitiatorDataEntryListener implements TaskListener { - private static Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class); + + private static final Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class); @Autowired private TaskService taskService; diff --git a/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java b/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java index 7012044b..2627881d 100644 --- a/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java +++ b/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java @@ -3,6 +3,7 @@ package io.renren.common.utils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; import java.util.Date; @@ -10,6 +11,7 @@ import java.util.Date; /** * 编码生成工具类 */ +@Component public class CodeGenerationUtils { @Autowired @@ -68,12 +70,16 @@ public class CodeGenerationUtils { } private String getApplyNumberString (String tableName, String applyNumberPattern) { - String sql = "SELECT SUBSTR(apply_number, 5) FROM" + tableName + - "WHERE 1 = 1 AND apply_number IS NOT NULL " + - "AND apply_number LIKE '" + applyNumberPattern + "%'" + + String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName + + " WHERE 1 = 1 AND apply_number IS NOT NULL " + + "AND apply_number LIKE '" + applyNumberPattern + "%' " + "ORDER BY apply_number DESC " + "LIMIT 1"; - String s = jdbcTemplate.queryForObject(sql, String.class); - return StringUtils.isNotBlank(s) ? applyNumberPattern + "0001" : String.valueOf(Long.parseLong(s) + 1); + try { + String s = jdbcTemplate.queryForObject(sql, String.class); + return "NLSY" + (Long.parseLong(s) + 1); + } catch (Exception e) { + return applyNumberPattern + "0001"; + } } } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java b/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java index 3e8d3407..94145c57 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java @@ -1,5 +1,7 @@ package io.renren.modules.monitor.controller; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; import io.renren.modules.monitor.dto.*; import io.renren.modules.monitor.entity.*; import io.renren.modules.monitor.mapper.*; @@ -581,5 +583,111 @@ public class Controller { return success; } + /******************************2022/07/13 ytl修改视频资源 start********************************************/ + + /** + * 根据parentId查询组织新,带摄像头通道数量 + * @param parentId + * @return + */ + @GetMapping("selectSubOrganNew") + @ApiOperation("根据上级组织id查询组织,带摄像头通道数量") + @ApiImplicitParam(name = "parentId",value = "上级组织id",required = true,dataType = "String") + public Result selectSubOrganizationNew(String parentId){ + if (parentId == null){ + parentId = ""; + } + + //List organs = cameraOrgenMapper.selectSubOrganization(parentId); + List maps = monitorService.selectSubOrganizationNew(parentId); + + Result success = Result.success(maps); + + return success; + } + + /** + * 根据parentId和checkStatus查询摄像头 + * @param + * @return + */ + @GetMapping("selectByParentIdNew") + @ApiOperation("根据摄像头的组织Id和异常状态查询摄像头") + @ApiImplicitParams({ + @ApiImplicitParam(name = "parentId",value = "摄像头的组织Id",required = true,dataType = "String"), + @ApiImplicitParam(name = "checkStatus",value = "异常状态 1正常,0异常",required = false,dataType = "String"), + @ApiImplicitParam(name = "cameraName",value = "摄像头名称",dataType = "String"), + @ApiImplicitParam(name = "gpsX",value = "经度坐标",dataType = "Double"), + @ApiImplicitParam(name = "gpsY",value = "纬度坐标",dataType = "Double"), + @ApiImplicitParam(name = "pageNum",value = "页码",dataType = "Integer"), + @ApiImplicitParam(name = "pageSize",value = "页数大小",dataType = "Integer"), + @ApiImplicitParam(name = "radius",value = "半径",dataType = "Integer"), + @ApiImplicitParam(name = "labelCodes",value = "标签",dataType = "List") + }) + public Result selectByParentIdNew(@RequestParam Map queryMap, String[] labelCodes){ + if (!queryMap.containsKey("pageNum")) { + queryMap.put("pageNum", null); + queryMap.put("pageSize", null); + } else { + Integer pageNum = Integer.parseInt(queryMap.get("pageNum").toString()); + Integer pageSize = Integer.parseInt(queryMap.get("pageSize").toString()); + queryMap.replace("pageNum", (pageNum - 1) * pageSize); + queryMap.replace("pageSize", pageSize); + } + List list1 = null; + if (null != labelCodes && labelCodes.length > 0) { + list1 = Arrays.asList(labelCodes); + } + List list = cameraChannelMapper.selectByParentIdNew(queryMap, list1); + + Result success = Result.success(list); + success.setCount(cameraChannelMapper.selectByParentIdCountNew(queryMap, list1)); + return success; + + } + + /** + * 摄像头按照市区进行聚合查询 + */ + @GetMapping("selectChannelNumByRegion") + @ApiOperation("根据摄像头的组织Id和异常状态查询摄像头") + public Result selectChannelNumByRegion() throws Exception{ + return monitorService.selectChannelNumByRegion(); + } + + /** + * 保存区域信息 + */ + @GetMapping("/saveOrgenization") + public Result saveOrgenization() throws Exception{ + List orgenizationByPage = monitorService.getOrgenization(new ArrayList()); + List maps = JSONObject.parseArray(JSONObject.toJSONString(orgenizationByPage), Map.class); + if(maps.size() > 0){ + List> lists = Lists.partition(maps,100); + lists.forEach(list->{ + cameraOrgenMapper.batchSaveOrgenization(list); + }); + + maps.forEach(map->{ + monitorService.setOrganizationPath(map,map.get("parentId").toString()); + }); + //修改path + maps.forEach(m->{ + cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString()); + }); + } + + return Result.success(); + } + + /** + * 保存通道信息 + * @return + */ + @GetMapping("saveChannelInfo") + public Result saveChannelInfo() throws Exception{ + return monitorService.saveChannelInfo(); + } + /******************************2022/07/13 ytl修改视频资源 end********************************************/ } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java index 1130eb3b..bc473be9 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java @@ -61,4 +61,12 @@ public interface CameraChannelMapper extends BaseDao { List selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize); Integer selectByParentIdCount(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes); + + Integer selectChannelCounts(@Param("path") String path); + + List selectByParentIdNew(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes); + + Integer selectByParentIdCountNew(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes); + + List selectChannelNumByRegion(); } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java index a1b0ef2e..a4faa589 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java @@ -6,12 +6,36 @@ import io.renren.modules.monitor.entity.CameraOrganization; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; import java.util.List; +import java.util.Map; @Mapper public interface CameraOrgenizationMapper extends BaseDao { @Select("select * from t_camera_organization where parent_id = #{parentId}") List selectSubOrganization(@Param("parentId") String parentId); + + @Select("select *,0 AS channelCount from t_camera_organization02 where parent_id = #{parentId}") + List selectSubOrganizationMap(@Param("parentId") String parentId); + + void batchSaveOrgenization(List list); + + @Select("SELECT name,parent_id FROM t_camera_organization02 WHERE id = #{id}") + Map selectOrgenizationById(@Param("id") String id); + + @Update("UPDATE t_camera_organization02 SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}") + void updateOrganizationPaht(@Param("path") String path,@Param("id") String id); + + @Select(" SELECT id FROM t_camera_organization02") + List listOrgenization(); + + @Select(" SELECT name FROM t_camera_organization02 where substring(id,5) = #{idPart} and left(id,3) = '006'") + String getNameByidPart(@Param("idPart")String idPart); + + @Update("UPDATE t_camera_organization02 SET COUNT = COUNT + 1 WHERE id = #{id}") + void updateOrganizationCount(@Param("id") String id); + + void batchSaveCameraChannel(List list); } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java index 9327b970..0dcb2e68 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java @@ -1091,6 +1091,166 @@ public class MonitorService { return yestDay.format(formatter); } + + //根据父id查询查询通道的数量 + public List selectSubOrganizationNew(String parentId) { + if (parentId == null){ + parentId = ""; + } + List organs = cameraOrgenMapper.selectSubOrganizationMap(parentId);//查询某个区域下的所有地区 + if(organs.size() > 0){ + for(int i=0;i< organs.size();i++){ + String path = organs.get(i).get("path").toString(); + + Integer count = cameraChannelMapper.selectChannelCounts(path); + organs.get(i).put("channelCount",count); + + }; + } + return organs; + } + + + public Result selectChannelNumByRegion() throws Exception{ + List maps = cameraChannelMapper.selectChannelNumByRegion(); + return Result.success(maps); + } + + public List getOrgenization(List list){ + try { + List list1 = this.getOrgenizationRoot(); + list.addAll(list1); + list1.forEach(a->{ + if(a.getBooleanValue("isParent")){ + getOrgenizationByParent(list,a.getString("id")); + } + }); + return list; + }catch (Exception e){ + log.info(e.getMessage()); + return null; + } + } + + //获取根组织 + public List getOrgenizationRoot() throws Exception{ + List list = new ArrayList<>(); + String url = monitorDomain + "/videoService/devicesManager/deviceTree?id=&nodeType=1&typeCode=01&page=1&pageSize=3000"; + HttpHeaders headers = new HttpHeaders(); + headers.add("X-Subject-Token",token); + ResponseEntity responseEntity = null; + + HttpEntity httpEntity = new HttpEntity<>(null, headers); + responseEntity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,JSONObject.class); + JSONObject re = responseEntity.getBody(); + List results = re.getJSONArray("results").toJavaList(JSONObject.class); + return results; + } + + //组织递归根据父ID查,简化了分页 + public List getOrgenizationByParent(List list,String id){ + HttpHeaders headers = new HttpHeaders(); + headers.add("X-Subject-Token",token); + String url; + Map map = new HashMap<>(); + HttpEntity httpEntity; + ResponseEntity responseEntity = null; + + url = monitorDomain + "/videoService/devicesManager/deviceTree?id="+id+"&nodeType=1&typeCode=01&page=1&pageSize=3000"; + + httpEntity = new HttpEntity<>(null, headers); + + responseEntity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,JSONObject.class); + JSONObject re = responseEntity.getBody(); + if(re.getIntValue("totalCount")>0){ + JSONArray results = re.getJSONArray("results"); + List jsonObjects = results.toJavaList(JSONObject.class); + list.addAll(jsonObjects); + jsonObjects.forEach(js->{ + if(js.getBooleanValue("isParent")){ + getOrgenizationByParent(list,js.getString("id")); + } + }); + } + return list; + } + + //更新组织的path + public void setOrganizationPath(Map map ,String parentId){ + Map map2 = cameraOrgenMapper.selectOrgenizationById(parentId); + if(map2 != null){ + String path = map2.get("name").toString(); + String newNodeName = path + "->" + (map.get("path")==null?"":map.get("path").toString()); + map.put("path",newNodeName); + setOrganizationPath(map,map2.get("parent_id").toString()); + } + } + + //保存通道信息 + public Result saveChannelInfo() throws Exception { + List orgenList = cameraOrgenMapper.listOrgenization(); + for(Map m:orgenList){ + List cameChannels = getChannelInfo(m.get("id").toString()); + List needSave = new ArrayList<>(); + if(cameChannels.size() > 0){ + boolean flag = false; + for(Map j:cameChannels){ + if(Integer.parseInt(j.get("nodeType").toString()) ==3){ + flag = true; + String channelSn = j.get("channelSn").toString(); + String channelOrngin = channelSn.substring(0,6); + String deptName = cameraOrgenMapper.getNameByidPart(channelOrngin); + j.put("regionName",deptName); + j.put("regionCode",channelOrngin); + j.put("parentId",m.get("id").toString()); + j.put("nodeName",""); + needSave.add(j); + } + } + if(!flag){//更新count字段 + cameraOrgenMapper.updateOrganizationCount(m.get("id").toString()); + } + }else{//更新count字段 + cameraOrgenMapper.updateOrganizationCount(m.get("id").toString()); + } + + needSave.forEach(map->setNodeName(map,map.get("parentId").toString())); + //保存并更新count字段 + if(needSave.size() > 0){ + List> partition = Lists.partition(needSave, 100); + partition.forEach(list->{ + cameraOrgenMapper.batchSaveCameraChannel(list); + }); + cameraOrgenMapper.updateOrganizationCount(m.get("id").toString()); + } + } + return Result.success(); + } + + //根据组织id获取通道信息 + public List getChannelInfo(String orgenId) throws Exception{ + String url = monitorDomain +"/videoService/devicesManager/deviceTree?nodeType=1&typeCode=01;0;ALL;ALL&page=1&pageSize=3000&id="+orgenId; + HttpHeaders headers = new HttpHeaders(); + headers.add("X-Subject-Token",token); + ResponseEntity responseEntity = null; + + HttpEntity httpEntity = new HttpEntity<>(null, headers); + responseEntity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,JSONObject.class); + JSONObject re = responseEntity.getBody(); + List results = re.getJSONArray("results").toJavaList(Map.class); + return results; + } + + //查询nodename + public void setNodeName(Map map,String id){ + Map map2 = cameraOrgenMapper.selectOrgenizationById(id); + if(map2 != null){ + String nodeName = map2.get("name").toString(); + String newNodeName = nodeName + "->" + (map.get("nodeName")==null?"":map.get("nodeName").toString()); + map.put("nodeName",newNodeName); + setNodeName(map,map2.get("parent_id").toString()); + } + } } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index 49f0ed7e..9503b0ae 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -1,6 +1,7 @@ package io.renren.modules.processForm.controller; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.renren.common.annotation.LogOperation; import io.renren.common.constant.Constant; import io.renren.common.page.PageData; @@ -14,8 +15,12 @@ import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.UpdateGroup; import io.renren.modules.activiti.dto.HistoryDetailDTO; import io.renren.modules.activiti.service.ActivitiService; +import io.renren.modules.monitor.dto.CameraChannelDto1; +import io.renren.modules.monitor.mapper.CameraChannelMapper; +import io.renren.modules.processForm.dao.TAbilityApplicationDao; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.dto.TAbilityApplicationV2DTO; +import io.renren.modules.processForm.entity.TAbilityApplicationEntity; import io.renren.modules.processForm.excel.TAbilityApplicationExcel; import io.renren.modules.processForm.service.TAbilityApplicationService; import io.renren.modules.resource.dto.ResourceDTO; @@ -44,7 +49,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; - /** * 能力申请表单 * @@ -64,6 +68,10 @@ public class TAbilityApplicationController { @Autowired private JdbcTemplate jdbcTemplate; @Autowired + private TAbilityApplicationDao tAbilityApplicationDao; + @Autowired + private CameraChannelMapper cameraChannelMapper; + @Autowired private SysDeptService sysDeptService; @Value("${project.place}") private Integer projectPlace; @@ -77,7 +85,10 @@ public class TAbilityApplicationController { */ @GetMapping("my_page") @LogOperation("我的申请分页") - @ApiImplicitParams({@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")}) + @ApiImplicitParams({@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")}) public Result> myPage(@ApiIgnore @RequestParam Map params) { final UserDetail user = SecurityUser.getUser(); params.put("abilityprocess_v2", Boolean.TRUE); // 是否根据流程 abilityprocess_v2 来分页 @@ -113,7 +124,6 @@ public class TAbilityApplicationController { * * @return */ - @GetMapping("deal") public Result test() { List> re = jdbcTemplate.queryForList("SELECT t_ability_application.id,t_ability_application.resource_id,tb_data_resource.dept_id from t_ability_application JOIN tb_data_resource ON t_ability_application.resource_id = tb_data_resource.id WHERE resource_owner_dept IS NULL;"); @@ -150,24 +160,40 @@ public class TAbilityApplicationController { return new Result().ok(null); } TAbilityApplicationV2DTO tAbilityApplicationV2DTO = ConvertUtils.sourceToTarget(applicationDTOS.get(0), TAbilityApplicationV2DTO.class); + applicationDTOS.stream().limit(1l).forEach(dto -> { + if (StringUtils.isNotEmpty(dto.getCameraList())) { + if (applicationDTOS.size() > 1) { + tAbilityApplicationV2DTO.setSystem("视频资源申请:(" + dto.getSystem() + " 等" + applicationDTOS.size() + "个摄像头)"); + } else { + tAbilityApplicationV2DTO.setSystem("视频资源申请:" + dto.getSystem()); + } + } + }); Map>> re = result.keySet().stream().map(index -> { final List tAbilityApplicationDTOList = result.get(index); + if (tAbilityApplicationDTOList.isEmpty()) { + return null; + } List resourceDTOS = tAbilityApplicationDTOList.stream().filter(tAbilityApplicationDTO -> StringUtils.isEmpty(tAbilityApplicationDTO.getCameraList())) // 过滤非摄像头申请 .map(tAbilityApplicationDTO -> resourceService.get(Long.valueOf(tAbilityApplicationDTO.getResourceId()))).collect(Collectors.toList()); List taskHandleDetailInfo = activitiService.getTaskHandleDetailInfo(tAbilityApplicationDTOList.get(0).getInstanceId()); - List camera = new ArrayList<>(); - switch (Constant.ProjectPlace.getByFlag(projectPlace)) { // 处理基础设施 - case TSINGTAO_XHA: - break; - case TSINGTAO: { // 大数据局 - camera = (List) resourceService.getApplyCameraList(Long.valueOf(tAbilityApplicationDTOList.get(0).getInstanceId())); + List camera; + ArrayList cameraList = new ArrayList(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("instance_id", tAbilityApplicationDTOList.get(0).getInstanceId()); + List applicationEntities = tAbilityApplicationDao.selectList(queryWrapper); + + applicationEntities.forEach(index_ -> { + if (StringUtils.isEmpty(index_.getCameraList())) { + return; } - break; - case BAOTOU: - case UNKNOWN: - default: - } + List channelDto1s = cameraChannelMapper.selectByChannelCode(index_.getCameraList().replaceAll("\"", "")); + if (!channelDto1s.isEmpty()) { + cameraList.add(channelDto1s.get(0)); + } + }); + camera = cameraList; List finalCamera = camera; Map resourceApplication = new HashMap() { @@ -182,7 +208,7 @@ public class TAbilityApplicationController { } }; return resourceApplication; - }).collect(Collectors.groupingBy(t -> { + }).filter(index -> index != null).collect(Collectors.groupingBy(t -> { SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept"); if (sysDeptDTO == null) { return "未知部门"; // 无部门信息 diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationV2DTO.java b/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationV2DTO.java index e782c151..6c6a1601 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationV2DTO.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationV2DTO.java @@ -51,6 +51,9 @@ public class TAbilityApplicationV2DTO implements Serializable { @ApiModelProperty(value = "申请单标识(同一次的申请标识)") private String applyFlag; + @ApiModelProperty(value = "审核状态:审核中,通过,不通过") + private String approveStatus; + // 以上为申请时公共信息 @ApiModelProperty(value = "资源申请情况(包含资源信息和流程流转)") diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index 70944d98..5b8e9c7c 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -107,6 +107,9 @@ public class ResourceDTO extends AuditingBaseDTO implements Serializable { @ApiModelProperty(value = "总体评价") private Integer total; + @ApiModelProperty(value = "申请单号") + private String applyNumber; + public String getDelFlagTip() { if (this.delFlag != null) { Optional resourceEntityDelFlagOptional = Optional.ofNullable(ResourceEntityDelFlag.getByFlag(this.delFlag)); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java index 78aa2eae..cb3d4958 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java @@ -136,4 +136,9 @@ public class ResourceEntity extends BaseEntity { @TableField(value = "info_list", typeHandler = FastjsonTypeHandler.class) private List infoList; + + /** + * 申请单号 + */ + private String applyNumber; } \ No newline at end of file diff --git a/renren-admin/src/main/resources/db/V3.6__sys_user_token_drop_index.sql b/renren-admin/src/main/resources/db/V3.6__sys_user_token_drop_index.sql new file mode 100644 index 00000000..91682ede --- /dev/null +++ b/renren-admin/src/main/resources/db/V3.6__sys_user_token_drop_index.sql @@ -0,0 +1,23 @@ +DROP PROCEDURE IF EXISTS del_idx; + +create procedure del_idx(IN p_tablename varchar(200), IN p_idxname VARCHAR(200)) + +begin + +DECLARE str VARCHAR(250); + +set @str=concat(' drop index ',p_idxname,' on ',p_tablename); + +select count(*) into @cnt from information_schema.statistics where table_name=p_tablename and index_name=p_idxname ; + +if @cnt >0 then + +PREPARE stmt FROM @str; + +EXECUTE stmt ; + +end if; + +end ; + +call del_idx('sys_user_token','user_id'); \ No newline at end of file diff --git a/renren-admin/src/main/resources/logback-spring.xml b/renren-admin/src/main/resources/logback-spring.xml index 0eacfe24..f2560937 100644 --- a/renren-admin/src/main/resources/logback-spring.xml +++ b/renren-admin/src/main/resources/logback-spring.xml @@ -54,8 +54,8 @@ - - + + diff --git a/renren-admin/src/main/resources/mapper/demanData/TDemandDataDao.xml b/renren-admin/src/main/resources/mapper/demanData/TDemandDataDao.xml index 9516f3e8..4ed9b99c 100644 --- a/renren-admin/src/main/resources/mapper/demanData/TDemandDataDao.xml +++ b/renren-admin/src/main/resources/mapper/demanData/TDemandDataDao.xml @@ -22,6 +22,7 @@ + diff --git a/renren-admin/src/main/resources/mapper/demandComment/TDemandCommentDao.xml b/renren-admin/src/main/resources/mapper/demandComment/TDemandCommentDao.xml index 4d8129c2..736d1777 100644 --- a/renren-admin/src/main/resources/mapper/demandComment/TDemandCommentDao.xml +++ b/renren-admin/src/main/resources/mapper/demandComment/TDemandCommentDao.xml @@ -16,6 +16,7 @@ + + + + + + + + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml index fca5b5e3..2310fee6 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml @@ -1,5 +1,32 @@ + + INSERT INTO t_camera_organization02 ( + id,name,parent_id,sort,subCount,is_parent,path + ) VALUES + + ( + #{item.id},#{item.name},#{item.parentId},#{item.sort},#{item.subCount},case when #{item.isParent} = true then 1 else 0 end,#{item.name} + ) + + + + + + INSERT INTO t_camera_channel01 + ( + channel_code,channel_id,channel_name,gps_x,gps_y,status, + parent_id,region_code,region_name,node_name + ) + VALUES + + ( + #{item.channelCode},#{item.channelId},#{item.channelName},#{item.gpsX},#{item.gpsY},#{item.status}, + #{item.parentId},#{item.regionCode},#{item.regionName},TRIM(TRAILING '->' FROM #{item.nodeName}) + + ) + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml index e3dd9b71..554efea7 100644 --- a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml +++ b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml @@ -27,6 +27,7 @@ + @@ -51,6 +52,7 @@ + diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 8ef18308..43aa418e 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -35,6 +35,7 @@ + @@ -77,6 +78,7 @@ + diff --git a/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml b/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml index d5857b20..d43d3720 100644 --- a/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml @@ -17,6 +17,7 @@ + diff --git a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml index 70b12bc9..992db2ea 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml @@ -36,7 +36,7 @@ @@ -44,7 +44,7 @@