初步完成赋能场景、开发文档,融合服务修复

This commit is contained in:
lizhicheng 2022-07-14 15:33:41 +08:00
parent bc44f875b2
commit 647adaf461
12 changed files with 82 additions and 6 deletions

View File

@ -0,0 +1,5 @@
ALTER TABLE `tb_fuse`
ADD COLUMN `type` varchar(128) NULL COMMENT '服务类型';
ALTER TABLE `tb_fuse_attr`
MODIFY COLUMN `attr_value` varchar(4096) NULL COMMENT '属性值';

View File

@ -47,6 +47,7 @@ public class FuseController {
@ApiImplicitParam(name = Constant.ORDER, required = true, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "融合服务名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "融合服务类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "deptUser", value = "部门联系人", paramType = "query", dataType = "String"),

View File

@ -23,6 +23,8 @@ public class TbFuseDTO {
private String name;
@ApiModelProperty(value = "融合服务描述")
private String description;
@ApiModelProperty(value = "融合服务类型,可选值(融合服务,赋能场景)")
private String type;
@ApiModelProperty(value = "应用领域")
private String applicationArea;
@ApiModelProperty(value = "所属部门")

View File

@ -30,6 +30,10 @@ public class TbFuseEntity extends BaseEntity {
* 融合服务描述
*/
private String description;
/**
* 融合服务类型
*/
private String type;
/**
* 应用领域
*/

View File

@ -62,6 +62,9 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
case "description":
wrapper.like(StringUtils.isNotBlank(params.get("description").toString()), "description", params.get("description").toString());
break;
case "type":
wrapper.like(StringUtils.isNotBlank(params.get("type").toString()), "type", params.get("type").toString());
break;
case "applicationArea":
wrapper.like(StringUtils.isNotBlank(params.get("applicationArea").toString()), "application_area", params.get("applicationArea").toString());
break;

View File

@ -559,4 +559,11 @@ public class ResourceController {
public Result list(@ApiIgnore @RequestParam Map<String, Object> params){
return new Result<>().ok(resourceService.list(params));
}
@GetMapping("/selectDevelopDoc")
@ApiOperation("查询能力开发文档目录")
@LogOperation("查询能力开发文档目录")
public Result<List<Map>> selectDevelopDoc() {
return new Result<List<Map>>().ok(resourceService.selectDevelopDoc());
}
}

View File

@ -166,4 +166,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
Integer selectDayMax();
List<ResourceDTO> selectUsersApplyAndCount(@Param("userIds") List<Long> userIds);
List<Map<String, Object>> selectDevelopDocResource();
}

View File

@ -130,4 +130,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
void createMixAbility(ResourceDTO dto);
List<Map> selectDevelopDoc();
}

View File

@ -1790,4 +1790,45 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resourceIds;
}
@Override
public List<Map> selectDevelopDoc() {
List<Map> result = new ArrayList<>();
List<Map<String, Object>> dtoMaps = baseDao.selectDevelopDocResource();
Map<String, List<Map<String, Object>>> resourceTypeMap = dtoMaps.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
resourceTypeMap.entrySet().stream().forEach(temp -> {
if (!"组件服务".equals(temp.getKey())) {
Map map = new HashMap();
map.put("title", temp.getKey());
map.put("children", temp.getValue());
result.add(map);
}
});
if (resourceTypeMap.get("组件服务") != null) {
Map componentMap = new HashMap();
componentMap.put("title", "组件服务");
Map<String, List> map = new ConcurrentHashMap<>();
List<CompletableFuture> tasks = resourceTypeMap.get("组件服务").stream().map(it -> {
CompletableFuture task = CompletableFuture.runAsync(() -> {
selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
if (map.get(attr.getAttrValue()) != null) {
map.get(attr.getAttrValue()).add(it);
} else {
map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{
add(it);
}}));
}
});
}, executor);
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{
put("title", it.getKey());
put("children", it.getValue());
}}).collect(Collectors.toList()));
result.add(componentMap);
}
return result;
}
}

View File

@ -93,12 +93,11 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
List<ResourceCollectionEntity> collectionEntities = resourceCollectionDao.selectByMap(selectMap);
if (collectionEntities.isEmpty()) {
resourceCollectionDao.insert(item);
Integer num = jdbcTemplate.queryForObject("SELECT round(tb_data_resource_assignmark.total) FROM tb_data_resource_assignmark WHERE id =" + item.getResourceId(), Integer.class);
String sql = String.format("update tb_data_resource SET total = %d WHERE id = %s", num.intValue(), item.getResourceId().toString());
jdbcTemplate.update(sql);
if (resourceService.get(item.getResourceId()) != null) {
Integer num = jdbcTemplate.queryForObject("SELECT round(tb_data_resource_assignmark.total) FROM tb_data_resource_assignmark WHERE id =" + item.getResourceId(), Integer.class);
String sql = String.format("update tb_data_resource SET total = %d WHERE id = %s", num.intValue(), item.getResourceId().toString());
jdbcTemplate.update(sql);
}
} else {
collectionEntities.forEach(index -> {
index.setUpdateDate(new Date());

View File

@ -0,0 +1,5 @@
ALTER TABLE `tb_fuse`
ADD COLUMN `type` varchar(128) NULL COMMENT '服务类型';
ALTER TABLE `tb_fuse_attr`
MODIFY COLUMN `attr_value` varchar(4096) NULL COMMENT '属性值';

View File

@ -1412,4 +1412,9 @@
tdr.del_flag = 0 AND tdr.id = #{id}
</select>
<select id="selectDevelopDocResource" resultType="java.util.Map">
SELECT tdr.id, tdr.name as title, tdr.type, tda.attr_value as doc FROM tb_data_resource tdr right join tb_data_attr tda on tdr.id=tda.data_resource_id
where tdr.del_flag != 1 and tda.attr_type='技术文档'
</select>
</mapper>