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 277c5c22..5f16e763 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,6 +428,182 @@ 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; + } + @PostMapping("batchBackToFirst") @ApiOperation("驳回,回退至第一个用户任务(重新录入表单)") @LogOperation("驳回,回退至第一个用户任务(重新录入表单)") 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