This commit is contained in:
yitonglei 2022-08-26 11:03:23 +08:00
commit 1f6438086c
5 changed files with 109 additions and 13 deletions

View File

@ -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<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
}
@GetMapping("getDataResource")
@ApiOperation("获取资源数据")
@LogOperation("获取资源数据")
public Result<List<Map>> getDataResource() {
return new Result().ok(tbFuseService.getDataResource());
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")

View File

@ -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<TbFuseEntity, TbFuseDTO> {
TbFuseDTO getFuseById(Long id);
List<Map> getDataResource();
Integer addFuse(TbFuseDTO dto);
Integer updateFuse(TbFuseDTO dto);

View File

@ -154,35 +154,52 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
}).collect(Collectors.toList());
}
private Map<String, Map<String, Object>> getDataResource() {
Map<String, Map<String, Object>> result = new HashMap<>();
public List<Map> getDataResource() {
int pageNum=0;
int pageSize=getDataResourceCount();
List<Map> result = new ArrayList<>();
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
if (factory.isPresent()) {
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30);
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(pageNum).setPageSize(pageSize);
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
if (dataMap != null) {
List<Map<String, Object>> list = (List<Map<String, Object>>) 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<AbstractDataResourceService> factory = DataResourceFactory.build();
if (factory.isPresent()) {
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30);
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
if (dataMap != null) {
count=Integer.parseInt(dataMap.get("rows").toString());
}
}
return count;
}
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
Map<String, Map<String, Object>> dataResourceMap = new HashMap<>();
List<Map> dataResourceMap = new ArrayList<>();
List<TbFuseResourceDTO> result = new ArrayList();
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("fuse_id", fuseId);
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
Map<String, List<TbFuseResourceEntity>> 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<TbFuseDao, TbFuseEntity,
result.addAll(value.stream().map(attr -> {
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)) {

View File

@ -391,7 +391,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
newUser.setRealName(m.get("real_name") == null ? "" : m.get("real_name").toString());
newUser.setEmail(m.get("email") == null ? "" : m.get("email").toString());
newUser.setMobile(m.get("mobile") == null ? "" : m.get("mobile").toString());
newUser.setYwMobile(m.get("YwMobile") == null ? "" : m.get("YwMobile").toString());
newUser.setYwMobile(m.get("ywMobile") == null ? "" : m.get("ywMobile").toString());
newUser.setStatus(1);//账号状态 1正常 0停用
//给dept_id赋值
String deptNames = m.get("distinguishedName") == null ? "" : m.get("distinguishedName").toString();

View File

@ -107,8 +107,10 @@ public class JhlDAPTool {
}else if("objectGUID".equals(next.getID())){
String guidStr = next.get().toString();
//Object o = next.get(0);
user.put("id",SingleID.getSingleID(guidStr));
String guid = guidStr.substring(1,guidStr.length() - 1);
String guid = guidObject2String((byte[]) next.get(0));
user.put("id",SingleID.getSingleID(guid));
user.put("guid",guid);
}
}
@ -127,6 +129,72 @@ public class JhlDAPTool {
return lm;
}
private String guidObject2String(byte[] b){
StringBuilder builder = new StringBuilder();
for (int i = 3; i >=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