From 948c1d2d55a66d8f992b2581b4cdd2daa9e594ae Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Tue, 6 Dec 2022 18:01:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=85=A8=E5=B1=80=E6=90=9C=E7=B4=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=94=BF=E5=8A=A1=E4=BA=91=E8=B5=84=E6=BA=90=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=202.=E5=90=8E=E5=8F=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E9=80=9A=E7=9F=A5=E7=AE=A1=E7=90=86-=E6=88=91?= =?UTF-8?q?=E7=9A=84=E9=80=9A=E7=9F=A5=E5=A2=9E=E5=8A=A0=E6=8C=89=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=B1=BB=E5=9E=8B=E7=AD=9B=E9=80=89=203.=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E6=B5=AA=E6=BD=AE=E6=94=BF=E5=8A=A1=E4=BA=91=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=92=8C=E4=BA=91=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActTaskController.java | 191 +++++++++++++++++- .../modules/resource/dao/ResourceDao.java | 3 + .../resources/mapper/notice/SysNoticeDao.xml | 3 + .../resources/mapper/resource/ResourceDao.xml | 9 + 4 files changed, 203 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 81f9f2e6..de4aeb2d 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -1,5 +1,6 @@ package io.renren.modules.activiti.controller; +import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.annotation.LogOperation; @@ -10,6 +11,7 @@ import io.renren.common.utils.Result; import io.renren.modules.activiti.dto.BatchCompleteDTO; import io.renren.modules.activiti.dto.TaskDTO; import io.renren.modules.activiti.service.ActTaskService; +import io.renren.modules.device.dto.TbDeviceApplyDTO; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; import io.renren.modules.sys.dto.SysUserDTO; @@ -24,14 +26,17 @@ import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinitionQuery; import org.activiti.engine.task.TaskQuery; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.logging.Logger; import java.util.stream.Collectors; /** @@ -43,6 +48,10 @@ import java.util.stream.Collectors; @RequestMapping("/act/task") @Api(tags = "任务管理") public class ActTaskController { + + private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors(); + private static final ExecutorService executor = Executors.newWorkStealingPool(CPU_NUM * 3); + @Autowired private ActTaskService actTaskService; @Autowired @@ -419,4 +428,180 @@ public class ActTaskController { return new Result(); } + @GetMapping("/getZwyBusinessList") + @ApiOperation("个人中心查询政务云资源申请列表") + @LogOperation("个人中心查询政务云资源申请列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "业务名称", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "applyType", value = "申请类型", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "分页大小", paramType = "query", required = true, dataType = "Integer") + + }) + public Result getZwyBusinessList(String name, String applyType, String status, int pageNum, int pageSize) { + UserDetail user = SecurityUser.getUser(); + JdbcTemplate jdbcTemplate = getJDBCTemplate(); + StringBuilder sql = new StringBuilder("SELECT BSNUM, BUSINESS_NAME, APPLYTYPE, CREATE_TIME, STATUS " + + "FROM VIEW_CLOUD_BUSINESS_INDEX WHERE 1 = 1 AND ACCOUNT = " + user.getUsername()); + if (!StringUtils.isEmpty(name)) { + sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') "); + } + if (!StringUtils.isEmpty(applyType)) { + sql.append(" AND APPLYTYPE = ").append(applyType); + } + if (!StringUtils.isEmpty(status)) { + sql.append(" AND STATUS = ").append(status); + } + sql.append("ORDER BY CREATE_TIME DESC"); + try { + Map resultMap = new HashMap<>(); + List> list = jdbcTemplate.queryForList(sql.toString()); + resultMap.put("total", list.size()); + List> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + resultMap.put("list", result); + return new Result().ok(resultMap); + } catch (Exception e) { + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); + } + + } + + @GetMapping("/getZwyVideoList") + @ApiOperation("个人中心查询政务云视频申请列表") + @LogOperation("个人中心查询政务云视频申请列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "业务名称", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "分页大小", paramType = "query", required = true, dataType = "Integer") + + }) + public Result getZwyVideoList(String name, String status, int pageNum, int pageSize) { + UserDetail user = SecurityUser.getUser(); + JdbcTemplate jdbcTemplate = getJDBCTemplate(); + StringBuilder sql = new StringBuilder("SELECT BSNUM, BUSINESS_NAME, CREATE_TIME, STATUS " + + "FROM VIEW_VIDEO_BUSINESS_INDEX WHERE 1 = 1 AND ACCOUNT = " + user.getUsername()); + if (!StringUtils.isEmpty(name)) { + sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') "); + } + if (!StringUtils.isEmpty(status)) { + sql.append(" AND STATUS = ").append(status); + } + sql.append("ORDER BY CREATE_TIME DESC"); + try { + Map resultMap = new HashMap<>(); + List> list = jdbcTemplate.queryForList(sql.toString()); + resultMap.put("total", list.size()); + List> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + resultMap.put("list", result); + return new Result().ok(resultMap); + } catch (Exception e) { + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); + } + + } + + + @GetMapping("/getZwyBusinessInfoById") + @ApiOperation("根据政务云资源申请业务ID查询详情") + @LogOperation("根据政务云资源申请业务ID查询详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "业务ID", paramType = "query",required = true, dataType = "String") + }) + public Result getZwyBusinessInfoById(String id) { + JdbcTemplate jdbcTemplate = getJDBCTemplate(); + + try { + ArrayList arrayList = new ArrayList<>(); + + //云主机 + CompletableFuture yzj = CompletableFuture.runAsync(() -> { + + StringBuilder sql = new StringBuilder("SELECT BSNUM, SOURCE_TYPE, NAME, DISPOSE " + + " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); + sql.append(id); + + List> list = jdbcTemplate.queryForList(sql.toString()); + arrayList.addAll(list); + + }, executor); + + //云数据库 + CompletableFuture ysjk = CompletableFuture.runAsync(() -> { + + StringBuilder sql = new StringBuilder("SELECT BSNUM, SOURCE_TYPE, NAME, DISPOSE " + + " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); + sql.append(id); + + List> list = jdbcTemplate.queryForList(sql.toString()); + arrayList.addAll(list); + + }, executor); + + //对象存储 + CompletableFuture dxcc = CompletableFuture.runAsync(() -> { + + StringBuilder sql = new StringBuilder("SELECT BSNUM, SOURCE_TYPE, NAME, DISPOSE " + + " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); + sql.append(id); + + List> list = jdbcTemplate.queryForList(sql.toString()); + arrayList.addAll(list); + + }, executor); + + + //托管服务 + CompletableFuture tgfw = CompletableFuture.runAsync(() -> { + + StringBuilder sql = new StringBuilder("SELECT BSNUM, SOURCE_TYPE, NAME, DISPOSE " + + " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); + sql.append(id); + + List> list = jdbcTemplate.queryForList(sql.toString()); + arrayList.addAll(list); + + }, executor); + + + CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw); + all.join(); + return new Result().ok(arrayList); + } catch (Exception e) { + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); + } + + } + + @GetMapping("/getZwyVideoInfoById") + @ApiOperation("根据政务云视频申请业务ID查询详情") + @LogOperation("根据政务云视频申请业务ID查询详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "业务ID", paramType = "query",required = true, dataType = "String") + }) + public Result getZwyVideoInfoById(String id) { + JdbcTemplate jdbcTemplate = getJDBCTemplate(); + StringBuilder sql = new StringBuilder("SELECT BSNUM, CAMERATYPE, NAME, ORG_NAME " + + "FROM VIEW_VIDEO_BUSINESS_RELATION WHERE 1 = 1 AND BSNUM = "); + sql.append(id); + try { + List> list = jdbcTemplate.queryForList(sql.toString()); + return new Result().ok(list); + } catch (Exception e) { + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); + } + + } + + private JdbcTemplate getJDBCTemplate() { + DruidDataSource druidDataSource = new DruidDataSource(); + druidDataSource.setUrl("jdbc:oracle:thin:@15.72.183.89:1521:orcl"); + druidDataSource.setDriverClassName("oracle.jdbc.OracleDriver"); + druidDataSource.setUsername("csynuser"); + druidDataSource.setPassword("csynuser123"); + jdbcTemplate.setDataSource(druidDataSource); + return jdbcTemplate; + } + } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index 20d7f1a3..14a5c3af 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.cache.annotation.Cacheable; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -229,4 +230,6 @@ public interface ResourceDao extends BaseDao { List selectResourcesTypeByIds(@Param("resourceIds") List resourceIds); List selectProvideDeptNameByIds(@Param("resourceIds") List resourceIds); + + Integer selectPolicyCloudServiceCountByName(@Param("keyWorld") String keyWorld); } \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml index c8928bad..15ec7efb 100644 --- a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml +++ b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml @@ -21,6 +21,9 @@ AND `from` = #{from} + + AND t2.type = #{type} + order by t2.create_date desc diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 0f610218..bd90d6b5 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -2381,4 +2381,13 @@ + + \ No newline at end of file