Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-12-06 18:09:22 +08:00
commit d2b1cb4114
4 changed files with 203 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.activiti.controller; package io.renren.modules.activiti.controller;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.annotation.LogOperation; 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.BatchCompleteDTO;
import io.renren.modules.activiti.dto.TaskDTO; import io.renren.modules.activiti.dto.TaskDTO;
import io.renren.modules.activiti.service.ActTaskService; 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.SecurityUser;
import io.renren.modules.security.user.UserDetail; import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysUserDTO; 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.repository.ProcessDefinitionQuery;
import org.activiti.engine.task.TaskQuery; import org.activiti.engine.task.TaskQuery;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.LinkedHashMap; import java.util.*;
import java.util.List; import java.util.concurrent.CompletableFuture;
import java.util.Map; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -43,6 +48,10 @@ import java.util.stream.Collectors;
@RequestMapping("/act/task") @RequestMapping("/act/task")
@Api(tags = "任务管理") @Api(tags = "任务管理")
public class ActTaskController { public class ActTaskController {
private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newWorkStealingPool(CPU_NUM * 3);
@Autowired @Autowired
private ActTaskService actTaskService; private ActTaskService actTaskService;
@Autowired @Autowired
@ -419,6 +428,182 @@ public class ActTaskController {
return new Result(); 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<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
resultMap.put("total", list.size());
List<Map<String, Object>> 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<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
resultMap.put("total", list.size());
List<Map<String, Object>> 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<Map> arrayList = new ArrayList<>();
//云主机
CompletableFuture<Void> 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<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list);
}, executor);
//云数据库
CompletableFuture<Void> 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<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list);
}, executor);
//对象存储
CompletableFuture<Void> 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<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list);
}, executor);
//托管服务
CompletableFuture<Void> 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<Map<String, Object>> 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<Map<String, Object>> 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") @PostMapping("batchBackToFirst")
@ApiOperation("驳回,回退至第一个用户任务(重新录入表单)") @ApiOperation("驳回,回退至第一个用户任务(重新录入表单)")
@LogOperation("驳回,回退至第一个用户任务(重新录入表单)") @LogOperation("驳回,回退至第一个用户任务(重新录入表单)")

View File

@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -229,4 +230,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<String> selectResourcesTypeByIds(@Param("resourceIds") List<String> resourceIds); List<String> selectResourcesTypeByIds(@Param("resourceIds") List<String> resourceIds);
List<String> selectProvideDeptNameByIds(@Param("resourceIds") List<String> resourceIds); List<String> selectProvideDeptNameByIds(@Param("resourceIds") List<String> resourceIds);
Integer selectPolicyCloudServiceCountByName(@Param("keyWorld") String keyWorld);
} }

View File

@ -21,6 +21,9 @@
<if test="from != null"> <if test="from != null">
AND `from` = #{from} AND `from` = #{from}
</if> </if>
<if test="type != null and type != ''">
AND t2.type = #{type}
</if>
order by t2.create_date desc order by t2.create_date desc
</select> </select>

View File

@ -2381,4 +2381,13 @@
</foreach> </foreach>
</select> </select>
<select id="selectPolicyCloudServiceCountByName" resultType="java.lang.Integer">
SELECT COUNT(1)
FROM policy_cloud_service
WHERE 1 = 1
<if test="keyWorld != null and keyWorld != ''">
and service_item_tier1 LIKE concat('%', #{keyWorld}, '%')
</if>
</select>
</mapper> </mapper>