Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-05 14:21:03 +08:00
commit 3d08431a33
47 changed files with 1377 additions and 280 deletions

View File

@ -0,0 +1,33 @@
CREATE TABLE `tb_fuse` (
`id` bigint(20) NOT NULL COMMENT '主键',
`name` varchar(128) DEFAULT NULL COMMENT '融合服务名称',
`description` varchar(128) DEFAULT NULL COMMENT '融合服务描述',
`application_area` varchar(128) DEFAULT NULL COMMENT '应用领域',
`dept_id` bigint(20) DEFAULT NULL COMMENT '所属部门',
`dept_user` varchar(128) DEFAULT NULL COMMENT '部门联系人',
`mobile` varchar(20) DEFAULT NULL COMMENT '部门联系人电话',
`provider` varchar(128) DEFAULT NULL COMMENT '服务商',
`provider_user` varchar(128) DEFAULT NULL COMMENT '服务商联系人',
`provider_mobile` varchar(20) DEFAULT NULL COMMENT '服务商联系人电话',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint(20) DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='融合服务表';
CREATE TABLE `tb_fuse_resource` (
`id` bigint(20) NOT NULL COMMENT '主键',
`fuse_id` bigint(20) NOT NULL COMMENT '融合id',
`resource_id` bigint(20) NOT NULL COMMENT '资源id',
`sequence` varchar(10) DEFAULT NULL COMMENT '顺序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源融合关系表';
CREATE TABLE `tb_fuse_attr` (
`id` bigint(20) NOT NULL COMMENT '主键',
`fuse_id` bigint(20) DEFAULT NULL COMMENT '融合id',
`attr_type` varchar(128) DEFAULT NULL COMMENT '属性类型',
`attr_value` varchar(128) DEFAULT NULL COMMENT '属性值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='融合资源属性表';

View File

@ -0,0 +1,149 @@
- v0.8.0
更新内容:
1. 新增能力云图模块;平台自有数据对接完毕,外部对接内容以西海岸项目提供接口对接。
2. 新增区市站点模块;
3. 新增赋能案例模块;
4. 更新能力上架模块;更新智能算法与应用资源上架页。
5. 更新能力详情模块;更新智能算法与应用资源详情页。
6. 更新导航栏;依据模块新增调整导航栏,个人中心通过点击用户名打开,后台管理通过点击齿轮图标打开。
7. 更新底部栏;支持通过读取配置文件,更改底部栏信息。
8. 更新单点登录配置;支持通过配置关闭单点登录功能。
------------------
- v0.8.0.1
更新内容:
1. 修复登录白屏问题
2. 修复平台弱口令问题
---------------
- v0.8.1.dev
更新内容:
1. 新增数据资源对接
2. 新增消息中心模块
3. 新增算法比对模块
4. 新增我的浏览模块
5. 更新能力申请模块
6. 更新能力集市-基础设施模块
7. 更新区市站点模块,增加统计数据可配置功能。
8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。
9. 更新申购车模块
-----------------
- v0.8.1.1.release(本地测试环境测试)
更新内容:
1. 新增数据资源对接,市局对接合作伙伴列表查询页
2. 新增消息中心模块,模块入口为导航栏“铃铛按钮”内,点击“查看更多”
3. 新增算法比对模块模块入口为能力集市中的PK按钮。
4. 新增我的浏览模块,模块入口为个人中心-我的浏览
5. 更新能力申请模块入口有三个1).能力查询页 2).能力详情页3).申购车
6. 更新能力集市-基础设施模块,新增视频资源模块、云资源模块、感知资源模块,目前视频资源进行对接,提供按组织机构、按模糊查询、按地图地理位置、按视频标签四个维度进行视频资源筛选,新增视频资源添加至购物车、一键申请功能。
7. 更新区市站点模块,增加统计数据可配置功能。
8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。
9. 更新申购车模块,样式与功能均有更新。
--------------------
- v0.8.1.2.release西海岸部署修复
1. 修复本地测试P1、P2问题
2. 修复云图调用市局接口的问题
---------------
- v0.8.1.3.release市局部署修复
1. 修复市局接口报错问题
2. 修复市局配置数据不全问题
3. 修复审核流程字段验证bug
4. 其他旧数据格式导致的展示类问题
------------
## 后续内容
- v0.8.1.4
1. 新增数据资源对接
2. 新增消息中心模块
3. 新增算法比对模块模块入口为能力集市中的PK按钮。
4. 新增我的浏览模块
5. 更新能力申请模块
6. 更新能力集市-基础设施模块
7. 更新区市站点模块,增加统计数据可配置功能。
8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。
9. 更新申购车模块
-------------------
- v0.8.2.dev
更新内容:
1. 新增工作台
2. 新增后台能力统计
|| 新增、修改、删除、解决的重点bug

View File

@ -34,6 +34,8 @@ import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 流程流转消息通知切面
@ -41,6 +43,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Aspect
@Component
public class ActivitiNoticeAspect {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
@Autowired
private SysNoticeService sysNoticeService;
@ -175,21 +179,20 @@ public class ActivitiNoticeAspect {
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
}).thenRunAsync(() -> {
// 防止重放
new Thread(() -> {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
work_.remove(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString());
}
}).start();
});
}, executor);
} catch (Exception e) {
logger.error("发送通知消息异常", e);
} finally {
// 防止重放
new Thread(() -> {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
work_.remove(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString());
}
}).start();
}
}
@ -254,8 +257,9 @@ public class ActivitiNoticeAspect {
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
}).thenRunAsync(() -> {
}, executor).thenRunAsync(() -> {
logger.error("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.error("deptDTOId:" + deptDTO.getId());
@ -276,22 +280,23 @@ public class ActivitiNoticeAspect {
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
});
}).thenRunAsync(() -> {
// 防止重放
new Thread(() -> {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
work_.remove(ExecutionListener.EVENTNAME_END + kv.get("id").toString());
}
}).start();
});
}, executor);
} catch (Exception exception) {
logger.error("发送通知消息异常", exception);
} finally {
// 防止重放
new Thread(() -> {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
work_.remove(ExecutionListener.EVENTNAME_END + kv.get("id").toString());
}
}).start();
}
}
@ -339,7 +344,7 @@ public class ActivitiNoticeAspect {
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
}).thenRunAsync(() -> { // 审批者
}, executor).thenRunAsync(() -> { // 审批者
SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator));
String content = "【通知】" + owner.getRealName() + "发起的流程" + activitiNoticeOperation.process() + "已进入审核节点:" + activitiNoticeOperation.value() + ";当前审核人指派为您";
SysNoticeDTO dto = new SysNoticeDTO();
@ -355,7 +360,7 @@ public class ActivitiNoticeAspect {
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
});
}, executor);
} catch (Exception e) {
logger.error("发送通知消息异常", e);
} finally {

View File

@ -30,6 +30,7 @@ public class RestTemplateConfig {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setReadTimeout(2000);//单位为ms
factory.setConnectTimeout(500);//单位为ms
factory.setOutputStreaming(false);
// SocketAddress address = new InetSocketAddress("127.0.0.1", 8888);
// Proxy proxy = new Proxy(Proxy.Type.HTTP, address);

View File

@ -24,7 +24,7 @@ public class TomcatConfig {
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "|{}[]");
connector.setProperty("relaxedQueryChars", "^|{}[]");
}
});
return factory;

View File

@ -31,6 +31,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@ -42,6 +44,8 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/ability/center")
public class AbilityCenterController {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
@ -125,7 +129,7 @@ public class AbilityCenterController {
if (Long.valueOf(dto.getBusinessKey()) != null) {
tAbilityApplicationService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
}
});
}, executor);
return dto;
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
}

View File

@ -38,6 +38,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
@ -48,6 +50,8 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/ability/center/v2")
public class AbilityCenterControllerV2 {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
private static final ObjectMapper oMapper = new ObjectMapper();
@Autowired
@ -191,7 +195,7 @@ public class AbilityCenterControllerV2 {
.collect(Collectors.toList()).toArray(new String[dtoList.size()]);
jdbcTemplate.batchUpdate(sqls);
}
});
}, executor);
});
}
return new Result().ok(LocalDateTime.now().toString());

View File

