Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-08-26 10:48:29 +08:00
commit f17e8be5cc
6 changed files with 48 additions and 14 deletions

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -61,6 +62,13 @@ public class FuseController {
return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id)); return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
} }
@GetMapping("getDataResource")
@ApiOperation("获取资源数据")
@LogOperation("获取资源数据")
public Result<List<Map>> getDataResource() {
return new Result().ok(tbFuseService.getDataResource());
}
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @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.dto.TbFuseDTO;
import io.renren.modules.fuse.entity.TbFuseEntity; import io.renren.modules.fuse.entity.TbFuseEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -15,6 +16,8 @@ public interface TbFuseService extends CrudService<TbFuseEntity, TbFuseDTO> {
TbFuseDTO getFuseById(Long id); TbFuseDTO getFuseById(Long id);
List<Map> getDataResource();
Integer addFuse(TbFuseDTO dto); Integer addFuse(TbFuseDTO dto);
Integer updateFuse(TbFuseDTO dto); Integer updateFuse(TbFuseDTO dto);

View File

@ -154,35 +154,52 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private Map<String, Map<String, Object>> getDataResource() { public List<Map> getDataResource() {
Map<String, Map<String, Object>> result = new HashMap<>(); int pageNum=0;
int pageSize=getDataResourceCount();
List<Map> result = new ArrayList<>();
Optional<AbstractDataResourceService> factory = DataResourceFactory.build(); Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
if (factory.isPresent()) { 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); Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
if (dataMap != null) { if (dataMap != null) {
List<Map<String, Object>> list = (List<Map<String, Object>>) dataMap.get("data"); 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")) { if (map.containsKey("zyname")) {
result.put(map.get("guid").toString(), map); put("id", map.get("guid"));
put("name", map.get("zyname"));
} else { } else {
result.put(map.get("serviceId").toString(), map); put("id", map.get("serviceId"));
put("name", map.get("serviceName"));
} }
}); }}));
} }
} }
return result; 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) { private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
Map<String, Map<String, Object>> dataResourceMap = new HashMap<>(); List<Map> dataResourceMap = new ArrayList<>();
List<TbFuseResourceDTO> result = new ArrayList(); List<TbFuseResourceDTO> result = new ArrayList();
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("fuse_id", fuseId); wrapper.eq("fuse_id", fuseId);
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper); List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
Map<String, List<TbFuseResourceEntity>> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType)); Map<String, List<TbFuseResourceEntity>> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType));
if (resourceMap.containsKey("数据资源")) { if (resourceMap.containsKey("数据资源")) {
dataResourceMap.putAll(getDataResource()); dataResourceMap.addAll(getDataResource());
} }
resourceMap.forEach((type, value) -> { resourceMap.forEach((type, value) -> {
if ("组件服务".equals(type)) { if ("组件服务".equals(type)) {
@ -198,7 +215,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
result.addAll(value.stream().map(attr -> { result.addAll(value.stream().map(attr -> {
TbFuseResourceDTO dto = new TbFuseResourceDTO(); TbFuseResourceDTO dto = new TbFuseResourceDTO();
BeanUtils.copyProperties(attr, dto); 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; return dto;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} else if ("基础设施".equals(type)) { } else if ("基础设施".equals(type)) {

View File

@ -79,4 +79,6 @@ public class SysUserEntity extends BaseEntity {
*/ */
private String guid; private String guid;
private String ywMobile;
} }

View File

@ -381,7 +381,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
if (m.get(("username")) != null) { if (m.get(("username")) != null) {
String userName = m.get("username").toString(); String userName = m.get("username").toString();
SysUserEntity user = sysUserDao.getUserByName(userName); SysUserEntity user = sysUserDao.getUserByName(userName);
if (user == null) {//用户表中没有该用户插入 SysUserEntity userById = sysUserDao.getById(Long.valueOf(m.get("id").toString()));
if (user == null && userById == null) {//用户表中没有该用户插入
SysUserEntity newUser = new SysUserEntity(); SysUserEntity newUser = new SysUserEntity();
newUser.setUsername(userName); newUser.setUsername(userName);
newUser.setSuperAdmin(0); newUser.setSuperAdmin(0);
@ -390,6 +391,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
newUser.setRealName(m.get("real_name") == null ? "" : m.get("real_name").toString()); newUser.setRealName(m.get("real_name") == null ? "" : m.get("real_name").toString());
newUser.setEmail(m.get("email") == null ? "" : m.get("email").toString()); newUser.setEmail(m.get("email") == null ? "" : m.get("email").toString());
newUser.setMobile(m.get("mobile") == null ? "" : m.get("mobile").toString()); newUser.setMobile(m.get("mobile") == null ? "" : m.get("mobile").toString());
newUser.setYwMobile(m.get("YwMobile") == null ? "" : m.get("YwMobile").toString());
newUser.setStatus(1);//账号状态 1正常 0停用 newUser.setStatus(1);//账号状态 1正常 0停用
//给dept_id赋值 //给dept_id赋值
String deptNames = m.get("distinguishedName") == null ? "" : m.get("distinguishedName").toString(); String deptNames = m.get("distinguishedName") == null ? "" : m.get("distinguishedName").toString();

View File

@ -100,14 +100,16 @@ public class JhlDAPTool {
user.put("email",next.get().toString()); user.put("email",next.get().toString());
}else if("telephoneNumber".equals(next.getID())){ }else if("telephoneNumber".equals(next.getID())){
user.put("mobile",next.get().toString()); user.put("mobile",next.get().toString());
}else if("mobile".equals(next.getID())){
user.put("ywMobile",next.get().toString());
}else if("distinguishedName".equals(next.getID())){ }else if("distinguishedName".equals(next.getID())){
user.put("distinguishedName",next.get().toString()); user.put("distinguishedName",next.get().toString());
}else if("objectGUID".equals(next.getID())){ }else if("objectGUID".equals(next.getID())){
String guidStr = next.getID().toString(); String guidStr = next.get().toString();
//Object o = next.get(0);
user.put("id",SingleID.getSingleID(guidStr)); user.put("id",SingleID.getSingleID(guidStr));
String guid = guidStr.substring(1,guidStr.length()-1); String guid = guidStr.substring(1,guidStr.length() - 1);
user.put("guid",guid); user.put("guid",guid);
} }
} }
lm.add(user); lm.add(user);