Merge branch 'dev' of http://221.0.232.152:9393/ability-center/share-platform into dev
* 'dev' of http://221.0.232.152:9393/ability-center/share-platform: (47 commits) bug修复 bug修复: 1.能力统计-基础设施来源修改 2.申购车查询逻辑修改 3.排序失效修复 1、修改能力统计列表和详情-组件服务-使用情况统计相关代码修改为统计调用数和使用数 补充 发表需求评论 1、修改能力统计列表和详情-TOP5使用组件 异步优化 1、修改能力统计列表和详情-组件服务-使用情况统计列表的查询字段名称 工作台bug修复 异步多线程优化 1、修改能力统计列表和详情-组件服务-使用情况统计-使用组件评分TOP5的sql 1.申购车查询结果新增字段 2.根据申请查询摄像头列表修改 3.修改新增收藏因为异步导致的数据库死锁 1、修改能力统计列表和详情-组件服务-使用情况统计-top5使用组件的sql ... sql 调整 1、修改能力统计列表和详情-应用资源-发布端应用情况的sql 我发起的流程、已办任务 可按流程类型过滤 ... 1、修改能力统计列表和详情-优化贡献组件分别被多少应用使用的sql ... 申请摄像头通知异常的解决 ...
This commit is contained in:
commit
0b1f82f933
|
@ -1,17 +1,3 @@
|
|||
-- 删除索引
|
||||
alter table `tb_resource_collection` drop index `resourceid`;
|
||||
alter table `tb_resource_car` drop index `resourceid`;
|
||||
alter table `tb_resource_score` drop index `resourceid`;
|
||||
alter table `tb_resource_browse` drop index `resourceid`;
|
||||
alter table `t_ability_application` drop index `resourceid`;
|
||||
alter table `t_ability_application` drop index `userId`;
|
||||
alter table `tb_data_resource` drop index `type`;
|
||||
alter table `tb_data_attr` drop index `attr_value`;
|
||||
alter table `tb_data_resource` drop index `name`;
|
||||
alter table `tb_data_resource` drop index `deptId`;
|
||||
alter table `sys_dept` drop index `type`;
|
||||
alter table `sys_dept` drop index `district`;
|
||||
alter table `tb_resource_collection` drop index `userId`;
|
||||
-- 创建索引
|
||||
alter table `tb_resource_collection` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '收藏的资源id';
|
||||
alter table `tb_resource_car` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '加入申购车的id';
|
||||
|
|
|
@ -1 +1 @@
|
|||
ALTER TABLE t_ability_application ADD COLUMN `cameraList` json NULL COMMENT '摄像头ID数组';
|
||||
ALTER TABLE t_ability_application ADD COLUMN `camera_list` json NULL COMMENT '摄像头ID数组';
|
|
@ -1,5 +1,5 @@
|
|||
alter table `t_ability_application`
|
||||
ADD COLUMN `title` longtext NULL comment '能力申请标题' AFTER `cameraList`,
|
||||
ADD COLUMN `title` longtext NULL comment '能力申请标题',
|
||||
ADD COLUMN `application_system` varchar(255) NULL comment '应用系统' AFTER `title`,
|
||||
ADD COLUMN `application_scene` varchar(255) NULL comment '应用场景' AFTER `application_system`,
|
||||
ADD COLUMN `application_background` longtext NULL comment '应用背景' AFTER `application_scene`,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE tb_resource_car MODIFY COLUMN `note1` json NULL COMMENT '摄像头ID列表';
|
|
@ -0,0 +1,2 @@
|
|||
alter table `t_ability_application`
|
||||
MODIFY COLUMN `application_scene` json NULL comment '应用场景';
|
|
@ -232,15 +232,17 @@ public class ActivitiNoticeAspect {
|
|||
Long resourceId = null;
|
||||
if (kv.containsKey("resourceId") && kv.get("resourceId") != null) {
|
||||
resourceId = Long.valueOf(kv.get("resourceId").toString());
|
||||
} else if (kv.containsKey("id") && kv.get("id") != null) {
|
||||
} else if (kv.containsKey("id") && kv.get("id") != null && kv.containsKey("-")) {
|
||||
resourceId = Long.valueOf(kv.get("id").toString());
|
||||
} else {
|
||||
resourceId = 0L;
|
||||
}
|
||||
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||
CompletableFuture.runAsync(() -> { // 发起人
|
||||
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
|
||||
kv.get("resourceId");
|
||||
kv.get("id");
|
||||
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "") + activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
|
||||
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "申请摄像头列表") + activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
|
||||
SysNoticeDTO dto = new SysNoticeDTO();
|
||||
dto.setType(2);
|
||||
dto.setTitle("流程结束系统通知");
|
||||
|
|
|
@ -28,8 +28,8 @@ public class RestTemplateConfig {
|
|||
@Bean
|
||||
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setReadTimeout(30000);//单位为ms
|
||||
factory.setConnectTimeout(30000);//单位为ms
|
||||
factory.setReadTimeout(2000);//单位为ms
|
||||
factory.setConnectTimeout(500);//单位为ms
|
||||
|
||||
// SocketAddress address = new InetSocketAddress("127.0.0.1", 8888);
|
||||
// Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.renren.common.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.renren.common.dto.AuditingBaseDTO;
|
||||
|
@ -20,6 +19,7 @@ import io.renren.modules.resource.dto.ResourceDTO;
|
|||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.security.user.UserDetail;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -28,6 +28,7 @@ import org.codehaus.jackson.map.ObjectMapper;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -47,7 +48,7 @@ import java.util.stream.Collectors;
|
|||
@RestController
|
||||
@RequestMapping("/ability/center/v2")
|
||||
public class AbilityCenterControllerV2 {
|
||||
private static Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
|
||||
private static final ObjectMapper oMapper = new ObjectMapper();
|
||||
@Autowired
|
||||
private ActProcessService actProcessService;
|
||||
|
@ -61,7 +62,9 @@ public class AbilityCenterControllerV2 {
|
|||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
private static String key = "abilityprocess_v2";
|
||||
@Value("${big_date.name}")
|
||||
private String bigDateDeptName; // 大数据局名称
|
||||
private static final String key = "abilityprocess_v2";
|
||||
|
||||
private static Map<String, Object> params = new HashMap<String, Object>() {
|
||||
{
|
||||
|
@ -72,9 +75,6 @@ public class AbilityCenterControllerV2 {
|
|||
|
||||
/**
|
||||
* 批量进行批量能力申请(按资源所属部门分配审核人)
|
||||
*
|
||||
* @param abilityBatchApplicationDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/apply")
|
||||
@ApiOperation("批量进行能力申请")
|
||||
|
@ -84,6 +84,7 @@ public class AbilityCenterControllerV2 {
|
|||
if (page.getTotal() <= 0) { //
|
||||
return new Result().error("联系管理员添加流程");
|
||||
}
|
||||
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
|
||||
final UserDetail user = SecurityUser.getUser();
|
||||
List<TAbilityApplicationDTO> tAbilityApplicationDTOList =
|
||||
abilityBatchApplicationDTO.getSystem().stream().map(index -> {
|
||||
|
@ -108,6 +109,7 @@ public class AbilityCenterControllerV2 {
|
|||
tAbilityApplicationDTO.setApproveStatus("审核中");
|
||||
tAbilityApplicationDTO.setDelFlag(0);
|
||||
// v2 新增字段
|
||||
tAbilityApplicationDTO.setCameraList(index.get("cameraId"));
|
||||
tAbilityApplicationDTO.setTitle(abilityBatchApplicationDTO.getTitle());
|
||||
tAbilityApplicationDTO.setApplicationBackground(abilityBatchApplicationDTO.getApplicationBackground());
|
||||
tAbilityApplicationDTO.setApplicationScene(abilityBatchApplicationDTO.getApplicationScene());
|
||||
|
@ -122,13 +124,13 @@ public class AbilityCenterControllerV2 {
|
|||
}
|
||||
tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE);
|
||||
return tAbilityApplicationDTO;
|
||||
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()); // 申请入库
|
||||
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()); // 申请入库
|
||||
if (!tAbilityApplicationDTOList.isEmpty()) {
|
||||
Map<Long, List<TAbilityApplicationDTO>> temp =
|
||||
tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId())).collect(Collectors.groupingBy(t -> {
|
||||
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId()));
|
||||
if (resourceDTO == null) { // 资源不存在时
|
||||
return 0L;
|
||||
if (resourceDTO == null && deptDTO.isPresent()) { // 资源不存在时
|
||||
return deptDTO.get().getId();
|
||||
}
|
||||
return resourceDTO.getDeptId();
|
||||
})); // 按部门分组
|
||||
|
@ -140,19 +142,31 @@ public class AbilityCenterControllerV2 {
|
|||
return;
|
||||
}
|
||||
List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
|
||||
final List<Long> ids = dtoList.stream().map(index -> index.getId()).collect(Collectors.toList()); // 发起申请的表单id
|
||||
Boolean basic_facilities =
|
||||
dtoList.stream().map(index -> {
|
||||
Optional<ResourceDTO> resourceDTOOptional =
|
||||
Optional.ofNullable(resourceService.get(Long.valueOf(index.getResourceId()))); // 从本库内查不到 视为其它平台的基础设施资源
|
||||
return !resourceDTOOptional.isPresent() || !"基础设施".equals(resourceDTOOptional.get().getType());
|
||||
}
|
||||
)
|
||||
.filter(index -> !index).findAny().orElse(Boolean.TRUE);
|
||||
logger.error("--------------------是否全是基础设施{}----------------------------------------------", basic_facilities);
|
||||
final List<Long> ids = dtoList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()); // 发起申请的表单id
|
||||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(JSON.toJSONString(ids)); // 申请的id列表 json字符 做businesskey
|
||||
processStartDTO.setBusinessKey(basic_facilities ?
|
||||
tAbilityApplicationDTOList.stream()
|
||||
.filter(index -> StringUtils.isNotEmpty(index.getResourceId()))
|
||||
.map(TAbilityApplicationDTO::getResourceId)
|
||||
.findFirst()
|
||||
.orElse(null)
|
||||
: JSON.toJSONString(ids)); // 申请的id列表 json字符 做businesskey
|
||||
processStartDTO.setProcessDefinitionKey(key); //限定
|
||||
AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO();
|
||||
auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入
|
||||
|
||||
Map<String, Object> variables = oMapper.convertValue(auditingBaseDTO, Map.class);
|
||||
Boolean basic_facilities =
|
||||
dtoList.stream().map(index -> !"基础设施".equals(resourceService.get(Long.valueOf(index.getResourceId())).getType()))
|
||||
.filter(index -> !index).findAny().orElse(Boolean.TRUE);
|
||||
logger.error("--------------------是否全是基础设施{}----------------------------------------------", basic_facilities);
|
||||
|
||||
|
||||
variables.putAll(new HashMap<String, Object>() { // 流程内携带属性值
|
||||
{
|
||||
|
|
|
@ -91,8 +91,9 @@ public class CensusController {
|
|||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
CompletableFuture<Void> resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
|
||||
List<Map<String, Object>> dbAmount = resourceService.getAmountGroupByType();
|
||||
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
|
||||
Map map = (Map) resourceService.selectTotal();
|
||||
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 -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
|
|
|
@ -322,7 +322,23 @@ public class CensusControllerV2 {
|
|||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture<Void> allAmount = null;
|
||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||
case TSINGTAO: // 青岛市局
|
||||
case TSINGTAO: { // 青岛市局
|
||||
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
|
||||
Map map = (Map) resourceService.selectTotal();
|
||||
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
|
||||
|
||||
return dbAmount.stream().filter(index -> "基础设施".equals(index.get("type").toString()))
|
||||
.mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "视频资源数量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
case BAOTOU: { // 包头
|
||||
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class);
|
||||
|
|
|
@ -62,14 +62,19 @@ public class CensusControllerV3 {
|
|||
})
|
||||
public Result<PageData<Map<String, Object>>> resourceAssemblerDetails(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
|
||||
if(StringUtils.equals(user.getUsername(),"admin") || StringUtils.equals(sysDeptDTO.getName(),qddsjj)){//admin和市大数据局显示所有
|
||||
if(StringUtils.equals(user.getUsername(),"admin")){
|
||||
params.put("id",0);
|
||||
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
|
||||
params.put("id",sysDeptDTO.getPid());
|
||||
}else{
|
||||
params.put("id",sysDeptDTO.getId());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
String type = params.get("resourceType").toString();
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
|
||||
|
@ -104,14 +109,19 @@ public class CensusControllerV3 {
|
|||
})
|
||||
public Result<PageData<Map<String, Object>>> resourceUsedDetails(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
|
||||
if(StringUtils.equals(user.getUsername(),"admin") || StringUtils.equals(sysDeptDTO.getName(),qddsjj)){//admin和市大数据局显示所有
|
||||
if(StringUtils.equals(user.getUsername(),"admin")){
|
||||
params.put("id",0);
|
||||
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
|
||||
params.put("id",sysDeptDTO.getPid());
|
||||
}else{
|
||||
params.put("id",sysDeptDTO.getId());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
String type = params.get("resourceType").toString();
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
|
||||
|
@ -150,21 +160,11 @@ public class CensusControllerV3 {
|
|||
@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")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(a.score) as scoreNum,a.score FROM \n" +
|
||||
"tb_resource_score a\n" +
|
||||
"INNER JOIN \n" +
|
||||
"tb_data_resource b\n" +
|
||||
"ON \n" +
|
||||
"a.resource_id = b.id\n" +
|
||||
"WHERE \n" +
|
||||
"b.type = ?\n" +
|
||||
"AND\n" +
|
||||
"b.dept_id = ?\n" +
|
||||
"AND\n" +
|
||||
"a.score is not null\n" +
|
||||
"AND a.del_flag = 0\n" +
|
||||
"GROUP BY a.score", args);
|
||||
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" +
|
||||
"AND c.id = ? OR INSTR(c.pids,?) GROUP BY a.score", args);
|
||||
|
||||
return new Result<List<Map<String, Object>>>().ok(maps);
|
||||
}
|
||||
|
@ -186,22 +186,16 @@ public class CensusControllerV3 {
|
|||
@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("resourceType")};
|
||||
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\n" +
|
||||
"FROM tb_resource_car a \n" +
|
||||
"INNER JOIN tb_data_resource b \n" +
|
||||
"ON a.resource_id = b.id\n" +
|
||||
"WHERE\n" +
|
||||
"b.dept_id = ?\n" +
|
||||
"AND\n" +
|
||||
"b.type = ?\n" +
|
||||
"AND \n" +
|
||||
"a.del_flag = 0\n" +
|
||||
"\n" +
|
||||
"GROUP BY a.resource_id,b.name \n" +
|
||||
"ORDER BY COUNT(a.id) DESC\n" +
|
||||
"LIMIT 5", args);
|
||||
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" +
|
||||
" INNER JOIN sys_dept c ON b.dept_id = c.id\n" +
|
||||
" WHERE (c.id = ? OR INSTR(c.pids,?)) AND b.type = ?\n" +
|
||||
" AND a.del_flag = 0\n" +
|
||||
" GROUP BY a.resource_id,b.name \n" +
|
||||
" ORDER BY COUNT(a.id) DESC\n" +
|
||||
" LIMIT 5", args);
|
||||
|
||||
return new Result<List<Map<String, Object>>>().ok(maps);
|
||||
}
|
||||
|
@ -215,9 +209,10 @@ public class CensusControllerV3 {
|
|||
@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("resourceType")};
|
||||
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" +
|
||||
"WHERE a.dept_id = ? and a.type = ? and b.attr_type = '组件类型'\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" +
|
||||
"GROUP BY b.attr_value", ps);
|
||||
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
|
@ -239,9 +234,14 @@ public class CensusControllerV3 {
|
|||
@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("resourceType"),params.get("id")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT b.name,count(a.id) AS useNum FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.reference_id = b.id\n" +
|
||||
"WHERE a.del_flag = 0 AND b.type = ? AND b.dept_id = ? GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps);
|
||||
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" +
|
||||
"\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" +
|
||||
") a \n" +
|
||||
"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);
|
||||
}
|
||||
|
@ -254,10 +254,18 @@ public class CensusControllerV3 {
|
|||
@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("resourceType")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(d.id) as num,d.attr_value FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id INNER JOIN tb_data_attr d ON c.id = d.data_resource_id\n" +
|
||||
"WHERE a.del_flag = 0 AND b.dept_id = ? AND c.type = ? AND d.attr_type = '组件类型' \n" +
|
||||
"GROUP BY d.attr_value", ps);
|
||||
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" +
|
||||
"\t(\n" +
|
||||
"\t\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" +
|
||||
"\t\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" +
|
||||
"\t) a \n" +
|
||||
"\tINNER 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" +
|
||||
"\tWHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 \n" +
|
||||
"\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);
|
||||
}
|
||||
|
@ -265,11 +273,31 @@ public class CensusControllerV3 {
|
|||
@GetMapping("/assemblerUseProjectInfo")
|
||||
@ApiOperation("应用贡献组件数量分布(算法、图层、开发、业务)")
|
||||
@LogOperation("应用贡献组件数量分布(算法、图层、开发、业务)")
|
||||
@ApiImplicitParam(name = "keyId", value = "应用的id", paramType = "query", required = true, dataType = "long")
|
||||
public Result<List<Map<String, Object>>> assemblerUseProjectInfo(Long keyId){
|
||||
Object[] ps = {keyId};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select count(b.id) as num,b.attr_value from (select reference_id from tb_data_resource_rel where del_flag = 0 and key_id = ? ) a inner join tb_data_attr b on a.reference_id = b.data_resource_id \n" +
|
||||
" and b.attr_type = '应用类型' group by b.attr_value ", ps);
|
||||
@ApiImplicitParam(name = "id", value = "部门的id", paramType = "query", required = true, dataType = "long")
|
||||
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" +
|
||||
"INNER JOIN tb_data_resource_rel b ON a.id = b.key_id \n" +
|
||||
"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);
|
||||
}
|
||||
|
||||
@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};
|
||||
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" +
|
||||
"INNER JOIN tb_data_resource c ON b.reference_id = c.id \n" +
|
||||
"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);
|
||||
}
|
||||
|
@ -282,11 +310,18 @@ public class CensusControllerV3 {
|
|||
@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")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select AVG(a.score) as score,b.name from tb_resource_score a inner join tb_data_resource b on a.resource_id = b.id\n" +
|
||||
"inner join sys_user c on a.user_id = c.id \n" +
|
||||
"where a.del_flag = 0 and b.type = ? and c.dept_id = ?\n" +
|
||||
"group by b.name order by score desc limit 5", ps);
|
||||
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" +
|
||||
"\t\t(\n" +
|
||||
"\t\t\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" +
|
||||
"\t\t\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" +
|
||||
"\t\t) a \n" +
|
||||
"\t\tINNER 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" +
|
||||
"\t\tWHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 \n" +
|
||||
")\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);
|
||||
}
|
||||
|
@ -345,22 +380,32 @@ public class CensusControllerV3 {
|
|||
@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("id"),params.get("resourceType")};
|
||||
List<Map<String, Object>> result = jdbcTemplate.queryForList("SELECT COUNT(b.id) as num,b.attr_value as publisher 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);
|
||||
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" +
|
||||
"(\n" +
|
||||
"select a.id,c.attr_value from tb_data_resource a inner join sys_dept b on a.dept_id = b.id inner join tb_data_attr c \n" +
|
||||
"on a.id = c.data_resource_id where a.del_flag = 0 and a.type = ? and (b.id = ? or instr(b.pids,?)) and c.attr_type = '发布端' and c.del_flag = 0\n" +
|
||||
"and c.attr_value is not null\n" +
|
||||
") a\n" +
|
||||
"INNER JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.attr_value ) - length( REPLACE ( a.attr_value, ';', '' ) ) +1 )\n" +
|
||||
"\n" +
|
||||
") m GROUP BY m.attr_value", ps);
|
||||
|
||||
return new Result<List<Map<String,Object>>>().ok(result);
|
||||
}
|
||||
@GetMapping("/applicationUsedCapabilityNum")
|
||||
@ApiOperation("贡献组件分别被多少应用使用")
|
||||
@LogOperation("贡献组件分别被多少应用使用")
|
||||
@ApiImplicitParam(name = "keyId", value = "应用id", paramType = "query", required = true, dataType = "long")
|
||||
public Result<List<Map<String,Object>>> applicationUsedCapabilityNum(Long keyId){
|
||||
Object[] ps = {keyId};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select count(b.id) as useNum,c.name from (select reference_id from tb_data_resource_rel where del_flag = 0 and key_id = ? ) a inner join tb_data_resource_rel b on a.reference_id = b.reference_id inner join tb_data_resource c\n" +
|
||||
"on a.reference_id = c.id where c.del_flag = 0 group by c.name", ps);
|
||||
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long")
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,8 @@ public class HistoryController {
|
|||
@ApiImplicitParam(name = "processDefinitionId", value = "流程定义ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startBeginTime", value = "流程启动开始时间", paramType = "query", dataType = "Date"),
|
||||
@ApiImplicitParam(name = "startEndTime", value = "流程启动结束时间", paramType = "query", dataType = "Date"),
|
||||
@ApiImplicitParam(name = "ended", value = "是否结束(true:是,false:否)", paramType = "query", dataType = "String")
|
||||
@ApiImplicitParam(name = "ended", value = "是否结束(true:是,false:否)", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "processDefinitionKey", value = "流程定义KEY", paramType = "query", dataType = "String")
|
||||
})
|
||||
// @RequiresPermissions("sys:his:all")
|
||||
public Result<ProcessInstanceDTO> getMyProcessInstancePage(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
|
@ -135,8 +136,8 @@ public class HistoryController {
|
|||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"),
|
||||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int")
|
||||
})
|
||||
public Result<Page<ProcessActivityDTO>> getDeptHandledInstancePage(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Page<ProcessActivityDTO> page=activitiService.getDeptProcessInstancePage(params);
|
||||
public Result<Page<ProcessActivityDTO>> getDeptHandledInstancePage(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
Page<ProcessActivityDTO> page = activitiService.getDeptProcessInstancePage(params);
|
||||
setExtraProcessProperties(page.getRecords());
|
||||
return new Result().ok(page);
|
||||
}
|
||||
|
@ -153,7 +154,7 @@ public class HistoryController {
|
|||
return new Result().ok(list);
|
||||
}
|
||||
|
||||
private void setExtraProcessProperties(List<ProcessActivityDTO> list){
|
||||
private void setExtraProcessProperties(List<ProcessActivityDTO> list) {
|
||||
for (ProcessActivityDTO activityDTO : list) {
|
||||
if (StringUtils.isNotEmpty(activityDTO.getStartUserId())) {
|
||||
SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getStartUserId()));
|
||||
|
@ -163,12 +164,22 @@ public class HistoryController {
|
|||
SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getAssignee()));
|
||||
activityDTO.setAssigneeName(userDTO != null ? userDTO.getRealName() : "");
|
||||
}
|
||||
TAbilityApplicationDTO abilityApplicationDTO =
|
||||
abilityApplicationService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||
TResourceMountApplyDTO tResourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||
TDemandDataDTO tDemandDataDTO = tDemandDataService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||
if (abilityApplicationDTO != null) {
|
||||
activityDTO.setResourceName(abilityApplicationDTO.getSystem());
|
||||
List<TAbilityApplicationDTO> abilityApplicationDTOS =
|
||||
abilityApplicationService.getByInstanceId(activityDTO.getProcessInstanceId());
|
||||
TResourceMountApplyDTO tResourceMountApplyDTO = null;
|
||||
TDemandDataDTO tDemandDataDTO = null;
|
||||
if (!activityDTO.getBusinessKey().startsWith("[") && !activityDTO.getBusinessKey().startsWith("{")) { // json 内容(批量申请)
|
||||
tResourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||
tDemandDataDTO = tDemandDataService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||
}
|
||||
if (abilityApplicationDTOS != null && !abilityApplicationDTOS.isEmpty()) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
abilityApplicationDTOS.stream().map(TAbilityApplicationDTO::getSystem).filter(index -> StringUtils.isNotEmpty(index)).forEach(index -> {
|
||||
stringBuffer.append(index);
|
||||
stringBuffer.append(",");
|
||||
});
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
activityDTO.setResourceName(stringBuffer.toString());
|
||||
} else if (tResourceMountApplyDTO != null) {
|
||||
activityDTO.setResourceName(tResourceMountApplyDTO.getResourceDTO().getName());
|
||||
} else if (tDemandDataDTO != null) {
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.renren.common.constant.Constant;
|
|||
import io.renren.common.page.PageData;
|
||||
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
|
||||
import io.renren.modules.activiti.dto.TaskDTO;
|
||||
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
||||
import io.renren.modules.demandComment.service.TDemandCommentService;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
|
@ -78,6 +80,9 @@ public class ActHistoryService {
|
|||
@Autowired
|
||||
private TAbilityApplicationService tAbilityApplicationService;
|
||||
|
||||
@Autowired
|
||||
private TDemandCommentService tDemandCommentService;
|
||||
|
||||
@Autowired
|
||||
private ProcessEngine processEngine_;
|
||||
|
||||
|
@ -185,6 +190,10 @@ public class ActHistoryService {
|
|||
query.processInstanceBusinessKey((String) params.get("businessKey"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty((String) params.get("processDefinitionKey"))) { // 流程定义key
|
||||
query.processDefinitionKey((String) params.get("processDefinitionKey"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty((String) params.get("processDefinitionId"))) {
|
||||
query.processDefinitionId((String) params.get("processDefinitionId"));
|
||||
}
|
||||
|
@ -262,14 +271,19 @@ public class ActHistoryService {
|
|||
for (ProcessInstanceDTO dto : list) {
|
||||
List<TAbilityApplicationDTO> abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单
|
||||
if (abilityApplicationDTO != null && !abilityApplicationDTO.isEmpty()) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
abilityApplicationDTO.stream().map(TAbilityApplicationDTO::getSystem).filter(index -> StringUtils.isNotEmpty(index)).forEach(index -> {
|
||||
stringBuffer.append(index);
|
||||
stringBuffer.append(",");
|
||||
});
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
dto.setName(stringBuffer.toString());
|
||||
dto.setResourceId(null);
|
||||
if (abilityApplicationDTO.stream().filter(index -> StringUtils.isNotEmpty(index.getCameraList())).findAny().isPresent()) { // 存在摄像头
|
||||
dto.setName("申请摄像头列表");
|
||||
dto.setResourceId(null);
|
||||
} else {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
abilityApplicationDTO.stream().map(TAbilityApplicationDTO::getSystem).filter(index -> StringUtils.isNotEmpty(index)).forEach(index -> {
|
||||
stringBuffer.append(index);
|
||||
stringBuffer.append(",");
|
||||
});
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
dto.setName(stringBuffer.toString());
|
||||
dto.setResourceId(null);
|
||||
}
|
||||
} else {
|
||||
TAbilityApplicationDTO abilityApplicationDTO1 = tAbilityApplicationService.getByBusinessKey(dto.getBusinessKey());
|
||||
if (abilityApplicationDTO1 != null) {
|
||||
|
@ -293,6 +307,12 @@ public class ActHistoryService {
|
|||
if (resourceDTO != null) {
|
||||
dto.setName(resourceDTO.getName());
|
||||
dto.setResourceId(resourceDTO.getId().toString());
|
||||
} else {
|
||||
TDemandCommentDTO tDemandCommentDTO = tDemandCommentService.get(Long.valueOf(dto.getBusinessKey()));
|
||||
if (tDemandCommentDTO != null) {
|
||||
dto.setName("发表需求评论");
|
||||
dto.setResourceId(tDemandCommentDTO.getId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ActProcessService {
|
|||
public PageData<Map<String, Object>> page(Map<String, Object> params) {
|
||||
String key = (String)params.get("key");
|
||||
String processName = (String)params.get("processName");
|
||||
boolean isLatestVersion = params.get("isLatestVersion")== null? false : (boolean)params.get("isLatestVersion");
|
||||
boolean isLatestVersion = params.get("isLatestVersion") != null && (boolean) params.get("isLatestVersion");
|
||||
|
||||
//分页参数
|
||||
int curPage = 1;
|
||||
|
|
|
@ -246,6 +246,14 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
listDto.add(dto);
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有类型都没获取到
|
||||
*/
|
||||
processVariable.putAll(task.getProcessVariables());
|
||||
dto.setParams(processVariable);
|
||||
listDto.add(dto);
|
||||
|
||||
}
|
||||
return listDto;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@Service
|
||||
public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category, CategoryDTO> implements CategoryService {
|
||||
|
@ -35,32 +37,42 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
|
|||
@Override
|
||||
public List<CategoryDTO> getCategoryTree() {
|
||||
List<Category> topCategory = categoryDao.selectByParentId(null);
|
||||
ArrayList<CategoryDTO> list = new ArrayList<>();
|
||||
topCategory.forEach(item -> {
|
||||
CategoryDTO dto = new CategoryDTO();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
list.add(dto);
|
||||
});
|
||||
List<CategoryDTO> list = new CopyOnWriteArrayList<>();
|
||||
List<CompletableFuture> completableFutureLis = new ArrayList<>();
|
||||
topCategory.forEach(index ->
|
||||
completableFutureLis.add(CompletableFuture.runAsync(() -> {
|
||||
CategoryDTO dto = new CategoryDTO();
|
||||
BeanUtils.copyProperties(index, dto);
|
||||
list.add(dto);
|
||||
}))
|
||||
);
|
||||
CompletableFuture.allOf(completableFutureLis.toArray(new CompletableFuture[completableFutureLis.size()])).join();
|
||||
return getAllCategory(list);
|
||||
}
|
||||
|
||||
private List<CategoryDTO> getAllCategory(List<CategoryDTO> topCategory) {
|
||||
List<CompletableFuture> tasks = new CopyOnWriteArrayList<>();
|
||||
for (CategoryDTO categoryDto : topCategory) {
|
||||
if (categoryDao.selectByParentId(categoryDto.getId()).isEmpty()) {
|
||||
categoryDto.setIsLeaf("Y");
|
||||
categoryDto.setChildren(new ArrayList());
|
||||
} else {
|
||||
ArrayList<CategoryDTO> list = new ArrayList<>();
|
||||
categoryDao.selectByParentId(categoryDto.getId())
|
||||
.forEach(item -> {
|
||||
CategoryDTO dto = new CategoryDTO();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
list.add(dto);
|
||||
});
|
||||
categoryDto.setIsLeaf("N");
|
||||
categoryDto.setChildren(getAllCategory(list));
|
||||
CompletableFuture task =
|
||||
CompletableFuture.runAsync(() -> {
|
||||
categoryDao.selectByParentId(categoryDto.getId())
|
||||
.forEach(item -> {
|
||||
CategoryDTO dto = new CategoryDTO();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
list.add(dto);
|
||||
});
|
||||
categoryDto.setIsLeaf("N");
|
||||
categoryDto.setChildren(getAllCategory(list));
|
||||
});
|
||||
tasks.add(task);
|
||||
}
|
||||
}
|
||||
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
|
||||
return topCategory;
|
||||
}
|
||||
|
||||
|
@ -77,7 +89,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
|
|||
public List<Category> getAllFiledByTopCategory(String topCategoryName) {
|
||||
QueryWrapper<Category> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("root_category", topCategoryName)
|
||||
.eq("del_flag",0)
|
||||
.eq("del_flag", 0)
|
||||
.eq("is_attr", "true")
|
||||
.orderByAsc("xh");
|
||||
return categoryDao.selectList(wrapper);
|
||||
|
@ -87,7 +99,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
|
|||
public List<Map> getAllFilterCriteriaByTopCategory(String topCategoryName) {
|
||||
QueryWrapper<Category> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("root_category", topCategoryName)
|
||||
.eq("del_flag",0)
|
||||
.eq("del_flag", 0)
|
||||
.eq("is_link_to_dic", "true")
|
||||
.eq("is_filter_criteria", "true")
|
||||
.orderByAsc("xh");
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
|
|||
import io.renren.modules.demanData.service.TDemandDataService;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.dao.SysDeptDao;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -27,7 +28,7 @@ import java.util.Map;
|
|||
public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDemandDataEntity, TDemandDataDTO> implements TDemandDataService {
|
||||
|
||||
@Autowired
|
||||
private SysDeptDao sysDeptDao;
|
||||
private SysDeptService deptService;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -53,6 +54,7 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
|
|||
if (!params.containsKey("creator")) {
|
||||
wrapper.eq("flag", 3); // 默认只出审核通过
|
||||
}
|
||||
wrapper.orderByDesc("create_date");
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
@ -71,8 +73,10 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
|
|||
public Object selectFlagCountByDepts() {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
Long deptId = SecurityUser.getUser().getDeptId();
|
||||
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
|
||||
deptList.add(deptId);
|
||||
List<Long> deptList=null;
|
||||
if(deptId != null){
|
||||
deptList = deptService.getSubDeptIdList(deptId);
|
||||
}
|
||||
List<Map> list = baseDao.selectFlagCountByDepts(deptList);
|
||||
list.forEach(temp -> {
|
||||
temp.put("flag", TDemandDataEntityFlag.getByFlag(Integer.parseInt(temp.get("flag").toString())).getTip());
|
||||
|
|
|
@ -88,7 +88,9 @@ 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("需求评论系统通知");
|
||||
|
|
|
@ -54,8 +54,8 @@ public class TAbilityApplicationDTO extends AuditingBaseDTO implements Serializa
|
|||
@ApiModelProperty(value = "附件")
|
||||
private String enclosure;
|
||||
|
||||
@ApiModelProperty(value = "摄像头ID数组")
|
||||
private List<CameraChannel> cameraList;
|
||||
@ApiModelProperty(value = "摄像头ID")
|
||||
private String cameraList;
|
||||
|
||||
@ApiModelProperty(value = "能力申请标题")
|
||||
private String title;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TAbilityBatchApplicationDTO extends AuditingBaseDTO implements Seri
|
|||
private String enclosure;
|
||||
|
||||
@ApiModelProperty(value = "摄像头ID数组")
|
||||
private List<CameraChannel> cameraList;
|
||||
private String cameraList;
|
||||
|
||||
@ApiModelProperty(value = "能力申请标题")
|
||||
private String title;
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
|
||||
import io.renren.modules.monitor.entity.CameraChannel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -98,8 +97,8 @@ public class TAbilityApplicationEntity implements Serializable {
|
|||
/**
|
||||
* 摄像头列表
|
||||
*/
|
||||
@TableField(value = "camera_list", typeHandler = FastjsonTypeHandler.class)
|
||||
private List<CameraChannel> cameraList;
|
||||
// @TableField(value = "camera_list", typeHandler = FastjsonTypeHandler.class)
|
||||
private String cameraList;
|
||||
|
||||
/**
|
||||
* 能力申请标题
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
|
|||
private TAbilityApplicationService tAbilityApplicationService;
|
||||
|
||||
@Override
|
||||
@ActivitiNoticeOperation(value = "资源部门负责人审批", process = "能力申请流程")
|
||||
@ActivitiNoticeOperation(value = "资源部门负责人审批", process = "能力申请流程v2")
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
logger.error("-------------------------进入部门动态审批人流程-------------------------------");
|
||||
final String eventName = delegateTask.getEventName();
|
||||
|
@ -85,7 +85,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
|
|||
}
|
||||
|
||||
@Override
|
||||
@ActivitiNoticeOperation(value = "流程结束", process = "能力申请流程", type = 2)
|
||||
@ActivitiNoticeOperation(value = "流程结束", process = "能力申请流程v2", type = 2)
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
logger.error("----------------------进入部门审批结束节点---------------------------");
|
||||
delegateExecution.getProcessBusinessKey();
|
||||
|
|
|
@ -18,6 +18,8 @@ import io.renren.modules.resource.excel.ResourceExcelImportListener;
|
|||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.resource.videoPreview.AbstractVideoPreviewService;
|
||||
import io.renren.modules.resource.videoPreview.VideoPreviewFactory;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -56,6 +58,9 @@ import java.util.stream.Collectors;
|
|||
@Api(tags = "资源表")
|
||||
public class ResourceController {
|
||||
|
||||
@Value("${big_date.name}")
|
||||
private String bigDateDeptName; // 大数据局名称
|
||||
|
||||
@Value("${qdyjj.ipAndPort}")
|
||||
private String ipAndPort;
|
||||
|
||||
|
@ -94,6 +99,8 @@ public class ResourceController {
|
|||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
|
@ -147,6 +154,24 @@ public class ResourceController {
|
|||
return new Result<ResourceDTO>().ok(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将数据库内所有能力资源infoList字段补充完整
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/updateTest")
|
||||
public Result<String> updateTest() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
return new Result<String>().ok(LocalDateTime.now().toString());
|
||||
}
|
||||
|
||||
@GetMapping("/selectTotal")
|
||||
@ApiOperation("查询系统及本部门已汇聚能力")
|
||||
@LogOperation("查询系统及本部门已汇聚能力")
|
||||
|
@ -236,25 +261,21 @@ public class ResourceController {
|
|||
// 文件保存
|
||||
File file = new File(folder, newName);
|
||||
uploadFile.transferTo(file);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(0, dept, resourceService)).sheet(0).headRowNumber(1).doReadSync();
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(1, dept, resourceService)).sheet(1).headRowNumber(1).doReadSync();
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(2, dept, resourceService)).sheet(2).headRowNumber(1).doReadSync();
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService)).sheet(3).headRowNumber(1).doReadSync();
|
||||
});
|
||||
Thread.sleep(1000l);
|
||||
}
|
||||
Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(0, dept, resourceService, deptDTO.get().getId())).sheet(0).headRowNumber(1).doReadSync();
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(1, dept, resourceService, deptDTO.get().getId())).sheet(1).headRowNumber(1).doReadSync();
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(2, dept, resourceService, deptDTO.get().getId())).sheet(2).headRowNumber(1).doReadSync();
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService, deptDTO.get().getId())).sheet(3).headRowNumber(1).doReadSync();
|
||||
});
|
||||
} catch (IOException e) {
|
||||
return new Result<String>().error(e.getMessage());
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new Result().ok(LocalDateTime.now().toString());
|
||||
}
|
||||
|
@ -468,14 +489,27 @@ public class ResourceController {
|
|||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
|
||||
})
|
||||
public Result getByDept(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
public Result getByDept(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
return new Result().ok(resourceService.getByDept(params));
|
||||
}
|
||||
|
||||
@PostMapping("/trafficDeptResource")
|
||||
@ApiOperation("按天统计指定时间内本部门发布的资源")
|
||||
@LogOperation("按天统计指定时间内本部门发布的资源")
|
||||
public Result trafficDeptResource(@RequestBody JSONObject jsonObject) {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
String startDate = jsonObject.getString("startDate");
|
||||
String endDate = jsonObject.getString("endDate");
|
||||
resultMap.put("browseAvg", resourceService.selectDayAvg());
|
||||
resultMap.put("browseMax", resourceService.selectDayMax());
|
||||
resultMap.put("browseDayList", resourceService.trafficDeptResource(startDate, endDate));
|
||||
return new Result().ok(resultMap);
|
||||
}
|
||||
|
||||
@GetMapping("/selectTotalByDept")
|
||||
@ApiOperation("按照资源类型统计本部门发布的资源")
|
||||
@LogOperation("按照资源类型统计本部门发布的资源")
|
||||
public Result selectTotalByDept(){
|
||||
public Result selectTotalByDept() {
|
||||
return new Result().ok(resourceService.selectTotalByDept());
|
||||
}
|
||||
|
||||
|
@ -488,14 +522,14 @@ public class ResourceController {
|
|||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
|
||||
})
|
||||
public Result getApplyByDept(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
public Result getApplyByDept(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
return new Result().ok(resourceService.getApplyByDept(params));
|
||||
}
|
||||
|
||||
@GetMapping("/selectTotalApplyByDept")
|
||||
@ApiOperation("按照资源类型统计本部门申请的资源")
|
||||
@LogOperation("按照资源类型统计本部门申请的资源")
|
||||
public Result selectTotalApplyByDept(){
|
||||
public Result selectTotalApplyByDept() {
|
||||
return new Result().ok(resourceService.selectTotalApplyByDept());
|
||||
}
|
||||
|
||||
|
@ -506,7 +540,14 @@ public class ResourceController {
|
|||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"),
|
||||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int")
|
||||
})
|
||||
public Result selectDeptResourceByApplyNum(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
public Result selectDeptResourceByApplyNum(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
return new Result().ok(resourceService.selectDeptResourceByApplyNum(params));
|
||||
}
|
||||
|
||||
@GetMapping("/selectInfrastructureList")
|
||||
@ApiOperation("共享门户-能力汇聚-查询基础设施列表")
|
||||
@LogOperation("共享门户-能力汇聚-查询基础设施列表")
|
||||
public Result selectInfrastructureList() {
|
||||
return new Result().ok(resourceService.selectInfrastructureList());
|
||||
}
|
||||
}
|
|
@ -158,4 +158,10 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
List<ResourceDTO> selectCameraDTOById(@Param("id") Long id);
|
||||
|
||||
List<Map> selectDeptResourceByApplyNum(List<Long> deptIds);
|
||||
|
||||
List<Map> trafficDeptResource(Map params);
|
||||
|
||||
Long selectDayAvg(@Param("days") Long days);
|
||||
|
||||
Integer selectDayMax();
|
||||
}
|
|
@ -30,6 +30,8 @@ public class ResourceExcelImportListener extends AnalysisEventListener<Map<Integ
|
|||
|
||||
private List<Map<Integer, String>> list = new ArrayList<>();
|
||||
|
||||
private Long deptId;
|
||||
|
||||
Map<Integer, String> headMap = null;
|
||||
|
||||
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
@ -40,6 +42,13 @@ public class ResourceExcelImportListener extends AnalysisEventListener<Map<Integ
|
|||
this.resourceService = resourceService;
|
||||
}
|
||||
|
||||
public ResourceExcelImportListener(int sheet, List<Map<String, Object>> deptList, ResourceService resourceService, Long deptId) {
|
||||
this.sheet = sheet;
|
||||
this.deptList = deptList;
|
||||
this.resourceService = resourceService;
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
/**
|
||||
* When analysis one row trigger invoke function.
|
||||
*
|
||||
|
@ -85,7 +94,7 @@ public class ResourceExcelImportListener extends AnalysisEventListener<Map<Integ
|
|||
logger.info("找不到部门:{}", index.toString());
|
||||
deptOptional = Optional.of(new LinkedHashMap<String, Object>() {
|
||||
{
|
||||
put("id", 1516728214814113793L); // 包头市行政审批和政务服务服务局
|
||||
put("id", deptId == null ? 1516728214814113793L : deptId); // 包头市行政审批和政务服务服务局
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -119,4 +119,12 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
|||
|
||||
Object selectDeptResourceByApplyNum(Map<String, Object> params);
|
||||
|
||||
Object trafficDeptResource(String startDate, String endDate);
|
||||
|
||||
Object selectDayAvg();
|
||||
|
||||
Object selectDayMax();
|
||||
|
||||
Object selectInfrastructureList();
|
||||
|
||||
}
|
|
@ -14,7 +14,11 @@ import io.renren.common.constant.Constant;
|
|||
import io.renren.common.domain.Tsingtao_xhaProperties;
|
||||
import io.renren.common.page.PageData;
|
||||
import io.renren.common.service.impl.CrudServiceImpl;
|
||||
import io.renren.modules.activiti.dto.ProcessActivityDTO;
|
||||
import io.renren.common.utils.ConvertUtils;
|
||||
import io.renren.common.utils.DateUtils;
|
||||
import io.renren.modules.monitor.dto.CameraChannelDto1;
|
||||
import io.renren.modules.monitor.entity.CameraChannel;
|
||||
import io.renren.modules.monitor.mapper.CameraChannelMapper;
|
||||
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
||||
|
@ -36,9 +40,9 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
|||
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
||||
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.security.user.UserDetail;
|
||||
import io.renren.modules.sys.dao.SysDeptDao;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
@ -85,6 +89,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
private static final String selectDeptListKey = "selectDeptList";
|
||||
private static final String selectDTOPageSpecilTotalKey = "selectDTOPageSpecilTotal";
|
||||
|
||||
@Value("${system.startDay}")
|
||||
private String systemDay;
|
||||
|
||||
@Value("${project.place}")
|
||||
private Integer projectPlace;
|
||||
|
||||
|
@ -136,6 +143,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Autowired
|
||||
private SysDeptDao sysDeptDao;
|
||||
|
||||
@Autowired
|
||||
private CameraChannelMapper cameraChannelMapper;
|
||||
|
||||
@Autowired
|
||||
private TAbilityApplicationDao tAbilityApplicationDao;
|
||||
|
||||
|
@ -158,6 +168,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Autowired
|
||||
private TResourceMountApplyService tResourceMountApplyService;
|
||||
|
||||
@Autowired
|
||||
private SysDeptService deptService;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
|
||||
QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>();
|
||||
|
@ -189,7 +202,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void insertWithAttrs(ResourceDTO dto) {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
BeanUtils.copyProperties(dto, resourceEntity);
|
||||
|
@ -217,7 +230,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void deleteWithAttrs(JSONObject jsonObject) {
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("ids");
|
||||
List<Long> idList = jsonArray.toJavaList(Long.class);
|
||||
|
@ -231,7 +244,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void updateWithAttrs(ResourceDTO dto) {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
BeanUtils.copyProperties(dto, resourceEntity);
|
||||
|
@ -254,10 +267,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if (resourceDTO == null) {
|
||||
return null;
|
||||
}
|
||||
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("data_resource_id", id).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
|
||||
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
||||
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
|
||||
if (resourceDTO.getInfoList() == null) {
|
||||
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("data_resource_id", id).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
|
||||
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
||||
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
|
||||
}
|
||||
return resourceDTO;
|
||||
}
|
||||
|
||||
|
@ -301,13 +316,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
break;
|
||||
}
|
||||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
ResourceDTO index = (ResourceDTO) x;
|
||||
return index.getTotal() == null ? 0L : index.getTotal();
|
||||
}).reversed()).collect(Collectors.toList()));
|
||||
} else {
|
||||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null);
|
||||
}
|
||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
ResourceDTO index = (ResourceDTO) x;
|
||||
return index.getTotal() == null ? 0L : index.getTotal();
|
||||
}).reversed()).collect(Collectors.toList()));
|
||||
resultPage.setRecords(resourceDTOS);
|
||||
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
|
||||
} else {
|
||||
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
|
||||
|
@ -318,11 +334,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
} else {
|
||||
List<ResourceDTO> recordLists = resourceDTOS.stream()
|
||||
.skip((pageNum - 1) * pageSize).limit(pageSize)
|
||||
.peek(dto_ -> {
|
||||
ResourceDTO temp = dto_;
|
||||
ResourceDTO get = this.get(dto_.getId());
|
||||
.map(dto_ -> {
|
||||
ResourceDTO get = this.selectWithAttrs(dto_.getId());
|
||||
BeanUtils.copyProperties(get, dto_);
|
||||
dto_.setInfoList(temp.getInfoList());
|
||||
return dto_;
|
||||
}).collect(Collectors.toList());
|
||||
resultPage.setRecords(recordLists);
|
||||
resultPage.setTotal(resourceDTOS.size());
|
||||
|
@ -381,7 +396,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<Long> ids = new ArrayList<>();
|
||||
switch (orderType) {
|
||||
case "DESC": // total 倒序
|
||||
ids = selectDTOPageSpecilTotal.parallelStream().map(index -> (Map) index).sorted(Comparator.comparing(x -> {
|
||||
ids = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
|
@ -391,7 +406,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
).collect(Collectors.toList());
|
||||
break;
|
||||
case "ASC": // total 升序
|
||||
ids = selectDTOPageSpecilTotal.parallelStream().map(index -> (Map) index).sorted(Comparator.comparing(x -> {
|
||||
ids = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
String string = (x.get("total") == null) ? "0" : x.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
}
|
||||
|
@ -419,10 +434,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<ResourceDTO> recordLists = resourceDTOS.stream()
|
||||
.skip((pageNum - 1) * pageSize).limit(pageSize)
|
||||
.map(dto_ -> {
|
||||
ResourceDTO temp = dto_;
|
||||
ResourceDTO get = this.get(dto_.getId());
|
||||
ResourceDTO get = this.selectWithAttrs(dto_.getId());
|
||||
BeanUtils.copyProperties(get, dto_);
|
||||
dto_.setInfoList(temp.getInfoList());
|
||||
return dto_;
|
||||
}).collect(Collectors.toList());
|
||||
resultPage.setRecords(recordLists);
|
||||
|
@ -491,7 +504,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
});
|
||||
CompletableFuture all = CompletableFuture.allOf(cloud, local);
|
||||
all.join();
|
||||
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
|
||||
return result_.stream().filter(Objects::nonNull).findAny().orElse(0l);
|
||||
}).thenAccept(sum -> {
|
||||
re.add(new HashMap<String, Object>() {
|
||||
{
|
||||
|
@ -536,6 +549,20 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
put("type", "数据资源");
|
||||
}
|
||||
});
|
||||
|
||||
re.add(new HashMap<String, Object>() {
|
||||
{
|
||||
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("check_status", 1)
|
||||
.ne("gps_x", "")
|
||||
.ne("gps_y", "")
|
||||
.isNotNull("gps_x")
|
||||
.isNotNull("gps_y");
|
||||
put("count", cameraChannelMapper.selectCount(queryWrapper) + "");
|
||||
put("type", "基础设施");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -573,7 +600,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
ResourceEntity entity = new ResourceEntity();
|
||||
entity.setVisits((resourceEntity.getVisits() == null ? 0 : resourceEntity.getVisits()) + 1);
|
||||
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId()).eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
|
||||
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId())
|
||||
.eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
|
||||
resourceDao.update(entity, updateWrapper);
|
||||
ResourceBrowseEntity browseEntity = new ResourceBrowseEntity();
|
||||
browseEntity.setResourceId(id);
|
||||
|
@ -879,10 +907,16 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public Object getApplyCameraList(Long instanceId) {
|
||||
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("instance_id", instanceId);
|
||||
queryWrapper.eq("instance_id", instanceId)
|
||||
.eq("approve_status", "通过");
|
||||
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
|
||||
ArrayList cameraList = new ArrayList();
|
||||
applicationEntities.forEach(index -> cameraList.add(resourceDao.selectCameraDTOById(Long.parseLong(index.getResourceId()))));
|
||||
applicationEntities.forEach(index -> {
|
||||
List<CameraChannelDto1> channelDto1s = cameraChannelMapper.selectByChannelCode(index.getCameraList().replaceAll("\"", ""));
|
||||
if (!channelDto1s.isEmpty()) {
|
||||
cameraList.add(channelDto1s.get(0));
|
||||
}
|
||||
});
|
||||
return cameraList;
|
||||
}
|
||||
|
||||
|
@ -900,7 +934,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
* 同步知识库
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void KnowledgeBase() {
|
||||
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
|
||||
final int pageSize = 100;
|
||||
|
@ -1087,7 +1121,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
|
||||
result.addAll(partition.get(page));
|
||||
} else {
|
||||
return new PageData<>(result2, result2.size());
|
||||
return new PageData<>(result2, 0);
|
||||
}
|
||||
|
||||
ConcurrentHashMap hashMap = new ConcurrentHashMap();
|
||||
|
@ -1191,8 +1225,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> { //应用收藏量
|
||||
result.forEach(r -> {
|
||||
Object[] qu = {r.get("deptId")};
|
||||
Integer integer = baseDao.selectResourceCarNum(params);
|
||||
r.put("resourceCarNum", integer);
|
||||
Integer integer = baseDao.selectResourceCollectionNum(params);
|
||||
r.put("resourceCollectionNum", integer);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1363,9 +1397,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
//获取部门列表
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept");
|
||||
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept");
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
|
||||
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
|
@ -1375,34 +1409,42 @@ 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"));
|
||||
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
||||
maps.forEach(m -> {
|
||||
paraMap.put("id", m.get("id"));
|
||||
Map<String, Object> maps1 = new HashMap<>();
|
||||
maps1 = baseDao.assemblyCarByDept(paraMap);
|
||||
if (maps1 == null) {
|
||||
m.put("carNum", 0);
|
||||
} else {
|
||||
m.put("carNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
|
||||
}
|
||||
});
|
||||
});
|
||||
Map<String, Object> paraMap = new ConcurrentHashMap<>();
|
||||
paraMap.put("resourceType", params.get("resourceType"));
|
||||
//分别根据部门获取组件使用总数和调用数
|
||||
//申请数
|
||||
// CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
||||
// maps.forEach(m -> {
|
||||
// paraMap.put("id", m.get("deptId"));
|
||||
// Map<String, Object> maps1 = new HashMap<>();
|
||||
// maps1 = baseDao.assemblyCarByDept(paraMap);
|
||||
// if (maps1 == null) {
|
||||
// m.put("resourceCarNum", 0);
|
||||
// } else {
|
||||
// m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
//本部门的应用关联的组件数量
|
||||
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
|
||||
maps.forEach(m -> {
|
||||
paraMap.put("id", m.get("id"));
|
||||
paraMap.put("id", m.get("deptId"));
|
||||
Map<String, Object> maps2 = new HashMap<>();
|
||||
maps2 = baseDao.assemblyUseByDept(paraMap);
|
||||
if (maps2 == null) {
|
||||
m.put("useNum", 0);
|
||||
m.put("resourceUseNum", 0);
|
||||
} else {
|
||||
m.put("useNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
|
||||
m.put("resourceUseNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
|
||||
}
|
||||
});
|
||||
});
|
||||
//还缺少组件调用数,这先用假数据代替
|
||||
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
||||
maps.forEach(m -> {
|
||||
m.put("resourceCallNum",0);
|
||||
});
|
||||
});
|
||||
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
|
||||
all.join();
|
||||
|
@ -1422,9 +1464,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
Object[] ps = {params.get("id"), params.get("id")};
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept ");
|
||||
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept ");
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
|
||||
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
|
@ -1437,7 +1479,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
map.put("resourceType", params.get("resourceType"));
|
||||
|
||||
result.forEach(r -> {
|
||||
map.put("id", r.get("id"));
|
||||
map.put("id", r.get("deptId"));
|
||||
Map<String, Object> stringObjectMap = baseDao.assemblyCarByDept(map);
|
||||
if (stringObjectMap != null) {
|
||||
r.put("resourceCarNum", stringObjectMap.get("carNum"));
|
||||
|
@ -1454,8 +1496,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
Object[] ps = {params.get("resourceType"), params.get("id"), params.get("id"), (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()), Integer.parseInt(params.get("limit").toString())};
|
||||
result = jdbcTemplate.queryForList("SELECT a.* FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.resource_id = d.id WHERE a.del_flag = 0 " +
|
||||
"AND d.type = ? AND (c.id = ? or INSTR(c.pids,?)) order by a.create_date DESC LIMIT ?,?", ps);
|
||||
result = jdbcTemplate.queryForList("SELECT a.* FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d ON a.resource_id = d.id WHERE a.del_flag = 0 " +
|
||||
"AND d.type = ? AND (c.id = ? OR INSTR(c.pids,?)) ORDER BY a.create_date DESC LIMIT ?,?", ps);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1471,8 +1513,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
|
||||
}
|
||||
Long deptId = SecurityUser.getUser().getDeptId();
|
||||
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
|
||||
deptList.add(deptId);
|
||||
List<Long> deptList = null;
|
||||
if (deptId != null) {
|
||||
deptList = deptService.getSubDeptIdList(deptId);
|
||||
}
|
||||
boolean isAsc = false;
|
||||
if (params.get(Constant.ORDER) != null && "asc".equals(params.get(Constant.ORDER))) {
|
||||
isAsc = true;
|
||||
|
@ -1480,7 +1524,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
String orderColumn = params.get(Constant.ORDER_FIELD) == null ? "create_date" : (String) params.get(Constant.ORDER_FIELD);
|
||||
IPage<ResourceEntity> page = new Page<>(curPage, limit);
|
||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("dept_id", deptList).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
|
||||
if (deptList != null) {
|
||||
queryWrapper.in("dept_id", deptList);
|
||||
}
|
||||
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
|
||||
return resourceDao.selectPage(page, queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -1488,8 +1535,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
public Object selectTotalByDept() {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
Long deptId = SecurityUser.getUser().getDeptId();
|
||||
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
|
||||
deptList.add(deptId);
|
||||
List<Long> deptList = null;
|
||||
if (deptId != null) {
|
||||
deptList = deptService.getSubDeptIdList(deptId);
|
||||
}
|
||||
resultMap.put("total", resourceDao.selectCountByDepts(deptList));
|
||||
return resultMap;
|
||||
}
|
||||
|
@ -1521,7 +1570,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
IPage<ResourceEntity> page = new Page<>(curPage, limit);
|
||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", resourceIds).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
|
||||
return resourceDao.selectPage(page, queryWrapper);
|
||||
List<ResourceDTO> dtoList = ConvertUtils.sourceToTarget(resourceDao.selectPage(page, queryWrapper).getRecords(), ResourceDTO.class);
|
||||
dtoList.forEach(temp -> {
|
||||
Map p = new HashMap();
|
||||
p.put("resource_id", temp.getId());
|
||||
temp.setApplyCount(String.valueOf(tAbilityApplicationService.list(p).size()));
|
||||
});
|
||||
return new PageData<>(dtoList, dtoList.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1550,10 +1605,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if (params.get(Constant.LIMIT) != null) {
|
||||
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
|
||||
}
|
||||
Long deptId=SecurityUser.getUser().getDeptId();
|
||||
List<Long> deptList=sysDeptDao.getSubDeptIdList(deptId.toString());
|
||||
deptList.add(deptId);
|
||||
List<Map> result=resourceDao.selectDeptResourceByApplyNum(deptList);
|
||||
Long deptId = SecurityUser.getUser().getDeptId();
|
||||
List<Long> deptList = null;
|
||||
if (deptId != null) {
|
||||
deptList = deptService.getSubDeptIdList(deptId);
|
||||
}
|
||||
List<Map> result = resourceDao.selectDeptResourceByApplyNum(deptList);
|
||||
Page<Map> page = new Page(curPage, limit);
|
||||
int j = Math.min(curPage * limit, result.size());
|
||||
if (result.isEmpty()) {
|
||||
|
@ -1570,6 +1627,67 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object trafficDeptResource(String startDate, String endDate) {
|
||||
Map params = new HashMap();
|
||||
params.put("startDate", startDate);
|
||||
params.put("endDate", endDate);
|
||||
Long deptId = SecurityUser.getUser().getDeptId();
|
||||
List<Long> deptList = null;
|
||||
if (deptId != null) {
|
||||
deptList = deptService.getSubDeptIdList(deptId);
|
||||
}
|
||||
params.put("deptIds", deptList);
|
||||
List<Map> maps = resourceDao.trafficDeptResource(params);
|
||||
Date startDay = DateUtils.parse(startDate, DateUtils.DATE_PATTERN);
|
||||
Date endDay = DateUtils.parse(endDate, DateUtils.DATE_PATTERN);
|
||||
ArrayList<String> dayList = new ArrayList<>();
|
||||
while (startDay.before(endDay) || startDay.compareTo(endDay) == 0) {
|
||||
dayList.add(DateUtils.format(startDay, DateUtils.DATE_PATTERN));
|
||||
startDay = DateUtils.addDateDays(startDay, 1);
|
||||
}
|
||||
ArrayList<Map<String, Object>> resultMap = new ArrayList<>();
|
||||
for (String s : dayList) {
|
||||
HashMap<String, Object> dayMap = new HashMap<>();
|
||||
dayMap.put(s, 0);
|
||||
for (Map map : maps) {
|
||||
if (s.equals(map.get("date"))) {
|
||||
dayMap.put(s, map.get("count"));
|
||||
}
|
||||
}
|
||||
resultMap.add(dayMap);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectDayAvg() {
|
||||
Date startDay = DateUtils.stringToDate(systemDay, DateUtils.DATE_PATTERN);
|
||||
Date today = new Date();
|
||||
Long days = (today.getTime() - startDay.getTime()) / (1000 * 60 * 60 * 24);
|
||||
return resourceDao.selectDayAvg(days);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectDayMax() {
|
||||
return resourceDao.selectDayMax();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectInfrastructureList() {
|
||||
return new HashMap<String, Object>() {{
|
||||
Map map = (Map) selectTotal();
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("total");
|
||||
list.forEach(index -> {
|
||||
if ("基础设施".equals(index.get("type").toString())) {
|
||||
put("视频资源", Integer.parseInt(index.get("count").toString()));
|
||||
}
|
||||
});
|
||||
put("感知资源", 0);
|
||||
put("云资源", 0);
|
||||
}};
|
||||
}
|
||||
|
||||
private List<Long> getSourceIdsByProcess(List<HistoricProcessInstance> list) {
|
||||
List<Long> resourceIds = new ArrayList<>();
|
||||
for (HistoricProcessInstance his : list) {
|
||||
|
|
|
@ -58,6 +58,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
|
|||
selectMap.put("user_id", userId);
|
||||
selectMap.put("del_flag", 0);
|
||||
List<ResourceCarEntity> carEntities = resourceCarDao.selectByMap(selectMap);
|
||||
//TODO: 固定资源id改为配置文件
|
||||
if (carEntities.isEmpty() || dto.getResourceId() == 8888888880000000001L) {
|
||||
ResourceCarEntity carEntity = new ResourceCarEntity();
|
||||
dto.setUserId(userId);
|
||||
|
|
|
@ -73,11 +73,11 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
|
|||
List<ResourceCollectionEntity> collectionEntities = resourceCollectionDao.selectByMap(selectMap);
|
||||
if (collectionEntities.isEmpty()) {
|
||||
resourceCollectionDao.insert(item);
|
||||
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 =" + item.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 =" + item.getResourceId());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ public class TResourceMountApplyServiceImpl extends CrudServiceImpl<TResourceMou
|
|||
QueryWrapper<TResourceMountApplyEntity> wrapper = new QueryWrapper<>();
|
||||
if (params.containsKey("creator")) { //查该用户创建的资源
|
||||
wrapper.eq("creator", Long.valueOf(params.get("creator").toString()));
|
||||
}else if(params.containsKey("resource_id")){
|
||||
wrapper.eq("resource_id", Long.valueOf(params.get("resource_id").toString()));
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
|
|
|
@ -3,25 +3,18 @@ package io.renren.modules.security.oauth2;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.yawei.pso.PSORequest;
|
||||
import com.yawei.pso.SSOResponse;
|
||||
import com.yawei.pso.TicketManager;
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.interceptor.YaweiSSOProperties;
|
||||
import io.renren.common.utils.Result;
|
||||
import io.renren.modules.security.service.SysUserTokenService;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.entity.SysUserEntity;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
|
||||
import org.jasig.cas.client.authentication.AuthenticationFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -31,9 +24,6 @@ import javax.servlet.http.Cookie;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -44,14 +34,13 @@ import java.util.Map;
|
|||
public class Oauth2Filter extends AuthenticatingFilter {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysUserTokenService sysUserTokenService;
|
||||
|
||||
@Autowired
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@Autowired
|
||||
@Autowired(required = false)
|
||||
private SSOValidator ssoValidator;
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +63,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
|||
String currentToken = getRequestToken((HttpServletRequest) request);
|
||||
if (StringUtils.isBlank(currentToken))
|
||||
return false;
|
||||
else if (SecurityUser.getUser().getUsername() == null){
|
||||
else if (SecurityUser.getUser().getUsername() == null) {
|
||||
//跨域名情况下使用,这种方法不大正经,再想想办法
|
||||
try {
|
||||
return executeLogin(request, response);
|
||||
|
@ -95,8 +84,8 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
|||
|
||||
if (ssoValidator != null) {
|
||||
return ssoHandle((HttpServletRequest) request, (HttpServletResponse) response);
|
||||
}else {
|
||||
((HttpServletResponse)response).addHeader("REDIRECT", "/#/login");
|
||||
} else {
|
||||
((HttpServletResponse) response).addHeader("REDIRECT", "/#/login");
|
||||
|
||||
}
|
||||
return false;
|
||||
|
@ -178,7 +167,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
|||
}
|
||||
|
||||
String principal = ssoValidator.validatePrincipal(requestUri);
|
||||
if (principal != null){
|
||||
if (principal != null) {
|
||||
//认证通过
|
||||
LambdaQueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<SysUserEntity>().lambda()
|
||||
.eq(SysUserEntity::getUsername, principal);
|
||||
|
@ -197,7 +186,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
|||
response.addHeader("REDIRECT", removeCreditParame);
|
||||
request.setAttribute(Constant.TOKEN_HEADER, currentToken);
|
||||
return executeLogin(request, response);
|
||||
}else {
|
||||
} else {
|
||||
send401Error(response, "未找到相关用户");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,14 @@ public class WorkDynamicsController {
|
|||
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("/getDeptWork")
|
||||
@ApiOperation("查询用户所在部门的工作动态")
|
||||
@LogOperation("查询用户所在部门的工作动态")
|
||||
public Result<PageData<WorkDynamicsDTO>> getDeptWork(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
PageData<WorkDynamicsDTO> page = workDynamicsService.getDeptWork(params);
|
||||
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("/select/{id}")
|
||||
@ApiOperation("查询工作动态详细信息")
|
||||
@LogOperation("查询工作动态详细信息")
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package io.renren.modules.workDynamics.service;
|
||||
|
||||
import io.renren.common.page.PageData;
|
||||
import io.renren.common.service.CrudService;
|
||||
import io.renren.modules.workDynamics.dto.WorkDynamicsDTO;
|
||||
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作动态
|
||||
*
|
||||
|
@ -13,4 +16,6 @@ import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
|
|||
public interface WorkDynamicsService extends CrudService<WorkDynamicsEntity, WorkDynamicsDTO> {
|
||||
|
||||
void deleteByIds(Long[] ids);
|
||||
|
||||
PageData<WorkDynamicsDTO> getDeptWork(Map<String, Object> params);
|
||||
}
|
|
@ -2,7 +2,14 @@ package io.renren.modules.workDynamics.service.impl;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.page.PageData;
|
||||
import io.renren.common.service.impl.CrudServiceImpl;
|
||||
import io.renren.common.utils.ConvertUtils;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import io.renren.modules.workDynamics.dao.WorkDynamicsDao;
|
||||
import io.renren.modules.workDynamics.dto.WorkDynamicsDTO;
|
||||
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
|
||||
|
@ -10,7 +17,10 @@ import io.renren.modules.workDynamics.service.WorkDynamicsService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工作动态
|
||||
|
@ -24,6 +34,9 @@ public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, Wo
|
|||
@Autowired
|
||||
private WorkDynamicsDao workDynamicsDao;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<WorkDynamicsEntity> getWrapper(Map<String, Object> params){
|
||||
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
|
||||
|
@ -40,4 +53,26 @@ public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, Wo
|
|||
public void deleteByIds(Long[] ids) {
|
||||
workDynamicsDao.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageData<WorkDynamicsDTO> getDeptWork(Map<String, Object> params) {
|
||||
Integer curPage = 1;
|
||||
Integer limit = 10;
|
||||
if (params.get(Constant.PAGE) != null) {
|
||||
curPage = Integer.parseInt((String) params.get(Constant.PAGE));
|
||||
}
|
||||
if (params.get(Constant.LIMIT) != null) {
|
||||
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
|
||||
}
|
||||
List<SysUserDTO> sysUserList = sysUserService.list(new HashMap());
|
||||
List<Long> userIdList=sysUserList.stream().map(user->user.getId()).collect(Collectors.toList());
|
||||
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("del_flag", 0);
|
||||
if(userIdList.size()>0){
|
||||
wrapper.in("creator", userIdList);
|
||||
}
|
||||
IPage<WorkDynamicsEntity> page = new Page<>(curPage, limit);
|
||||
List<WorkDynamicsDTO> result=ConvertUtils.sourceToTarget(workDynamicsDao.selectPage(page, wrapper).getRecords(), WorkDynamicsDTO.class);
|
||||
return new PageData<WorkDynamicsDTO>(result, result.size());
|
||||
}
|
||||
}
|
|
@ -81,6 +81,9 @@ qdyjj:
|
|||
yawei:
|
||||
enable: false
|
||||
|
||||
sso:
|
||||
mode:
|
||||
|
||||
##多数据源的配置,需要引用renren-dynamic-datasource
|
||||
#dynamic:
|
||||
# datasource:
|
||||
|
|
|
@ -114,7 +114,7 @@ zsk:
|
|||
catalogIds: c0645e03fb7e4cf3842e9ceedd8ab998,f49561afc7204f008c4bb3cd821eb6ba
|
||||
|
||||
sso:
|
||||
mode: yawei # 取值 yawei,cas
|
||||
mode: yawei # 取值 yawei,cas,不填时为禁用sso
|
||||
|
||||
cas:
|
||||
server-url-prefix: http://10.134.135.81:11188/cas
|
||||
|
|
|
@ -1,17 +1,3 @@
|
|||
-- 删除索引
|
||||
alter table `tb_resource_collection` drop index `resourceid`;
|
||||
alter table `tb_resource_car` drop index `resourceid`;
|
||||
alter table `tb_resource_score` drop index `resourceid`;
|
||||
alter table `tb_resource_browse` drop index `resourceid`;
|
||||
alter table `t_ability_application` drop index `resourceid`;
|
||||
alter table `t_ability_application` drop index `userId`;
|
||||
alter table `tb_data_resource` drop index `type`;
|
||||
alter table `tb_data_attr` drop index `attr_value`;
|
||||
alter table `tb_data_resource` drop index `name`;
|
||||
alter table `tb_data_resource` drop index `deptId`;
|
||||
alter table `sys_dept` drop index `type`;
|
||||
alter table `sys_dept` drop index `district`;
|
||||
alter table `tb_resource_collection` drop index `userId`;
|
||||
-- 创建索引
|
||||
alter table `tb_resource_collection` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '收藏的资源id';
|
||||
alter table `tb_resource_car` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '加入申购车的id';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
alter table `t_ability_application`
|
||||
ADD COLUMN `title` longtext NULL comment '能力申请标题' AFTER `cameraList`,
|
||||
ADD COLUMN `title` longtext NULL comment '能力申请标题',
|
||||
ADD COLUMN `application_system` varchar(255) NULL comment '应用系统' AFTER `title`,
|
||||
ADD COLUMN `application_scene` varchar(255) NULL comment '应用场景' AFTER `application_system`,
|
||||
ADD COLUMN `application_background` longtext NULL comment '应用背景' AFTER `application_scene`,
|
||||
|
|
|
@ -38,10 +38,12 @@
|
|||
count(id) AS "count"
|
||||
FROM t_demand_data
|
||||
WHERE 1=1
|
||||
AND apply_user_dept_id in
|
||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
<if test="null != list">
|
||||
AND apply_user_dept_id in
|
||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY flag
|
||||
ORDER BY flag
|
||||
</select>
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="enclosure" column="enclosure"/>
|
||||
<result property="gatewayCode" column="gateway_code"/>
|
||||
<result property="cameraList" column="camera_list"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="cameraList" column="camera_list"/>
|
||||
<result property="applicationScene" column="application_scene"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
</resultMap>
|
||||
|
@ -30,7 +29,7 @@
|
|||
update t_ability_application set instance_id = #{instanceId} where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getByInstanceId" resultType="io.renren.modules.processForm.entity.TAbilityApplicationEntity">
|
||||
<select id="getByInstanceId" resultMap="tAbilityApplicationMap">
|
||||
SELECT
|
||||
t1.*
|
||||
FROM
|
||||
|
@ -39,7 +38,7 @@
|
|||
t1.instance_id = #{instanceId}
|
||||
</select>
|
||||
|
||||
<select id="getByBusinessKey" resultType="io.renren.modules.processForm.entity.TAbilityApplicationEntity">
|
||||
<select id="getByBusinessKey" resultMap="tAbilityApplicationMap">
|
||||
SELECT
|
||||
t1.*
|
||||
FROM
|
||||
|
@ -50,24 +49,73 @@
|
|||
|
||||
<select id="countApplyAll" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT( id )
|
||||
SUM( count )
|
||||
FROM
|
||||
t_ability_application
|
||||
WHERE
|
||||
approve_status = '通过'
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 ) AS count
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
COUNT( id )
|
||||
FROM
|
||||
t_ability_application
|
||||
WHERE
|
||||
resource_id != 8888888880000000001
|
||||
AND instance_id != ''
|
||||
AND instance_id IS NOT NULL
|
||||
AND camera_list != ''
|
||||
AND camera_list IS NOT NULL
|
||||
GROUP BY
|
||||
instance_id
|
||||
) temp UNION
|
||||
SELECT
|
||||
COUNT( taa.id )
|
||||
FROM
|
||||
t_ability_application taa,
|
||||
tb_data_resource tdr
|
||||
WHERE
|
||||
1 = 1
|
||||
AND taa.resource_id = tdr.id
|
||||
AND tdr.type != '赋能案例'
|
||||
AND tdr.del_flag = 0
|
||||
GROUP BY
|
||||
tdr.type
|
||||
) temp2
|
||||
</select>
|
||||
|
||||
<select id="getAmountGroupByType" resultType="java.util.Map">
|
||||
SELECT
|
||||
tbr.type AS type,
|
||||
COUNT( taa.id ) AS amount
|
||||
'基础设施' AS 'type',
|
||||
COUNT( 1 ) AS 'amount'
|
||||
FROM
|
||||
t_ability_application AS taa
|
||||
INNER JOIN tb_data_resource AS tbr ON taa.resource_id = tbr.id
|
||||
(
|
||||
SELECT
|
||||
COUNT( id )
|
||||
FROM
|
||||
t_ability_application
|
||||
WHERE
|
||||
resource_id != 8888888880000000001
|
||||
AND instance_id != ''
|
||||
AND instance_id IS NOT NULL
|
||||
AND camera_list != ''
|
||||
AND camera_list IS NOT NULL
|
||||
GROUP BY
|
||||
instance_id
|
||||
) temp UNION
|
||||
SELECT
|
||||
tdr.type,
|
||||
COUNT( taa.id )
|
||||
FROM
|
||||
t_ability_application taa,
|
||||
tb_data_resource tdr
|
||||
WHERE
|
||||
taa.approve_status = '通过'
|
||||
1 = 1
|
||||
AND taa.resource_id = tdr.id
|
||||
AND tdr.type != '赋能案例'
|
||||
AND tdr.del_flag = 0
|
||||
GROUP BY
|
||||
tbr.type
|
||||
tdr.type
|
||||
</select>
|
||||
|
||||
<select id="selectDeptApplyCount" resultType="java.util.Map">
|
||||
|
|
|
@ -74,22 +74,24 @@
|
|||
<result property="score" column="score"/>
|
||||
<result property="applyState" column="applyState"/>
|
||||
<result property="applyCount" column="applyCount"/>
|
||||
<collection property="infoList" javaType="List" ofType="attrEntity">
|
||||
<result property="id" column="id"/>
|
||||
<result property="dataResourceId" column="data_resource_id"/>
|
||||
<result property="attrType" column="attr_type"/>
|
||||
<result property="attrValue" column="attr_value"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="createDate" column="create_date"/>
|
||||
<result property="updater" column="updater"/>
|
||||
<result property="updateDate" column="update_date"/>
|
||||
<result property="note1" column="note1"/>
|
||||
<result property="note2" column="note2"/>
|
||||
<result property="note3" column="note3"/>
|
||||
<result property="note4" column="note4"/>
|
||||
<result property="note5" column="note5"/>
|
||||
</collection>
|
||||
<result property="infoList" column="info_list"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<!-- <collection property="infoList" javaType="List" ofType="attrEntity">-->
|
||||
<!-- <result property="id" column="id"/>-->
|
||||
<!-- <result property="dataResourceId" column="data_resource_id"/>-->
|
||||
<!-- <result property="attrType" column="attr_type"/>-->
|
||||
<!-- <result property="attrValue" column="attr_value"/>-->
|
||||
<!-- <result property="delFlag" column="del_flag"/>-->
|
||||
<!-- <result property="creator" column="creator"/>-->
|
||||
<!-- <result property="createDate" column="create_date"/>-->
|
||||
<!-- <result property="updater" column="updater"/>-->
|
||||
<!-- <result property="updateDate" column="update_date"/>-->
|
||||
<!-- <result property="note1" column="note1"/>-->
|
||||
<!-- <result property="note2" column="note2"/>-->
|
||||
<!-- <result property="note3" column="note3"/>-->
|
||||
<!-- <result property="note4" column="note4"/>-->
|
||||
<!-- <result property="note5" column="note5"/>-->
|
||||
<!-- </collection>-->
|
||||
</resultMap>
|
||||
|
||||
<update id="deleteByIds">
|
||||
|
@ -106,6 +108,8 @@
|
|||
<select id="selectWithAttrs" resultMap="resourceDTO">
|
||||
SELECT
|
||||
DISTINCT tdr.id,
|
||||
tdr.create_date,
|
||||
tdr.visits,
|
||||
IFNULL(taa2.approve_status, '未申请') AS "applyState",
|
||||
IFNULL(trs.score, 0 ) AS "score",
|
||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||
|
@ -187,6 +191,7 @@
|
|||
<if test="type != null and type != ''">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
AND type != '赋能案例'
|
||||
GROUP BY type
|
||||
ORDER BY type
|
||||
</select>
|
||||
|
@ -320,7 +325,7 @@
|
|||
AND tdr.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectDTOPage" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
||||
<select id="selectDTOPage" resultMap="resourceDTO">
|
||||
SELECT
|
||||
tdr.id,
|
||||
tdr.`type`,
|
||||
|
@ -417,6 +422,7 @@
|
|||
tb_data_resource tdr
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
<if test="dto.name != null and dto.name != ''">
|
||||
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
|
||||
</if>
|
||||
|
@ -513,6 +519,7 @@
|
|||
tb_data_resource
|
||||
WHERE
|
||||
del_flag = 0
|
||||
AND type != '赋能案例'
|
||||
GROUP BY
|
||||
type
|
||||
</select>
|
||||
|
@ -1055,8 +1062,9 @@
|
|||
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
|
||||
COUNT( tdav.data_resource_id ) AS total
|
||||
FROM
|
||||
(select a.* from tb_data_attr a inner join tb_data_resource c on a.data_resource_id = c.id where c.type =
|
||||
#{resourceType} AND c.dept_id = #{id} ) tdav
|
||||
(SELECT a.* FROM tb_data_attr a INNER JOIN tb_data_resource c ON a.data_resource_id = c.id
|
||||
INNER JOIN sys_dept b ON c.dept_id = b.id WHERE c.type =
|
||||
#{resourceType} AND (b.id = #{id} OR INSTR(b.pids,#{id})) ) tdav
|
||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
||||
';', '' ) ) + 1 )
|
||||
WHERE
|
||||
|
@ -1072,10 +1080,17 @@
|
|||
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
|
||||
COUNT( tdav.data_resource_id ) AS total
|
||||
FROM
|
||||
( select a.* from tb_data_attr a inner join tb_data_resource d on a.data_resource_id = d.id
|
||||
inner join tb_data_resource_rel e on e.reference_id = d.id inner join sys_user f on e.creator = f.id where
|
||||
d.type=#{resourceType}
|
||||
and f.dept_id = #{id}
|
||||
(
|
||||
SELECT b.* FROM
|
||||
(
|
||||
SELECT DISTINCT(c.id) AS id FROM
|
||||
(
|
||||
SELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
|
||||
WHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = #{id} OR INSTR(b.pids,#{id}))
|
||||
) a
|
||||
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
|
||||
WHERE b.del_flag = 0 AND c.type = #{resourceType} AND c.del_flag = 0
|
||||
) a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id AND b.del_flag = 0
|
||||
) tdav
|
||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
||||
';', '' ) ) + 1 )
|
||||
|
@ -1159,10 +1174,12 @@
|
|||
tb_data_resource b
|
||||
ON
|
||||
a.resource_id = b.id
|
||||
INNER JOIN sys_dept c
|
||||
ON b.dept_id = c.id
|
||||
WHERE
|
||||
a.del_flag = 0
|
||||
a.del_flag = 0 AND b.del_flag = 0
|
||||
<if test="id != null and id != ''">
|
||||
and b.dept_id = #{id}
|
||||
and (c.id= #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
|
@ -1177,10 +1194,12 @@
|
|||
tb_data_resource b
|
||||
ON
|
||||
a.resource_id = b.id
|
||||
INNER JOIN sys_dept c
|
||||
ON b.dept_id = c.id
|
||||
WHERE
|
||||
a.del_flag = 0
|
||||
a.del_flag = 0 AND b.del_flag = 0
|
||||
<if test="id != null and id != ''">
|
||||
and b.dept_id = #{id}
|
||||
and (c.id = #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
|
@ -1194,10 +1213,12 @@
|
|||
tb_data_resource b
|
||||
ON
|
||||
a.resource_id = b.id
|
||||
INNER JOIN sys_dept c
|
||||
ON b.dept_id = c.id
|
||||
WHERE
|
||||
a.state = 0
|
||||
a.state = 0 AND b.del_flag = 0
|
||||
<if test="id != null and id != ''">
|
||||
and b.dept_id = #{id}
|
||||
and (c.id = #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
|
@ -1211,32 +1232,35 @@
|
|||
tb_data_resource b
|
||||
ON
|
||||
a.reference_id = b.id
|
||||
INNER JOIN sys_dept c
|
||||
ON b.dept_id = c.id
|
||||
WHERE
|
||||
a.del_flag = 0
|
||||
a.del_flag = 0 AND b.del_flag = 0
|
||||
<if test="id != null and id != ''">
|
||||
and b.dept_id = #{id}
|
||||
and (c.id = #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectResourceShare" parameterType="java.util.Map" resultType="integer">
|
||||
SELECT COUNT(id) AS nums
|
||||
SELECT COUNT(a.id) AS nums
|
||||
FROM
|
||||
tb_data_resource
|
||||
tb_data_resource a
|
||||
INNER JOIN sys_dept b
|
||||
ON a.dept_id = b.id
|
||||
WHERE
|
||||
del_flag = 0
|
||||
a.del_flag = 0
|
||||
<if test="id != null and id != ''">
|
||||
and
|
||||
dept_id = #{id}
|
||||
and (b.id = #{id} OR INSTR(b.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND
|
||||
type = #{resourceType}
|
||||
a.type = #{resourceType}
|
||||
</if>
|
||||
<if test="shareCondition != null and shareCondition != ''">
|
||||
AND
|
||||
share_condition = #{shareCondition}
|
||||
a.share_condition = #{shareCondition}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
@ -1278,16 +1302,19 @@
|
|||
|
||||
<!-- 根据组件类型查询部门申请组件的数量-->
|
||||
<select id="assemblyCarByDept" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT COUNT(distinct(a.resource_id)) as carNum,c.id FROM tb_resource_car a INNER JOIN sys_user b ON a.creator =
|
||||
b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.resource_id = d.id
|
||||
WHERE a.del_flag = 0 AND d.type = #{resourceType} AND (c.id =#{id} or INSTR(c.pids,#{id})) group by c.id
|
||||
SELECT COUNT(a.id) as carNum FROM tb_resource_car a INNER JOIN sys_user b ON a.user_id = b.id INNER JOIN sys_dept c
|
||||
ON b.dept_id = c.id INNER JOIN tb_data_resource d ON a.resource_id = d.id
|
||||
WHERE a.del_flag = 0 AND (c.id = #{id} OR INSTR(c.pids,#{id})) AND d.type = #{resourceType} AND d.del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--根据组件类型查询部门使用组件的数量-->
|
||||
<select id="assemblyUseByDept" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT COUNT(distinct(a.key_id)) as useNum,c.id FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator =
|
||||
b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.key_id = d.id
|
||||
WHERE a.del_flag = 0 AND d.type = #{resourceType} AND (c.id = #{id} or INSTR(c.pids,#{id} )) group by c.id
|
||||
SELECT COUNT(DISTINCT(b.reference_id)) AS useNum FROM
|
||||
(
|
||||
SELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
|
||||
WHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = #{id} OR INSTR(b.pids,#{id}))
|
||||
) a
|
||||
INNER JOIN tb_data_resource_rel b ON a.id = b.key_id WHERE b.del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="selectCountByDepts" resultType="java.util.Map">
|
||||
|
@ -1297,10 +1324,12 @@
|
|||
FROM tb_data_resource
|
||||
WHERE 1=1
|
||||
AND del_flag = 0
|
||||
AND dept_id in
|
||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
<if test="null != list">
|
||||
AND dept_id in
|
||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY type
|
||||
ORDER BY type
|
||||
</select>
|
||||
|
@ -1321,16 +1350,60 @@
|
|||
</select>
|
||||
|
||||
<select id="selectDeptResourceByApplyNum" resultType="java.util.Map">
|
||||
SELECT count(trma.id) as count, tdr.name
|
||||
FROM tb_data_resource tdr left join t_resource_mount_apply trma on tdr.id=trma.resource_id
|
||||
where tdr.dept_id in
|
||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
SELECT count(taa.id) as count, tdr.name
|
||||
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
|
||||
<if test="null != list">
|
||||
where tdr.dept_id in
|
||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by tdr.id order by count desc
|
||||
</select>
|
||||
|
||||
<select id="trafficDeptResource" resultType="java.util.Map">
|
||||
SELECT
|
||||
SUBSTR(create_date, 1, 10) AS "date",
|
||||
COUNT( id ) AS "count"
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
WHERE
|
||||
1 = 1
|
||||
AND del_flag = 0
|
||||
<if test="null != deptIds">
|
||||
AND tdr.dept_id IN
|
||||
<foreach item="deptId" collection="deptIds" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND SUBSTR(create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
|
||||
GROUP BY
|
||||
SUBSTR(create_date, 1, 10)
|
||||
</select>
|
||||
|
||||
<select id="selectDayAvg" resultType="java.lang.Long">
|
||||
SELECT IFNULL(COUNT(id), 0) / ${days}
|
||||
FROM tb_data_resource
|
||||
WHERE 1 = 1
|
||||
AND del_flag=0
|
||||
</select>
|
||||
|
||||
<select id="selectDayMax" resultType="java.lang.Integer">
|
||||
SELECT IFNULL(MAX(count), 0)
|
||||
FROM
|
||||
(SELECT
|
||||
COUNT( id ) AS "count"
|
||||
FROM
|
||||
tb_data_resource
|
||||
WHERE
|
||||
1 = 1
|
||||
AND del_flag = 0
|
||||
GROUP BY
|
||||
SUBSTR(create_date, 1, 10)) temp
|
||||
</select>
|
||||
|
||||
<select id="selectCameraDTOById" resultMap="resourceDTO">
|
||||
SELECT tdr.*, tda.* FROM tb_data_resource tdr, tb_data_attr tda WHERE tdr.id = tda.data_resource_id AND tdr.del_flag = 0 AND tdr.id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -72,12 +72,10 @@
|
|||
|
||||
<select id="getApp4PartById" resultType="java.util.Map">
|
||||
SELECT
|
||||
tdrr.reference_id AS id,
|
||||
tdr.name,
|
||||
tdr.*
|
||||
FROM
|
||||
tb_data_resource_rel tdrr
|
||||
LEFT JOIN tb_data_resource tdr ON tdrr.reference_id = tdr.id
|
||||
LEFT JOIN tb_data_resource tdr ON tdrr.key_id = tdr.id
|
||||
WHERE
|
||||
tdrr.del_flag = 0
|
||||
AND tdr.del_flag = 0
|
||||
|
|
|
@ -88,12 +88,40 @@
|
|||
res.description,
|
||||
res.type,
|
||||
res.del_flag AS "delFlag",
|
||||
car.note1
|
||||
car.note1,
|
||||
car.create_date AS "time",
|
||||
tda.attr_value AS "componentType"
|
||||
FROM
|
||||
tb_resource_car car,
|
||||
tb_data_resource res,
|
||||
tb_data_attr tda
|
||||
WHERE 1 = 1
|
||||
AND car.resource_id = res.id
|
||||
AND res.id = tda.data_resource_id
|
||||
AND car.resource_id != 8888888880000000001
|
||||
AND tda.attr_type = '组件类型'
|
||||
AND tda.del_flag = 0
|
||||
AND car.user_id = #{userId}
|
||||
AND res.dept_id = #{deptId}
|
||||
AND car.del_flag = 0
|
||||
UNION
|
||||
SELECT
|
||||
car.id AS "id",
|
||||
res.id AS "resourceId",
|
||||
'申请摄像头列表' AS "resourceName",
|
||||
res.description,
|
||||
res.type,
|
||||
0 AS "delFlag",
|
||||
car.note1,
|
||||
car.create_date AS "time",
|
||||
"" AS "componentType"
|
||||
FROM
|
||||
tb_resource_car car,
|
||||
tb_data_resource res
|
||||
WHERE 1 = 1
|
||||
WHERE
|
||||
1 = 1
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue