Merge branch 'master' into docker_package
This commit is contained in:
commit
f17e8be5cc
|
@ -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("保存")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -79,4 +79,6 @@ public class SysUserEntity extends BaseEntity {
|
|||
*/
|
||||
private String guid;
|
||||
|
||||
private String ywMobile;
|
||||
|
||||
}
|
|
@ -381,7 +381,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
|||
if (m.get(("username")) != null) {
|
||||
String userName = m.get("username").toString();
|
||||
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();
|
||||
newUser.setUsername(userName);
|
||||
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.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.setStatus(1);//账号状态 1正常 0停用
|
||||
//给dept_id赋值
|
||||
String deptNames = m.get("distinguishedName") == null ? "" : m.get("distinguishedName").toString();
|
||||
|
|
|
@ -100,14 +100,16 @@ public class JhlDAPTool {
|
|||
user.put("email",next.get().toString());
|
||||
}else if("telephoneNumber".equals(next.getID())){
|
||||
user.put("mobile",next.get().toString());
|
||||
}else if("mobile".equals(next.getID())){
|
||||
user.put("ywMobile",next.get().toString());
|
||||
}else if("distinguishedName".equals(next.getID())){
|
||||
user.put("distinguishedName",next.get().toString());
|
||||
}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));
|
||||
String guid = guidStr.substring(1,guidStr.length()-1);
|
||||
String guid = guidStr.substring(1,guidStr.length() - 1);
|
||||
user.put("guid",guid);
|
||||
|
||||
}
|
||||
}
|
||||
lm.add(user);
|
||||
|
|
Loading…
Reference in New Issue