|
|
|
@ -13,6 +13,7 @@ import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|
|
|
|
import com.engine.organization.enums.ModuleTypeEnum;
|
|
|
|
|
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.*;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
|
|
|
|
import com.engine.organization.service.ExtService;
|
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
|
import com.engine.organization.util.db.DBType;
|
|
|
|
@ -67,9 +68,22 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|
|
|
|
if (StringUtils.isEmpty(fields)) {
|
|
|
|
|
return conditionItems;
|
|
|
|
|
}
|
|
|
|
|
List<String> readOnlyFieldList = new ArrayList<>(Arrays.asList(readOnlyFields));
|
|
|
|
|
//TODO 细化权限
|
|
|
|
|
if ("4".equals(extendType) && !user.isAdmin()) {
|
|
|
|
|
String ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getEcResourceId(String.valueOf(id));
|
|
|
|
|
if (Util.null2String(user.getUID()).equals(ecResourceId)) {
|
|
|
|
|
List<String> readOnlyList = infoPOList.stream().filter(item -> !"1".equals(Util.null2String(item.getIsModify()))).map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(readOnlyList)) {
|
|
|
|
|
readOnlyFieldList.addAll(readOnlyList);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
viewAttr = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(tableName).fields(fields).params(null).id(id).build();
|
|
|
|
|
Map<String, Object> compExtMap = getExtMapper().listExt(infoParams);
|
|
|
|
|
List<String> readOnlyFieldList = Arrays.asList(readOnlyFields);
|
|
|
|
|
// 组装拓展页内容
|
|
|
|
|
for (ExtendInfoPO extendInfoPO : infoPOList) {
|
|
|
|
|
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(DBType.isOracle() ? extendInfoPO.getFieldName().toUpperCase() : extendInfoPO.getFieldName()));
|
|
|
|
@ -136,8 +150,19 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|
|
|
|
// 查询明细表
|
|
|
|
|
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listGroupByPid(groupId, "1");
|
|
|
|
|
for (ExtendGroupPO extendGroup : extendGroupList) {
|
|
|
|
|
infoPOList.addAll(getExtendInfoMapper().listFields(extendType, extendGroup.getId() + "", tableName, "", "1"));
|
|
|
|
|
List<ExtendInfoPO> extendInfoPOS = getExtendInfoMapper().listFields(extendType, extendGroup.getId() + "", tableName, "", "1");
|
|
|
|
|
if (CollectionUtils.isNotEmpty(extendInfoPOS)) {
|
|
|
|
|
infoPOList.addAll(extendInfoPOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Map<Long, List<ExtendInfoPO>> allFields = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
|
|
|
|
|
//TODO 控制展示权限
|
|
|
|
|
boolean checkRight = true;
|
|
|
|
|
if ("4".equals(extendType) && !user.isAdmin()) {
|
|
|
|
|
checkRight = false;
|
|
|
|
|
infoPOList.removeIf(item -> !"1".equals(Util.null2String(item.getIsModify())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查询所有分布模块,拓展明细表信息
|
|
|
|
|
Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
|
|
|
|
|
// 遍历Map,组装数据
|
|
|
|
@ -146,11 +171,12 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|
|
|
|
tableMap.put("hide", false);
|
|
|
|
|
tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(Util.null2String(entry.getKey())));
|
|
|
|
|
Map<String, Object> tabinfoMap = new HashMap<>();
|
|
|
|
|
//TODO 需优化
|
|
|
|
|
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel));
|
|
|
|
|
tabinfoMap.put("rownum", "rownum" + entry.getKey());
|
|
|
|
|
|
|
|
|
|
// 浏览按钮添加filespan字段
|
|
|
|
|
String fields = entry.getValue().stream().map(item -> {
|
|
|
|
|
String fields = allFields.get(entry.getKey()).stream().map(item -> {
|
|
|
|
|
if (BROWSER_TYPE.equals(item.getControlType())) {
|
|
|
|
|
return item.getFieldName() + "," + item.getFieldName() + "span";
|
|
|
|
|
}
|
|
|
|
@ -160,12 +186,14 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|
|
|
|
List<Map<String, Object>> maps = getExtDTMapper().listCompExtDT(tableName, id, fields);
|
|
|
|
|
maps.removeIf(Objects::isNull);
|
|
|
|
|
// 兼容Oracle,map的key转换为小写
|
|
|
|
|
boolean finalCheckRight = checkRight;
|
|
|
|
|
List<Map<String, Object>> collect = maps.stream().map(item -> {
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
Set<String> keys = item.keySet();
|
|
|
|
|
for (String key : keys) {
|
|
|
|
|
resultMap.put(key.toLowerCase(), item.get(key));
|
|
|
|
|
}
|
|
|
|
|
resultMap.put("viewAttr", finalCheckRight ? 2 : 1);
|
|
|
|
|
return resultMap;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
tabinfoMap.put("datas", collect);
|
|
|
|
|