@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
@ -32,8 +34,9 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/census/center")
public class CensusController {
private static final Logger logger = LoggerFactory.getLogger(CensusController.class);
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
@Autowired
private ResourceService resourceService;
@ -95,7 +98,7 @@ public class CensusController {
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
Long sum = dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
return sum;
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -105,7 +108,7 @@ public class CensusController {
});
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
return sysUserService.countAllUser();
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -116,7 +119,7 @@ public class CensusController {
CompletableFuture<Void> applyAmount = CompletableFuture.supplyAsync(() -> { // 资源申请量
return tAbilityApplicationService.countApplyAll();
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -127,7 +130,7 @@ public class CensusController {
CompletableFuture<Void> deptAmount = CompletableFuture.supplyAsync(() -> { // 覆盖部门量
return resourceService.countAllDept();
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -138,7 +141,7 @@ public class CensusController {
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
return resourceService.countAllVisits();
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -209,7 +212,7 @@ public class CensusController {
.filter(index_ -> !"其他".equals(index_))
.collect(Collectors.toSet());
return type;
}).thenAccept(type -> {
}, executor).thenAccept(type -> {
SysDeptDTO deptDTO = sysDeptService.get(deptId);
result.add(new HashMap<String, Object>() {
{
@ -277,7 +280,7 @@ public class CensusController {
Set<String> type =
db.stream().flatMap(index_ -> Arrays.stream(index_.split(";"))).filter(index_ -> StringUtils.isNotEmpty(index_)).filter(index_ -> !"其他".equals(index_)).collect(Collectors.toSet());
return type;
}).thenAccept(type -> {
}, executor).thenAccept(type -> {
SysDeptDTO deptDTO = sysDeptService.get(deptId);
result.add(new HashMap<String, Object>() {
{

View File

@ -33,6 +33,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@ -43,7 +45,8 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/census/center/v2")
public class CensusControllerV2 {
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm * 2);
@Value("${project.place}")
private Integer projectPlace;
@Value("${project.higher}")
@ -78,7 +81,7 @@ public class CensusControllerV2 {
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
return sysUserService.countAllUser();
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -89,7 +92,7 @@ public class CensusControllerV2 {
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
return resourceService.countAllVisits();
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -125,7 +128,7 @@ public class CensusControllerV2 {
CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -135,7 +138,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> buildingApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE attr_type = '应用状态' AND attr_value = '建设中';", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -145,7 +148,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> endApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE attr_type = '应用状态' AND attr_value = '停用';", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -183,7 +186,7 @@ public class CensusControllerV2 {
String sql = String.format("SELECT COUNT(id) FROM tb_data_resource WHERE dept_id = %s AND type = '应用资源' AND del_flag = 0;", index.get("id").toString());
logger.info(sql);
Long count = jdbcTemplate.queryForObject(sql, Long.class);
if (!"0" .equals(index.get("pid").toString()) && higher) { // 有上级部门 配置资源归属上级
if (!"0".equals(index.get("pid").toString()) && higher) { // 有上级部门 配置资源归属上级
Optional<SysDeptDTO> sysDeptDTO =
Optional.ofNullable(sysDeptService.get(Long.valueOf(index.get("pid").toString())));
if (sysDeptDTO.isPresent() && sysDeptDTO.get().getType() != null && sysDeptDTO.get().getType() >= 2) {
@ -225,7 +228,7 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -235,7 +238,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '智能算法' AND attr_type = '组件类型')", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -245,7 +248,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '图层服务' AND attr_type = '组件类型')", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -255,7 +258,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '业务组件' AND attr_type = '组件类型')", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -265,7 +268,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '开发组件' AND attr_type = '组件类型')", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -285,7 +288,7 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -295,7 +298,7 @@ public class CensusControllerV2 {
});
CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量
return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum == null ? 0L : sum);
@ -326,8 +329,10 @@ public class CensusControllerV2 {
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
Map map = (Map) resourceService.selectTotal();
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
return dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
}).thenAccept(sum -> {
return dbAmount.stream().filter(index -> "基础设施".equals(index.get("type").toString()))
.mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -340,7 +345,7 @@ public class CensusControllerV2 {
case BAOTOU: { // 包头
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
@ -370,7 +375,7 @@ public class CensusControllerV2 {
logger.error("青岛西海岸失败", exception);
}
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
}).thenAccept(sum -> {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);

View File

@ -17,19 +17,19 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 全局统计中心 V3对应2022-06-23能力统计列表和详情切图
*
* @author ytl
* @Date 2022/6/23 14:04
**/
@ -49,6 +49,7 @@ public class CensusControllerV3 {
/**
* 五大资源之发布情况统计
* 组件服务 应用资源 基础设施 数据资源 知识库
*
* @param
* @return
*/
@ -58,27 +59,27 @@ public class CensusControllerV3 {
@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 = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String"),
})
public Result<PageData<Map<String, Object>>> resourceAssemblerDetails(@ApiIgnore @RequestParam Map<String, Object> params){
public Result<PageData<Map<String, Object>>> resourceAssemblerDetails(@ApiIgnore @RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if(StringUtils.equals(user.getUsername(),"admin")){
params.put("id",0);
}else{
if (StringUtils.equals(user.getUsername(), "admin")) {
params.put("id", 0);
} else {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if(StringUtils.equals(sysDeptDTO.getName(),qddsjj)){
params.put("id",0);
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){
params.put("id",sysDeptDTO.getPid());
}else{
params.put("id",sysDeptDTO.getId());
if (StringUtils.equals(sysDeptDTO.getName(), qddsjj)) {
params.put("id", 0);
} else if (StringUtils.contains(sysDeptDTO.getName(), "大数据") && sysDeptDTO.getType() == 3) {
params.put("id", sysDeptDTO.getPid());
} else {
params.put("id", sysDeptDTO.getId());
}
}
String type = params.get("resourceType").toString();
List<Map<String,Object>> list = new ArrayList<>();
List<Map<String, Object>> list = new ArrayList<>();
switch (type){
switch (type) {
case "组件服务":
PageData<Map<String, Object>> pageData = resourceService.resourceBusinessDetails(params);
return new Result<PageData<Map<String, Object>>>().ok(pageData);
@ -105,27 +106,27 @@ public class CensusControllerV3 {
@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 = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String"),
})
public Result<PageData<Map<String, Object>>> resourceUsedDetails(@ApiIgnore @RequestParam Map<String, Object> params){
public Result<PageData<Map<String, Object>>> resourceUsedDetails(@ApiIgnore @RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if(StringUtils.equals(user.getUsername(),"admin")){
params.put("id",0);
}else{
if (StringUtils.equals(user.getUsername(), "admin")) {
params.put("id", 0);
} else {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if(StringUtils.equals(sysDeptDTO.getName(),qddsjj)){
params.put("id",0);
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){
params.put("id",sysDeptDTO.getPid());
}else{
params.put("id",sysDeptDTO.getId());
if (StringUtils.equals(sysDeptDTO.getName(), qddsjj)) {
params.put("id", 0);
} else if (StringUtils.contains(sysDeptDTO.getName(), "大数据") && sysDeptDTO.getType() == 3) {
params.put("id", sysDeptDTO.getPid());
} else {
params.put("id", sysDeptDTO.getId());
}
}
String type = params.get("resourceType").toString();
List<Map<String,Object>> list = new ArrayList<>();
List<Map<String, Object>> list = new ArrayList<>();
switch (type){
switch (type) {
case "组件服务":
PageData<Map<String, Object>> pageData = resourceService.resourceBusinessUseDetails(params);
return new Result<PageData<Map<String, Object>>>().ok(pageData);
@ -149,6 +150,7 @@ public class CensusControllerV3 {
/**
* 发布组件评分情况 1 2 3 4 5评分分布
*
* @param
* @return
*/
@ -157,10 +159,10 @@ public class CensusControllerV3 {
@LogOperation("组件评分情况")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerScoreInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] args = {params.get("resourceType"),params.get("id"),params.get("id")};
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerScoreInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] args = {params.get("resourceType"), params.get("id"), params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(a.score) as scoreNum,a.score FROM tb_resource_score a INNER JOIN tb_data_resource b\n" +
"ON a.resource_id = b.id INNER JOIN sys_dept c ON b.dept_id = c.id\n" +
"WHERE a.del_flag = 0 AND a.score is not null AND b.type = ? AND b.del_flag = 0\n" +
@ -173,7 +175,7 @@ public class CensusControllerV3 {
@ApiOperation("TOP5被调用的组件和数量")
@LogOperation("TOP5被调用的组件和数量")
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long")
public Result<List<Map<String, Object>>> assemblerUsedTopInfo(Long id){
public Result<List<Map<String, Object>>> assemblerUsedTopInfo(Long id) {
return null;
}
@ -183,10 +185,10 @@ public class CensusControllerV3 {
@LogOperation("TOP5被申请的组件和数量")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerCaredTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] args = {params.get("id"),params.get("id"),params.get("resourceType")};
public Result<List<Map<String, Object>>> assemblerCaredTopInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] args = {params.get("id"), params.get("id"), params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT a.resource_id,b.name,COUNT(a.id) AS resourceCarNum FROM tb_resource_car a \n" +
" INNER JOIN tb_data_resource b ON a.resource_id = b.id\n" +
@ -206,16 +208,16 @@ public class CensusControllerV3 {
@LogOperation("算法、图层、开发、业务发布量情况分布")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUsedInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
public Result<List<Map<String, Object>>> assemblerUsedInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("id"), params.get("id"), params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(b.attr_value) as nums,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id\n" +
"INNER JOIN sys_dept c ON a.dept_id = c.id \n" +
"WHERE (c.id = ? OR INSTR(c.pids,?)) and a.type = ? and b.attr_type = '组件类型'\n" +
"WHERE a.del_flag = 0 AND b.del_flag = 0 AND (c.id = ? OR INSTR(c.pids,?)) and a.type = ? and b.attr_type = '组件类型'\n" +
"GROUP BY b.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@ -223,6 +225,7 @@ public class CensusControllerV3 {
/**
* 使用次数是去tb_data_resource_rel查
*
* @param params
* @return
*/
@ -231,10 +234,10 @@ public class CensusControllerV3 {
@LogOperation("TOP5使用组件")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("id"), params.get("id"), params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(c.id) as useNum,c.name FROM \n" +
"(\n" +
"\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" +
@ -243,7 +246,7 @@ public class CensusControllerV3 {
"INNER JOIN tb_data_resource_rel b ON a.id = b.key_id INNER JOIN tb_data_resource c ON b.reference_id = c.id\n" +
"WHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 GROUP BY c.name ORDER BY useNum desc limit 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@GetMapping("/assemblerUseInfo")
@ -251,10 +254,10 @@ public class CensusControllerV3 {
@LogOperation("使用组件数量分布(算法、图层、开发、业务")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("id"), params.get("id"), params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(n.id) AS num,n.attr_value FROM\n" +
"(\n" +
"\tSELECT DISTINCT(c.id) AS id,c.name FROM \n" +
@ -267,15 +270,15 @@ public class CensusControllerV3 {
"\t \n" +
") m INNER JOIN tb_data_attr n ON m.id = n.data_resource_id WHERE n.del_flag = 0 AND n.attr_type = '组件类型' GROUP BY n.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@GetMapping("/assemblerUseProjectInfo")
@ApiOperation("应用贡献组件数量分布(算法、图层、开发、业务)")
@LogOperation("应用贡献组件数量分布(算法、图层、开发、业务)")
@ApiImplicitParam(name = "id", value = "部门的id", paramType = "query", required = true, dataType = "long")
public Result<List<Map<String, Object>>> assemblerUseProjectInfo(Long id){
Object[] ps = {id,id};
public Result<List<Map<String, Object>>> assemblerUseProjectInfo(Long id) {
Object[] ps = {id, id};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(c.id) as num,c.attr_value FROM \n" +
"(SELECT a.id,a.name FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id WHERE (b.id = ? OR INSTR(b.pids,?))\n" +
"AND a.type = '应用资源' AND a.del_flag = 0) a \n" +
@ -283,15 +286,15 @@ public class CensusControllerV3 {
"INNER JOIN tb_data_attr c ON b.reference_id = c.data_resource_id\n" +
"WHERE c.attr_type = '应用类型' AND b.del_flag = 0 AND c.del_flag = 0 group by c.attr_value ", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@GetMapping("/assemblerUseNumProjectInfo")
@ApiOperation("应用贡献组件数量分布")
@LogOperation("应用贡献组件数量分布")
@ApiImplicitParam(name = "id", value = "部门的id", paramType = "query", required = true, dataType = "long")
public Result<List<Map<String, Object>>> assemblerUseNumProjectInfo(Long id){
Object[] ps = {id,id};
public Result<List<Map<String, Object>>> assemblerUseNumProjectInfo(Long id) {
Object[] ps = {id, id};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(distinct(b.reference_id)) as num,c.name FROM \n" +
"(SELECT m.id,m.name FROM tb_data_resource m INNER JOIN sys_dept n ON m.dept_id = n.id WHERE (n.id = ? OR INSTR(n.pids,?)) AND m.type = '应用资源' AND m.del_flag = 0) a \n" +
"INNER JOIN tb_data_resource_rel b ON a.id = b.key_id \n" +
@ -299,7 +302,7 @@ public class CensusControllerV3 {
"WHERE b.del_flag = 0 AND c.del_flag = 0 AND c.type='组件服务'\n" +
"group by c.name", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@GetMapping("/assemblerUseScoreTopInfo")
@ -307,10 +310,10 @@ public class CensusControllerV3 {
@LogOperation("使用组件评分top5")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("resourceType"), params.get("id"), params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT SUM(IFNULL(b.score,0)) as score,a.name FROM \n" +
"(\n" +
"\tSELECT DISTINCT(c.id) AS id,c.name FROM \n" +
@ -323,7 +326,7 @@ public class CensusControllerV3 {
")\ta \n" +
"INNER JOIN tb_resource_score b ON a.id = b.resource_id AND b.del_flag = 0 GROUP BY a.name ORDER BY score DESC LIMIT 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@ -332,10 +335,10 @@ public class CensusControllerV3 {
@LogOperation("应用领域分布情况")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String,Object>>> applicationAreaCapabilityList(@ApiIgnore @RequestParam Map<String, Object> params) {
return new Result<List<Map<String,Object>>>().ok(resourceService.applicationAreaCapabilityList(params));
public Result<List<Map<String, Object>>> applicationAreaCapabilityList(@ApiIgnore @RequestParam Map<String, Object> params) {
return new Result<List<Map<String, Object>>>().ok(resourceService.applicationAreaCapabilityList(params));
}
@ -344,32 +347,31 @@ public class CensusControllerV3 {
@LogOperation("使用组件应用领域分布情况")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String,Object>>> applicationUsedAreaCapabilityList(@ApiIgnore @RequestParam Map<String, Object> params) {
public Result<List<Map<String, Object>>> applicationUsedAreaCapabilityList(@ApiIgnore @RequestParam Map<String, Object> params) {
List<Map<String, Object>> maps = resourceService.applicationAreaCapabilityUseList(params);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
//以下是应用资源点击详情显示
@GetMapping("/applicationStateCapabilitySet")
@ApiOperation("应用状态分布情况")
@LogOperation("应用状态分布情况")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String,Object>>> applicationStateCapabilitySet(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("resourceType")};
public Result<List<Map<String, Object>>> applicationStateCapabilitySet(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("id"), params.get("resourceType")};
List<Map<String, Object>> result = jdbcTemplate.queryForList("SELECT COUNT(b.id) as num,b.attr_value as state from tb_data_resource a inner join tb_data_attr b\n" +
"on a.id = b.data_resource_id \n" +
"where a.del_flag = 0 and a.dept_id = ? and a.type = ? and b.attr_type = '应用状态'\n" +
"group by b.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(result);
return new Result<List<Map<String, Object>>>().ok(result);
}
@GetMapping("/applicationReleaseCapabilitySet")
@ -377,10 +379,10 @@ public class CensusControllerV3 {
@LogOperation("发布端应用分布情况")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String,Object>>> applicationReleaseCapabilitySet(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
public Result<List<Map<String, Object>>> applicationReleaseCapabilitySet(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("resourceType"), params.get("id"), params.get("id")};
List<Map<String, Object>> result = jdbcTemplate.queryForList("select m.attr_value as publisher,count(m.id) as num from \n" +
"(\n" +
"SELECT a.id,substring_index( a.attr_value, ';', b.help_topic_id +1 ),substring_index( substring_index( a.attr_value, ';', b.help_topic_id+1 ), ';',- 1 ) AS attr_value FROM \n" +
@ -393,21 +395,22 @@ public class CensusControllerV3 {
"\n" +
") m GROUP BY m.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(result);
return new Result<List<Map<String, Object>>>().ok(result);
}
@GetMapping("/applicationUsedCapabilityNum")
@ApiOperation("贡献组件分别被多少应用使用")
@LogOperation("贡献组件分别被多少应用使用")
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long")
public Result<List<Map<String,Object>>> applicationUsedCapabilityNum(Long id){
Object[] ps = {id,id};
public Result<List<Map<String, Object>>> applicationUsedCapabilityNum(Long id) {
Object[] ps = {id, id};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(distinct(a.key_id)) as appNum,c.attr_value FROM (\n" +
"SELECT a.key_id ,a.reference_id FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.key_id = b.id INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.del_flag = 0 AND (c.id = ? OR INSTR(c.pids,?)) ORDER BY a.key_id \n" +
") a \n" +
"INNER JOIN tb_data_resource b ON a.reference_id = b.id INNER JOIN tb_data_attr c ON a.reference_id = c.data_resource_id \n" +
"WHERE c.attr_type = '组件类型' GROUP BY c.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
return new Result<List<Map<String, Object>>>().ok(maps);
}
//以下是基础设施和数据资源使用情况点击详情申请明细
@ -417,40 +420,42 @@ public class CensusControllerV3 {
@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 = "id",value = "行政部门编号", paramType = "query", dataType = "Long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "id", value = "行政部门编号", paramType = "query", dataType = "Long"),
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String"),
})
public Result<List<Map<String, Object>>> assemblerCarDetail(@ApiIgnore @RequestParam Map<String, Object> params){
List<Map<String,Object>> result = resourceService.assemblerCarDetail(params);
public Result<List<Map<String, Object>>> assemblerCarDetail(@ApiIgnore @RequestParam Map<String, Object> params) {
List<Map<String, Object>> result = resourceService.assemblerCarDetail(params);
return new Result<List<Map<String,Object>>>().ok(result);
return new Result<List<Map<String, Object>>>().ok(result);
}
//以下是知识库点击详情展示
@GetMapping("/knowledgeBaseDistriDetail")
@ApiOperation("知识库分布情况")
@LogOperation("知识库分布情况")
@ApiImplicitParam(name = "id",value = "行政部门编号", paramType = "query", dataType = "Long")
public Result<List<Map<String, Object>>> knowledgeBaseDistriDetail(Long id){
List<Map<String,Object>> result = new ArrayList<>();
Object[] ps = {id,id};
@ApiImplicitParam(name = "id", value = "行政部门编号", paramType = "query", dataType = "Long")
public Result<List<Map<String, Object>>> knowledgeBaseDistriDetail(Long id) {
List<Map<String, Object>> result = new ArrayList<>();
Object[] ps = {id, id};
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS num,a.attr_value FROM tb_data_attr a INNER JOIN tb_data_resource b ON a.data_resource_id = b.id\n" +
"INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.attr_type = '文件类型' AND b.type = '知识库' AND b.del_flag = 0 AND \n" +
"(c.ID = ? OR INSTR(c.pids,?)) GROUP BY a.attr_value",ps);
"INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.attr_type = '文件类型' AND a.del_flag = 0 AND b.type = '知识库' AND b.del_flag = 0 AND \n" +
"(c.ID = ? OR INSTR(c.pids,?)) GROUP BY a.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(result);
return new Result<List<Map<String, Object>>>().ok(result);
}
@GetMapping("knowledgeBaseReleaseDetail")
@ApiOperation("知识库发布时间统计(按月)")
@LogOperation("知识库发布时间统计(按月)")
public Result<List<Map<String, Object>>> knowledgeBaseReleaseDetail(Long id){
Object[] ps = {id};
List<Map<String, Object>> result = jdbcTemplate.queryForList("SELECT COUNT(id) as num, MONTH(create_date) AS time FROM tb_data_resource \n" +
"WHERE type = '知识库' AND YEAR(create_date) = YEAR(CURDATE()) AND del_flag = 0 AND dept_id = ?\n" +
"GROUP BY YEAR(create_date),MONTH(create_date) ORDER BY MONTH(create_date)\n", ps);
public Result<List<Map<String, Object>>> knowledgeBaseReleaseDetail(Long id) {
Object[] ps = {id, id};
List<Map<String, Object>> result = jdbcTemplate.queryForList("SELECT COUNT(a.id) as num, MONTH(a.create_date) AS time FROM tb_data_resource a INNER JOIN sys_dept b \n" +
"ON a.dept_id = b.id \n" +
"WHERE a.type = '知识库' AND YEAR(a.create_date) = YEAR(CURDATE()) AND a.del_flag = 0 \n" +
"AND (b.id = ? OR INSTR(b.pids,?))\n" +
"GROUP BY YEAR(a.create_date),MONTH(a.create_date) ORDER BY MONTH(a.create_date)", ps);
return new Result<List<Map<String,Object>>>().ok(result);
return new Result<List<Map<String, Object>>>().ok(result);
}
}

View File

@ -26,11 +26,15 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Api(tags = "评论审核")
@RestController
@RequestMapping("/comment/center")
public class CommentController {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static final ObjectMapper oMapper = new ObjectMapper();
@Autowired
@ -97,7 +101,7 @@ public class CommentController {
if (Long.valueOf(dto.getBusinessKey()) != null) {
jdbcTemplate.update(String.format("UPDATE t_demand_comment SET instance_id = '%s' WHERE id = %s", dto.getProcessInstanceId(), dto.getBusinessKey()));
}
});
}, executor);
return new Result<ProcessInstanceDTO>().ok(dto);
}
}

View File

@ -70,4 +70,11 @@ public class ProcessInstanceDTO {
@ApiModelProperty(value = "流程被驳回到第一个用户任务?")
private Boolean backToFirst = Boolean.FALSE;
@ApiModelProperty(value = "流程中是否存在拒绝?")
private Boolean reject = Boolean.FALSE;
@ApiModelProperty(value = "流程直接被终止?")
private Boolean termination = Boolean.FALSE;
}

View File

@ -79,4 +79,11 @@ public class TaskDTO {
@ApiModelProperty(value = "流程被驳回到第一个用户任务?")
private Boolean backToFirst = null;
@ApiModelProperty(value = "流程中是否存在拒绝?")
private Boolean reject = null;
@ApiModelProperty(value = "流程直接被终止?")
private Boolean termination = null;
}

View File

@ -338,6 +338,8 @@ public class ActHistoryService {
}
taskDTOList.add(taskDTO);
dto.setBackToFirst(taskDTO.getBackToFirst());
dto.setReject(taskDTO.getReject());
dto.setTermination(taskDTO.getTermination());
}
dto.setCurrentTaskList(taskDTOList);
}
@ -373,6 +375,12 @@ public class ActHistoryService {
if (dto.getParams() != null && dto.getParams().containsKey("backToFirst") && dto.getParams().get("backToFirst") != null) {
dto.setBackToFirst(Boolean.valueOf(dto.getParams().get("backToFirst").toString()));
}
if (dto.getParams() != null && dto.getParams().containsKey("reject") && dto.getParams().get("reject") != null) {
dto.setReject(Boolean.valueOf(dto.getParams().get("reject").toString()));
}
if (dto.getParams() != null && dto.getParams().containsKey("termination") && dto.getParams().get("termination") != null) {
dto.setTermination(Boolean.valueOf(dto.getParams().get("backToFirst").toString()));
}
}
public ProcessInstanceDTO getHistoryProcessInstanceByBusinessKey(String procDefKey, String businessKey) {

View File

@ -20,9 +20,13 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Service
public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category, CategoryDTO> implements CategoryService {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
@Autowired
private CategoryDao categoryDao;
@ -44,7 +48,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(index, dto);
list.add(dto);
}))
}, executor))
);
CompletableFuture.allOf(completableFutureLis.toArray(new CompletableFuture[completableFutureLis.size()])).join();
return getAllCategory(list);
@ -68,7 +72,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
});
categoryDto.setIsLeaf("N");
categoryDto.setChildren(getAllCategory(list));
});
}, executor);
tasks.add(task);
}
}

View File

@ -53,6 +53,7 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit
private TDemandCommentService tDemandCommentService;
@Override
@ActivitiNoticeOperation(value = "流程结束", process = "需求评论审核流程", type = 2)
public void notify(DelegateExecution delegateExecution) throws Exception {
logger.error("----------------------进入审批结束节点---------------------------");
delegateExecution.getProcessBusinessKey();

View File

@ -23,6 +23,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
@ -33,6 +35,8 @@ import java.util.stream.Collectors;
*/
@Service
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
@Autowired
private TDemandDataService tDemandDataService;
@Autowired
@ -88,9 +92,8 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
CompletableFuture.runAsync(() -> { // 发起人
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject()
// + "有新的评论,请前往查看详情"
;
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + " 您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject()
+ "有新的评论";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("需求评论系统通知");
@ -104,7 +107,7 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
dto.setCreateDate(new Date());
dto.setFrom("评论");
sysNoticeService.save(dto);
});
}, executor);
}
}
}

View File

@ -0,0 +1,90 @@
package io.renren.modules.fuse.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.fuse.dto.TbFuseDTO;
import io.renren.modules.fuse.service.TbFuseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
* 融合服务
*
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@RestController
@RequestMapping("fuse")
@Api(tags="融合服务")
public class FuseController {
@Autowired
private TbFuseService tbFuseService;
@GetMapping("page")
@ApiOperation("分页")
@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"),
@ApiImplicitParam(name = "name", value = "融合服务名称", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType="int"),
@ApiImplicitParam(name = "deptUser", value = "部门联系人", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "mobile", value = "部门联系人电话", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "provider", value = "服务商", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "providerUser", value = "服务商联系人", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "providerMobile", value = "服务商联系人电话", paramType = "query", dataType="String")
})
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbFuseDTO> page = tbFuseService.page(params);
return new Result<PageData<TbFuseDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<TbFuseDTO> get(@PathVariable("id") Long id){
return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody TbFuseDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return new Result().ok(tbFuseService.addFuse(dto));
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody TbFuseDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
return new Result().ok(tbFuseService.updateFuse(dto));
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long id){
return new Result().ok(tbFuseService.deleteFuse(id));
}
}

View File

@ -0,0 +1,23 @@
package io.renren.modules.fuse.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.fuse.dto.TbFuseAttrDTO;
import io.renren.modules.fuse.entity.TbFuseAttrEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/7/3
* @des
*/
@Mapper
public interface TbFuseAttrDao extends BaseDao<TbFuseAttrEntity> {
int insertBatch(List<TbFuseAttrDTO> list);
int deleteByFuseId(@Param(value = "fuseId") Long fuseId);
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.fuse.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.fuse.entity.TbFuseEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@Mapper
public interface TbFuseDao extends BaseDao<TbFuseEntity> {
}

View File

@ -0,0 +1,24 @@
package io.renren.modules.fuse.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.fuse.dto.TbFuseResourceDTO;
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@Mapper
public interface TbFuseResourceDao extends BaseDao<TbFuseResourceEntity> {
int insertBatch(List<TbFuseResourceDTO> list);
int deleteByFuseId(@Param(value = "fuseId") Long fuseId);
}

View File

@ -0,0 +1,26 @@
package io.renren.modules.fuse.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/7/3
* @des
*/
@Data
@ApiModel(value = "融合资源属性表")
public class TbFuseAttrDTO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "融合服务id")
private Long fuseId;
@ApiModelProperty(value = "属性类型")
private String attrType;
@ApiModelProperty(value = "属性值")
private String attrValue;
}

View File

@ -0,0 +1,52 @@
package io.renren.modules.fuse.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@Data
@ApiModel(value = "融合服务表")
public class TbFuseDTO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "融合服务名称")
private String name;
@ApiModelProperty(value = "融合服务描述")
private String description;
@ApiModelProperty(value = "应用领域")
private String applicationArea;
@ApiModelProperty(value = "所属部门")
private Long deptId;
@ApiModelProperty(value = "部门联系人")
private String deptUser;
@ApiModelProperty(value = "部门联系人电话")
private String mobile;
@ApiModelProperty(value = "服务商")
private String provider;
@ApiModelProperty(value = "服务商联系人")
private String providerUser;
@ApiModelProperty(value = "服务商联系人电话")
private String providerMobile;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "资源融合关系")
private List<TbFuseResourceDTO> fuseResourceList;
@ApiModelProperty(value = "融合资源属性")
private List<TbFuseAttrDTO> fuseAttrList;
}

View File

@ -0,0 +1,26 @@
package io.renren.modules.fuse.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/7/3
* @des
*/
@Data
@ApiModel(value = "资源融合关系表")
public class TbFuseResourceDTO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "融合服务id")
private Long fuseId;
@ApiModelProperty(value = "资源id")
private Long resourceId;
@ApiModelProperty(value = "资源挂载顺序")
private String sequence;
}

View File

@ -0,0 +1,36 @@
package io.renren.modules.fuse.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 融合资源属性表
*
* @Auther:lizhicheng2@hisense.com
* @date:2022/7/3
* @des
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_fuse_attr")
public class TbFuseAttrEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 融合服务id
*/
private Long fuseId;
/**
* 属性类型
*/
private String attrType;
/**
* 属性值
*/
private String attrValue;
}

View File

@ -0,0 +1,81 @@
package io.renren.modules.fuse.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 融合服务表
*
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_fuse")
public class TbFuseEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 融合服务名称
*/
private String name;
/**
* 融合服务描述
*/
private String description;
/**
* 应用领域
*/
private String applicationArea;
/**
* 所属部门
*/
private Long deptId;
/**
* 部门联系人
*/
private String deptUser;
/**
* 部门联系人电话
*/
private String mobile;
/**
* 服务商
*/
private String provider;
/**
* 服务商联系人
*/
private String providerUser;
/**
* 服务商联系人电话
*/
private String providerMobile;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
}

View File

@ -0,0 +1,36 @@
package io.renren.modules.fuse.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 资源融合关系表
*
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_fuse_resource")
public class TbFuseResourceEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 融合服务id
*/
private Long fuseId;
/**
* 资源id
*/
private Long resourceId;
/**
* 顺序
*/
private String sequence;
}

View File

@ -0,0 +1,24 @@
package io.renren.modules.fuse.service;
import io.renren.common.service.CrudService;
import io.renren.modules.fuse.dto.TbFuseDTO;
import io.renren.modules.fuse.entity.TbFuseEntity;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
public interface TbFuseService extends CrudService<TbFuseEntity, TbFuseDTO> {
TbFuseDTO getFuseById(Long id);
Integer addFuse(TbFuseDTO dto);
Integer updateFuse(TbFuseDTO dto);
Integer deleteFuse(Long id);
}

View File

@ -0,0 +1,200 @@
package io.renren.modules.fuse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.fuse.dao.TbFuseAttrDao;
import io.renren.modules.fuse.dao.TbFuseDao;
import io.renren.modules.fuse.dao.TbFuseResourceDao;
import io.renren.modules.fuse.dto.TbFuseAttrDTO;
import io.renren.modules.fuse.dto.TbFuseDTO;
import io.renren.modules.fuse.dto.TbFuseResourceDTO;
import io.renren.modules.fuse.entity.TbFuseAttrEntity;
import io.renren.modules.fuse.entity.TbFuseEntity;
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
import io.renren.modules.fuse.service.TbFuseService;
import io.renren.modules.resource.service.impl.ResourceServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/6/30
* @des
*/
@Service
public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity, TbFuseDTO> implements TbFuseService {
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
@Autowired
private TbFuseDao fuseDao;
@Autowired
private TbFuseResourceDao fuseResourceDao;
@Autowired
private TbFuseAttrDao fuseAttrDao;
@Override
public QueryWrapper<TbFuseEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<TbFuseEntity> wrapper = new QueryWrapper<>();
params.keySet().stream().filter(index -> null != params.get(index)).forEach(index -> {
switch (index) {
case "name":
wrapper.like(StringUtils.isNotBlank(params.get("name").toString()), "name", params.get("name").toString());
break;
case "description":
wrapper.like(StringUtils.isNotBlank(params.get("description").toString()), "description", params.get("description").toString());
break;
case "applicationArea":
wrapper.like(StringUtils.isNotBlank(params.get("applicationArea").toString()), "application_area", params.get("applicationArea").toString());
break;
case "deptId":
wrapper.eq(StringUtils.isNotBlank(params.get("deptId").toString()), "dept_id", params.get("deptId").toString());
break;
case "deptUser":
wrapper.like(StringUtils.isNotBlank(params.get("deptUser").toString()), "dept_user", params.get("deptUser").toString());
break;
case "mobile":
wrapper.like(StringUtils.isNotBlank(params.get("mobile").toString()), "mobile", params.get("mobile").toString());
break;
case "provider":
wrapper.like(StringUtils.isNotBlank(params.get("provider").toString()), "provider", params.get("provider").toString());
break;
case "providerUser":
wrapper.like(StringUtils.isNotBlank(params.get("providerUser").toString()), "provider_user", params.get("providerUser").toString());
break;
case "providerMobile":
wrapper.like(StringUtils.isNotBlank(params.get("providerMobile").toString()), "provider_mobile", params.get("providerMobile").toString());
break;
case "creator":
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString());
break;
case "createDate":
wrapper.eq(StringUtils.isNotBlank(params.get("createDate").toString()), "create_date", params.get("createDate").toString());
break;
case "updater":
wrapper.eq(StringUtils.isNotBlank(params.get("updater").toString()), "updater", params.get("updater").toString());
break;
case "updateDate":
wrapper.eq(StringUtils.isNotBlank(params.get("updateDate").toString()), "update_date", params.get("updateDate").toString());
break;
}
});
return wrapper;
}
@Override
public PageData<TbFuseDTO> page(Map<String, Object> params){
IPage<TbFuseEntity> page = baseDao.selectPage(
getPage(params, null, false),
getWrapper(params)
);
List<TbFuseDTO> result=page.getRecords().stream().map(entity->{
TbFuseDTO dto=new TbFuseDTO();
BeanUtils.copyProperties(entity, dto);
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId()));
dto.setFuseAttrList(getAttrByFuseId(dto.getId()));
return dto;
}).collect(Collectors.toList());
return new PageData(result, page.getTotal());
}
@Override
public TbFuseDTO getFuseById(Long id) {
TbFuseEntity fuseEntity = fuseDao.selectById(id);
TbFuseDTO fuseDTO = new TbFuseDTO();
BeanUtils.copyProperties(fuseEntity, fuseDTO);
fuseDTO.setFuseAttrList(getAttrByFuseId(id));
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id));
return fuseDTO;
}
private List<TbFuseAttrDTO> getAttrByFuseId(Long fuseId) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("fuse_id", fuseId);
List<TbFuseAttrEntity> list = fuseAttrDao.selectList(wrapper);
return list.stream().map(attr -> {
TbFuseAttrDTO dto = new TbFuseAttrDTO();
BeanUtils.copyProperties(attr, dto);
return dto;
}).collect(Collectors.toList());
}
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("fuse_id", fuseId);
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
return list.stream().map(attr -> {
TbFuseResourceDTO dto = new TbFuseResourceDTO();
BeanUtils.copyProperties(attr, dto);
return dto;
}).collect(Collectors.toList());
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer addFuse(TbFuseDTO dto) {
TbFuseEntity fuseEntity = new TbFuseEntity();
BeanUtils.copyProperties(dto, fuseEntity);
int result=fuseDao.insert(fuseEntity);
dto.getFuseResourceList().forEach(fuseResourceDTO->{
fuseResourceDTO.setId(IdWorker.getId(fuseResourceDTO));
fuseResourceDTO.setFuseId(fuseEntity.getId());
TbFuseResourceEntity entity=new TbFuseResourceEntity();
BeanUtils.copyProperties(fuseResourceDTO, entity);
fuseResourceDao.insert(entity);
});
dto.getFuseAttrList().forEach(fuseAttrDTO -> {
fuseAttrDTO.setId(IdWorker.getId(fuseAttrDTO));
fuseAttrDTO.setFuseId(fuseEntity.getId());
TbFuseAttrEntity entity=new TbFuseAttrEntity();
BeanUtils.copyProperties(fuseAttrDTO, entity);
fuseAttrDao.insert(entity);
});
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateFuse(TbFuseDTO dto) {
TbFuseEntity fuseEntity = new TbFuseEntity();
BeanUtils.copyProperties(dto, fuseEntity);
fuseResourceDao.deleteByFuseId(fuseEntity.getId());
dto.getFuseResourceList().forEach(fuseResourceDTO->{
fuseResourceDTO.setId(IdWorker.getId(fuseResourceDTO));
fuseResourceDTO.setFuseId(fuseEntity.getId());
TbFuseResourceEntity entity=new TbFuseResourceEntity();
BeanUtils.copyProperties(fuseResourceDTO, entity);
fuseResourceDao.insert(entity);
});
fuseAttrDao.deleteByFuseId(fuseEntity.getId());
dto.getFuseAttrList().forEach(fuseAttrDTO -> {
fuseAttrDTO.setId(IdWorker.getId(fuseAttrDTO));
fuseAttrDTO.setFuseId(fuseEntity.getId());
TbFuseAttrEntity entity=new TbFuseAttrEntity();
BeanUtils.copyProperties(fuseAttrDTO, entity);
fuseAttrDao.insert(entity);
});
return fuseDao.updateById(fuseEntity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer deleteFuse(Long id) {
fuseResourceDao.deleteByFuseId(id);
fuseAttrDao.deleteByFuseId(id);
return fuseDao.deleteById(id);
}
}

View File

@ -2,27 +2,30 @@ package io.renren.modules.gateway.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpMessageConverterExtractor;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.RestTemplate;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
@Controller
@Api(tags = "网关统计")
@ -38,14 +41,17 @@ public class MonitorController {
@Value("${server.servlet.context-path}")
private String context_path;
@RequestMapping("/metrics/**")
// @RequestMapping("/metrics/**")
void forward(HttpServletRequest request, HttpServletResponse response) throws IOException {
//类似nginx匹配前缀
String location = "/juapi";
String requestURI = request.getRequestURI();
requestURI = requestURI.replace( context_path,"");
String url = gatewayDomain + location + requestURI + "?" + request.getQueryString() ;
String url = gatewayDomain + location + requestURI ;
if (StringUtils.isNotBlank(request.getQueryString())) {
url = url + "?" + request.getQueryString();
}
HttpMethod httpMethod = HttpMethod.valueOf(request.getMethod());
HttpHeaders headers = new HttpHeaders();
@ -71,13 +77,6 @@ public class MonitorController {
}else {
httpEntity = new HttpEntity(headers);
}
// RequestCallback requestCallback = restTemplate.httpEntityCallback(httpEntity, byte[].class);
// HttpMessageConverterExtractor<byte[]> responseExtractor =
// new HttpMessageConverterExtractor<>(byte[].class, Collections.singletonList(new ByteArrayHttpMessageConverter()));
//
// byte[] body = restTemplate.execute(url, httpMethod, requestCallback, responseExtractor);
ResponseEntity<byte[]> responseEntity = restTemplate.exchange(url, httpMethod, httpEntity, byte[].class, new HashMap());
@ -90,7 +89,51 @@ public class MonitorController {
byte[] body = responseEntity.getBody();
response.getOutputStream().write(body);
}
@GetMapping("/metrics/**")
@ApiOperation("前端访问图片请求转发")
public void ford(HttpServletRequest request, HttpServletResponse response){
String location = "/juapi";
String requestURI = request.getRequestURI();
requestURI = requestURI.replace( context_path,"");
String fordUrl = gatewayDomain + location + requestURI ;
if (StringUtils.isNotBlank(request.getQueryString())) {
fordUrl = fordUrl + "?" + request.getQueryString();
}
URLConnection con;
try {
URL url = new URL(fordUrl);
con = url.openConnection();
//允许写出
con.setDoOutput(true);
//允许读入
con.setDoInput(true);
//不使用缓存
con.setUseCaches(false);
//得到响应流
InputStream inputStream = con.getInputStream();
Map<String, List<String>> headerFields = con.getHeaderFields();
headerFields.forEach((key, heads) -> {
if (headerFields.isEmpty()) return;
response.setHeader(key, heads.get(0));
});
ServletOutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
int len = inputStream.read(buffer);
while (len != -1) {
outputStream.write(buffer, 0, len);
len = inputStream.read(buffer);
}
inputStream.close();
}catch(Exception e) {
e.printStackTrace();
}
}
}

View File

@ -37,10 +37,14 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Service
@Log4j2
public class MonitorService {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
@Autowired
private RestTemplate restTemplate;
@ -92,7 +96,7 @@ public class MonitorService {
log.warn("摄像头登录异常,跳过", e);
}
return null;
});
}, executor);
}
public String monitorLogin() {
@ -768,15 +772,15 @@ public class MonitorService {
cameraOrgenMapper.insert(cameraOrganization);
videoService((String) result.get("id"), path + sep + result.get("name"));
} else if (result.get("channelId") != null) {
CameraChannel cameraChannel = JSONObject.parseObject(JSONObject.toJSONString(result), CameraChannel.class);
String id = (String) result.get("orgCode");
if (path != null && path.startsWith(sep)) {
path = path.substring(sep.length());
}
cameraChannel.setNodeName(path);
cameraChannel.setParentId(id);
cameraChannelMapper.insert(cameraChannel);
CameraChannel cameraChannel = JSONObject.parseObject(JSONObject.toJSONString(result), CameraChannel.class);
String id = (String) result.get("orgCode");
if (path != null && path.startsWith(sep)) {
path = path.substring(sep.length());
}
cameraChannel.setNodeName(path);
cameraChannel.setParentId(id);
cameraChannelMapper.insert(cameraChannel);
}
}
}

View File

@ -36,7 +36,6 @@ import java.util.Date;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* 部门动态审批人
@ -140,11 +139,10 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
abilityApplicationDTO.setApproveStatus("通过");
tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批通过申请id:" + abilityApplicationDTO.getId());
CompletableFuture.runAsync(() -> {
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + abilityApplicationDTO.getResourceId());
});
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + abilityApplicationDTO.getResourceId());
}
}
}

View File

@ -45,6 +45,8 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
@ -57,6 +59,7 @@ import java.util.stream.Collectors;
@RequestMapping("/resource")
@Api(tags = "资源表")
public class ResourceController {
private Integer cpuNUm = Runtime.getRuntime().availableProcessors();
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
@ -162,13 +165,14 @@ public class ResourceController {
*/
@GetMapping("/updateTest")
public Result<String> updateTest() {
final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
CompletableFuture.runAsync(() -> {
List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM tb_data_resource", Long.class);
ids.stream().forEach(id -> {
ResourceDTO data = resourceService.selectWithAttrs(id);
resourceService.update(data);
});
});
}, executor);
return new Result<String>().ok(LocalDateTime.now().toString());
}

View File

@ -127,4 +127,7 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectInfrastructureList();
void createMixAbility(ResourceDTO dto);
}

View File

@ -25,12 +25,14 @@ import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dao.AttrDao;
import io.renren.modules.resource.dao.ResourceDao;
import io.renren.modules.resource.dao.TbDataResourceRelDao;
import io.renren.modules.resource.dataResource.domain.TsingtaoDataResourceService;
import io.renren.modules.resource.dto.GetDataResourceListDto;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.entity.ResourceEntity;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.renren.modules.resource.entity.TbDataResourceRelEntity;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.dao.ResourceBrowseDao;
import io.renren.modules.resourceBrowse.entity.ResourceBrowseEntity;
@ -68,9 +70,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -83,6 +83,7 @@ import java.util.stream.Collectors;
*/
@Service
public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEntity, ResourceDTO> implements ResourceService {
private Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
@ -171,6 +172,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private SysDeptService deptService;
@Autowired
private TbDataResourceRelDao tbDataResourceRelDao;
@Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>();
@ -224,6 +228,86 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
attrEntities_.add(item);
});
}
// 增加组件关联应用逻辑 传入应用id数组
if ("组件服务".equalsIgnoreCase(dto.getType()) || "应用资源".equalsIgnoreCase(dto.getType())) {
for (AttrEntity attrEntity : resourceEntity.getInfoList()) {
if ("来源应用".equalsIgnoreCase(attrEntity.getAttrType())) {
if (StringUtils.isNotBlank(attrEntity.getAttrValue())) {
String[] ids = attrEntity.getAttrValue().split(",");
if (ids.length != 0) {
List<TbDataResourceRelEntity> resourceRels = new ArrayList<>();
for (String keyid : ids) {
TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity();
resourceRel.setKeyId(Long.valueOf(keyid));
resourceRel.setReferenceId(resourceID);
tbDataResourceRelDao.insert(resourceRel);
}
}
}
}
if ("关联组件信息".equalsIgnoreCase(attrEntity.getAttrType())) {
if (StringUtils.isNotBlank(attrEntity.getAttrValue())) {
String[] ids = attrEntity.getAttrValue().split(",");
if (ids.length != 0) {
List<TbDataResourceRelEntity> resourceRels = new ArrayList<>();
for (String keyid : ids) {
TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity();
resourceRel.setKeyId(resourceID);
resourceRel.setReferenceId(Long.valueOf(keyid));
tbDataResourceRelDao.insert(resourceRel);
}
}
}
}
}
}
resourceEntity.setInfoList(attrEntities_);
resourceDao.updateById(resourceEntity);
}
@Override
@Transactional
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
public void createMixAbility(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
Long resourceID = IdWorker.getId(resourceEntity);
resourceEntity.setId(resourceID);
resourceEntity.setVisits(0L);
if (dto.getDelFlag() == null) {
resourceEntity.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
}
resourceDao.insert(resourceEntity);
BeanUtils.copyProperties(resourceEntity, dto);
List<AttrEntity> attrEntities = dto.getInfoList();
List<AttrEntity> attrEntities_ = new ArrayList<>();
if (attrEntities != null) {
attrEntities.forEach(item -> {
item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
item.setDataResourceId(resourceID);
attrDao.insert(item);
attrEntities_.add(item);
});
}
for (AttrEntity attrEntity : resourceEntity.getInfoList()) {
if ("融合服务".equalsIgnoreCase(attrEntity.getAttrType())) {
if (StringUtils.isNotBlank(attrEntity.getAttrValue())) {
String[] ids = attrEntity.getAttrValue().split(",");
if (ids.length != 0) {
List<TbDataResourceRelEntity> resourceRels = new ArrayList<>();
for (String keyid : ids) {
TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity();
resourceRel.setKeyId(Long.valueOf(keyid));
resourceRel.setReferenceId(resourceID);
tbDataResourceRelDao.insert(resourceRel);
}
}
}
}
}
resourceEntity.setInfoList(attrEntities_);
resourceDao.updateById(resourceEntity);
}
@ -608,11 +692,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
browseEntity.setUserId(SecurityUser.getUserId());
browseEntity.setState(0);
resourceBrowseDao.insert(browseEntity);
CompletableFuture.runAsync(() -> {
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + id);
});
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + id);
}
@Override
@ -671,6 +754,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Cacheable(value = selectDeptListKey, key = "#p1")
public Object selectDeptList(JSONObject jsonObject, String type) {
final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm * 2);
List<Map> resultList = new CopyOnWriteArrayList<>();
HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录");
@ -696,7 +780,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (integer != 0) {
resultList.add(map);
}
});
}, executor);
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
@ -720,7 +804,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
value.forEach(item1 -> item1.remove("type"));
map.put("dataList", value);
areaListTemp.add(map);
});
}, executor);
tasksArea.add(task);
});
CompletableFuture.allOf(tasksArea.toArray(new CompletableFuture[tasksArea.size()])).join();
@ -1251,7 +1335,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
"WHERE a.type = '基础设施' AND a.del_flag = 0\n" +
"GROUP BY a.dept_id,b.name\n" +
"ORDER BY a.dept_id,b.name\n", pas);
"ORDER BY a.dept_id,b.name\n");
} else {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
@ -1409,8 +1493,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return new PageData<>(list, list.size());
}
Map<String, Object> paraMap = new ConcurrentHashMap<>();
paraMap.put("resourceType", params.get("resourceType"));
Map<String, Object> paraMap = new ConcurrentHashMap<>();
paraMap.put("resourceType", params.get("resourceType"));
//分别根据部门获取组件使用总数和调用数
//申请数
// CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
@ -1442,7 +1526,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//还缺少组件调用数,这先用假数据代替
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> {
m.put("resourceCallNum",0);
m.put("resourceCallNum", 0);
});
});

