diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java index 98e68094..d05ee9ca 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import java.util.Arrays; +import java.util.List; import java.util.Map; /** @@ -61,6 +62,13 @@ public class FuseController { return new Result().ok(tbFuseService.getFuseById(id)); } + @GetMapping("getDataResource") + @ApiOperation("获取资源数据") + @LogOperation("获取资源数据") + public Result> getDataResource() { + return new Result().ok(tbFuseService.getDataResource()); + } + @PostMapping @ApiOperation("保存") @LogOperation("保存") diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java index d731cc86..b296b7ef 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java @@ -4,6 +4,7 @@ import io.renren.common.service.CrudService; import io.renren.modules.fuse.dto.TbFuseDTO; import io.renren.modules.fuse.entity.TbFuseEntity; +import java.util.List; import java.util.Map; /** @@ -15,6 +16,8 @@ public interface TbFuseService extends CrudService { TbFuseDTO getFuseById(Long id); + List getDataResource(); + Integer addFuse(TbFuseDTO dto); Integer updateFuse(TbFuseDTO dto); diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java index 76e82e2e..39d39908 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java @@ -154,35 +154,52 @@ public class TbFuseServiceImpl extends CrudServiceImpl> getDataResource() { - Map> result = new HashMap<>(); + public List getDataResource() { + int pageNum=0; + int pageSize=getDataResourceCount(); + List result = new ArrayList<>(); Optional factory = DataResourceFactory.build(); if (factory.isPresent()) { - GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30); + GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(pageNum).setPageSize(pageSize); Map dataMap = (Map) factory.get().getDataResource(dto); if (dataMap != null) { List> list = (List>) dataMap.get("data"); - list.forEach(map -> { + list.forEach(map -> result.add(new HashMap() {{ if (map.containsKey("zyname")) { - result.put(map.get("guid").toString(), map); + put("id", map.get("guid")); + put("name", map.get("zyname")); } else { - result.put(map.get("serviceId").toString(), map); + put("id", map.get("serviceId")); + put("name", map.get("serviceName")); } - }); + }})); } } return result; } + private int getDataResourceCount() { + int count=30; + Optional factory = DataResourceFactory.build(); + if (factory.isPresent()) { + GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30); + Map dataMap = (Map) factory.get().getDataResource(dto); + if (dataMap != null) { + count=Integer.parseInt(dataMap.get("rows").toString()); + } + } + return count; + } + private List getFuseResourceByFuseId(Long fuseId) { - Map> dataResourceMap = new HashMap<>(); + List dataResourceMap = new ArrayList<>(); List result = new ArrayList(); QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("fuse_id", fuseId); List list = fuseResourceDao.selectList(wrapper); Map> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType)); if (resourceMap.containsKey("数据资源")) { - dataResourceMap.putAll(getDataResource()); + dataResourceMap.addAll(getDataResource()); } resourceMap.forEach((type, value) -> { if ("组件服务".equals(type)) { @@ -198,7 +215,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl { TbFuseResourceDTO dto = new TbFuseResourceDTO(); BeanUtils.copyProperties(attr, dto); - dto.setResource(dataResourceMap.get(dto.getResourceId())); + dto.setResource(dataResourceMap.stream().filter(it->it.get("id").equals(dto.getResourceId())).findFirst()); return dto; }).collect(Collectors.toList())); } else if ("基础设施".equals(type)) { diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java index 98ca8f26..57f7afcf 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java @@ -391,7 +391,7 @@ public class SysUserServiceImpl extends BaseServiceImpl=0; i--) + { + String hex = Integer.toHexString(b[i] & 0xFF); + if (hex.length() == 1) + { + hex = '0' + hex; + } + builder.append(hex); + } + builder.append('-'); + for (int i = 5; i >=4; i--) + { + String hex = Integer.toHexString(b[i] & 0xFF); + if (hex.length() == 1) + { + hex = '0' + hex; + } + builder.append(hex); + } + builder.append('-'); + for (int i = 7; i >=6; i--) + { + String hex = Integer.toHexString(b[i] & 0xFF); + if (hex.length() == 1) + { + hex = '0' + hex; + } + builder.append(hex); + } + builder.append('-'); + +// for (int i = 8; i <9; i++) +// { +// String hex = Integer.toHexString(b[i] & 0xFF); +// if (hex.length() == 1) +// { +// hex = '0' + hex; +// } +// builder.append(hex); +// } +// builder.append('-'); + for (int i = 8; i <10; i++) + { + String hex = Integer.toHexString(b[i] & 0xFF); + if (hex.length() == 1) + { + hex = '0' + hex; + } + builder.append(hex); + } + builder.append('-'); + for (int i = 10; i <16; i++) + { + String hex = Integer.toHexString(b[i] & 0xFF); + if (hex.length() == 1) + { + hex = '0' + hex; + } + builder.append(hex); + } + + return builder.toString().toUpperCase(); + } + /** * 获取管理部门信息 * @param ctx