View File

@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
/**
* 能力收藏表

View File

@ -15,7 +15,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
/**
* 能力评分表
@ -34,11 +33,9 @@ public class ResourceScoreServiceImpl extends CrudServiceImpl<ResourceScoreDao,
@Override
public void save(ResourceScoreDTO dto) {
super.save(dto);
CompletableFuture.runAsync(() -> {
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + dto.getResourceId());
});
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + dto.getResourceId());
}

View File

@ -160,14 +160,6 @@ public class LoginController {
//退出
sysUserTokenService.logout(user.getId());
try {
if (yaweiEnable) {
//清理亚威登录状态
YaWeiCookieManage.clearnTicket(request, response);
}
} catch (Exception e) {
logger.error("清理亚威登录状态失败", e);
}
//用户信息
SysLogLoginEntity log = new SysLogLoginEntity();
log.setOperation(LoginOperationEnum.LOGOUT.value());

View File

@ -0,0 +1,33 @@
CREATE TABLE `tb_fuse` (
`id` bigint(20) NOT NULL COMMENT '主键',
`name` varchar(128) DEFAULT NULL COMMENT '融合服务名称',
`description` varchar(128) DEFAULT NULL COMMENT '融合服务描述',
`application_area` varchar(128) DEFAULT NULL COMMENT '应用领域',
`dept_id` bigint(20) DEFAULT NULL COMMENT '所属部门',
`dept_user` varchar(128) DEFAULT NULL COMMENT '部门联系人',
`mobile` varchar(20) DEFAULT NULL COMMENT '部门联系人电话',
`provider` varchar(128) DEFAULT NULL COMMENT '服务商',
`provider_user` varchar(128) DEFAULT NULL COMMENT '服务商联系人',
`provider_mobile` varchar(20) DEFAULT NULL COMMENT '服务商联系人电话',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint(20) DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='融合服务表';
CREATE TABLE `tb_fuse_resource` (
`id` bigint(20) NOT NULL COMMENT '主键',
`fuse_id` bigint(20) NOT NULL COMMENT '融合id',
`resource_id` bigint(20) NOT NULL COMMENT '资源id',
`sequence` varchar(10) DEFAULT NULL COMMENT '顺序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源融合关系表';
CREATE TABLE `tb_fuse_attr` (
`id` bigint(20) NOT NULL COMMENT '主键',
`fuse_id` bigint(20) DEFAULT NULL COMMENT '融合id',
`attr_type` varchar(128) DEFAULT NULL COMMENT '属性类型',
`attr_value` varchar(128) DEFAULT NULL COMMENT '属性值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='融合资源属性表';

File diff suppressed because one or more lines are too long

View File

@ -57,4 +57,13 @@
overflowToDisk="false"
memoryStoreEvictionPolicy="LRU"/>
<!-- getByToken缓存 -->
<cache name="getByToken"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="600"
overflowToDisk="true"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.fuse.dao.TbFuseAttrDao">
<insert id="insertBatch">
insert into tb_fuse_attr(id, fuse_id, attr_type, attr_value)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.fuseId}, #{attrType}, #{attrType})
</foreach>
</insert>
<delete id="deleteByFuseId">
delete
from tb_fuse_attr
where fuse_id = #{fuseId};
</delete>
</mapper>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.fuse.dao.TbFuseDao">
</mapper>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.fuse.dao.TbFuseResourceDao">
<insert id="insertBatch">
insert into tb_fuse_resource(id, fuse_id, resource_id, sequence)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.fuseId}, #{item.resourceId}, #{item.sequence})
</foreach>
</insert>
<delete id="deleteByFuseId">
delete
from tb_fuse_resource
where fuse_id = #{fuseId};
</delete>
</mapper>

View File

@ -104,7 +104,7 @@
AND car.user_id = #{userId}
AND res.dept_id = #{deptId}
AND car.del_flag = 0
UNION
UNION (
SELECT
car.id AS "id",
res.id AS "resourceId",
@ -123,8 +123,8 @@
AND car.resource_id = res.id
AND car.resource_id = 8888888880000000001
AND car.user_id = #{userId}
AND res.dept_id = #{deptId}
AND car.del_flag = 0
AND res.dept_id = 1067246875800000066
AND car.del_flag = 0)
LIMIT ${pageNum}, ${pageSize}
</select>

View File

@ -19,7 +19,7 @@ public class RedisTest {
@Test
public void contextLoads() {
System.out.println(PasswordUtils.encode("admin"));
System.out.println(PasswordUtils.encode("hx12345."));
}
}

View File

@ -4,6 +4,8 @@ import io.renren.common.service.impl.BaseServiceImpl;
import io.renren.dao.TokenDao;
import io.renren.entity.TokenEntity;
import io.renren.service.TokenService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.Date;
@ -12,73 +14,76 @@ import java.util.UUID;
@Service
public class TokenServiceImpl extends BaseServiceImpl<TokenDao, TokenEntity> implements TokenService {
/**
* 12小时后过期
*/
private final static int EXPIRE = 3600 * 12;
private static final String getByTokenKey = "getByToken";
/**
* 12小时后过期
*/
private final static int EXPIRE = 3600 * 12;
@Override
public TokenEntity getByToken(String token) {
return baseDao.getByToken(token);
}
@Override
@Cacheable(value = getByTokenKey, key = "#p1")
public TokenEntity getByToken(String token) {
return baseDao.getByToken(token);
}
@Override
public TokenEntity createToken(Long userId) {
//当前时间
Date now = new Date();
//过期时间
Date expireTime = new Date(now.getTime() + EXPIRE * 1000);
@Override
@CacheEvict(key = getByTokenKey, allEntries = true)
public TokenEntity createToken(Long userId) {
//当前时间
Date now = new Date();
//过期时间
Date expireTime = new Date(now.getTime() + EXPIRE * 1000);
//用户token
String token;
//用户token
String token;
//判断是否生成过token
TokenEntity tokenEntity = baseDao.getByUserId(userId);
if(tokenEntity == null){
//生成一个token
token = generateToken();
//判断是否生成过token
TokenEntity tokenEntity = baseDao.getByUserId(userId);
if (tokenEntity == null) {
//生成一个token
token = generateToken();
tokenEntity = new TokenEntity();
tokenEntity.setUserId(userId);
tokenEntity.setToken(token);
tokenEntity.setUpdateDate(now);
tokenEntity.setExpireDate(expireTime);
tokenEntity = new TokenEntity();
tokenEntity.setUserId(userId);
tokenEntity.setToken(token);
tokenEntity.setUpdateDate(now);
tokenEntity.setExpireDate(expireTime);
//保存token
this.insert(tokenEntity);
}else{
//判断token是否过期
if(tokenEntity.getExpireDate().getTime() < System.currentTimeMillis()){
//token过期重新生成token
token = generateToken();
}else {
token = tokenEntity.getToken();
}
//保存token
this.insert(tokenEntity);
} else {
//判断token是否过期
if (tokenEntity.getExpireDate().getTime() < System.currentTimeMillis()) {
//token过期重新生成token
token = generateToken();
} else {
token = tokenEntity.getToken();
}
tokenEntity.setToken(token);
tokenEntity.setUpdateDate(now);
tokenEntity.setExpireDate(expireTime);
tokenEntity.setToken(token);
tokenEntity.setUpdateDate(now);
tokenEntity.setExpireDate(expireTime);
//更新token
this.updateById(tokenEntity);
}
//更新token
this.updateById(tokenEntity);
}
return tokenEntity;
}
return tokenEntity;
}
@Override
public void expireToken(Long userId){
Date now = new Date();
@Override
public void expireToken(Long userId) {
Date now = new Date();
TokenEntity tokenEntity = new TokenEntity();
tokenEntity.setUserId(userId);
tokenEntity.setUpdateDate(now);
tokenEntity.setExpireDate(now);
TokenEntity tokenEntity = new TokenEntity();
tokenEntity.setUserId(userId);
tokenEntity.setUpdateDate(now);
tokenEntity.setExpireDate(now);
this.updateById(tokenEntity);
}
this.updateById(tokenEntity);
}
private String generateToken(){
return UUID.randomUUID().toString().replace("-", "");
}
private String generateToken() {
return UUID.randomUUID().toString().replace("-", "");
}
}