!79 细化分组、标题、名字表是否启用; 明细表按照上下级关系展示

Merge pull request !79 from dxfeng/feature/dxf
pull/80/MERGE
dxfeng 3 years ago committed by Gitee
commit 851e6d28fa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -25,7 +25,7 @@ public class ExtendTitlePO {
/** /**
* *
*/ */
private Long groupid; private Long groupId;
/** /**
* *
@ -39,7 +39,7 @@ public class ExtendTitlePO {
/** /**
* *
*/ */
private Integer isShow; private String isShow;
private Integer creator; private Integer creator;

@ -1,6 +1,5 @@
package com.engine.organization.enums; package com.engine.organization.enums;
import com.engine.salary.enums.BaseEnum;
/** /**
* @Author weaver_cl * @Author weaver_cl

@ -31,7 +31,7 @@
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM FROM
jcl_field_extendgroup t jcl_field_extendgroup t
WHERE t.delete_type = 0 WHERE t.delete_type = 0 and t.is_show = 1
<if test=" extendType != null and extendType != '' "> <if test=" extendType != null and extendType != '' ">
and extend_type = #{extendType} and extend_type = #{extendType}
</if> </if>
@ -56,7 +56,7 @@
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_field_extendgroup t from jcl_field_extendgroup t
WHERE t.delete_type = 0 WHERE t.delete_type = 0 and t.is_show = 1
and t.pid= #{pid} and t.pid= #{pid}
</select> </select>

@ -21,4 +21,6 @@ public interface ExtendInfoMapper {
* @return * @return
*/ */
List<ExtendInfoPO> listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName,@Param("operateType")String operateType); List<ExtendInfoPO> listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName,@Param("operateType")String operateType);
int countFieldsByGroupId(@Param("groupId") Long groupId);
} }

@ -75,6 +75,12 @@
</if> </if>
order by show_order order by show_order
</select> </select>
<select id="countFieldsByGroupId" resultType="java.lang.Integer">
select count(1)
from jcl_field_extendinfo t
where t.delete_type = 0
and extend_group_id = #{groupId}
</select>
</mapper> </mapper>

@ -3,7 +3,7 @@
<mapper namespace="com.engine.organization.mapper.extend.ExtendTitleMapper"> <mapper namespace="com.engine.organization.mapper.extend.ExtendTitleMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.extend.po.ExtendTitlePO"> <resultMap id="BaseResultMap" type="com.engine.organization.entity.extend.po.ExtendTitlePO">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="group_id" property="groupid"/> <result column="group_id" property="groupId"/>
<result column="title" property="title"/> <result column="title" property="title"/>
<result column="show_order" property="showOrder"/> <result column="show_order" property="showOrder"/>
<result column="is_show" property="isShow"/> <result column="is_show" property="isShow"/>
@ -33,7 +33,7 @@
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM FROM
jcl_field_extendtitle t jcl_field_extendtitle t
WHERE t.delete_type = 0 WHERE t.delete_type = 0 and t.is_show = 1
<if test=" groupId != null "> <if test=" groupId != null ">
and group_id = #{groupId} and group_id = #{groupId}
</if> </if>
@ -45,7 +45,7 @@
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM FROM
jcl_field_extendtitle t jcl_field_extendtitle t
WHERE t.delete_type = 0 WHERE t.delete_type = 0 and t.is_show = 1
AND id IN AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}

@ -51,8 +51,7 @@ public interface ExtService {
* @param showLabel * @param showLabel
* @return * @return
*/ */
List<Map<String, Object>> getExtendTables(User user, String extendType, String tableName, long id, int viewAttr, boolean showLabel); List<Map<String, Object>> getExtendTables(User user, String extendType, Long groupId,String tableName, long id, int viewAttr, boolean showLabel);
/** /**
* *
* *

@ -4,6 +4,7 @@ import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.enums.ModuleTypeEnum;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author weaver_cl * @Author weaver_cl
@ -16,4 +17,20 @@ public interface FieldDefinedService {
List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum); List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum);
/**
*
*
* @param groupType
* @return
*/
Map<String, Object> getTabInfo(String groupType);
/**
*
*
* @param data
* @return
*/
int saveFields(String data);
} }

@ -254,7 +254,7 @@ public class CompServiceImpl extends Service implements CompService {
// 拓展页面分组 // 拓展页面分组
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_COMPEXT)); resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_COMPEXT));
// 处理明细表 // 处理明细表
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_COMPEXT_DT1, id, viewAttr, false)); resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_COMPEXT_DT1, id, viewAttr, false));
Map<String, Object> apiDatas = new HashMap<>(); Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap); apiDatas.put("result", resultMap);

@ -307,7 +307,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 拓展页面分组 // 拓展页面分组
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_DEPTEXT)); resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_DEPTEXT));
// 处理明细表 // 处理明细表
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_DEPTEXT_DT1, id, viewAttr, false)); resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_DEPTEXT_DT1, id, viewAttr, false));
Map<String, Object> apiDatas = new HashMap<>(); Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap); apiDatas.put("result", resultMap);

@ -6,6 +6,7 @@ import com.engine.organization.entity.TopTab;
import com.engine.organization.entity.codesetting.po.CodeRulePO; import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.extend.ExtendInfoOperateType; import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.bo.ExtendInfoBO; import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO; import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.mapper.codesetting.CodeRuleMapper;
@ -116,10 +117,15 @@ public class ExtServiceImpl extends Service implements ExtService {
} }
@Override @Override
public List<Map<String, Object>> getExtendTables(User user, String extendType, String tableName, long id, int viewAttr, boolean showLabel) { public List<Map<String, Object>> getExtendTables(User user, String extendType, Long groupId, String tableName, long id, int viewAttr, boolean showLabel) {
List<Map<String, Object>> tables = new ArrayList<>(); List<Map<String, Object>> tables = new ArrayList<>();
List<ExtendInfoPO> infoPOList = new ArrayList<>();
// 查询明细表
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listGroupByPid(groupId);
for (ExtendGroupPO extendGroup : extendGroupList) {
infoPOList.addAll(getExtendInfoMapper().listFields(extendType, extendGroup.getId() + "", tableName, ""));
}
// 查询所有分布模块,拓展明细表信息 // 查询所有分布模块,拓展明细表信息
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, "");
Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId)); Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
// 遍历Map,组装数据 // 遍历Map,组装数据
for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) { for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) {
@ -132,7 +138,7 @@ public class ExtServiceImpl extends Service implements ExtService {
// 浏览按钮添加filespan字段 // 浏览按钮添加filespan字段
String fields = entry.getValue().stream().map(item -> { String fields = entry.getValue().stream().map(item -> {
if (BROWSER_TYPE == item.getControlType()) { if (BROWSER_TYPE.equals(item.getControlType())) {
return item.getFieldName() + "," + item.getFieldName() + "span"; return item.getFieldName() + "," + item.getFieldName() + "span";
} }
return item.getFieldName(); return item.getFieldName();
@ -160,12 +166,15 @@ public class ExtServiceImpl extends Service implements ExtService {
infoPOList.addAll(infoPOList1); infoPOList.addAll(infoPOList1);
List<Long> ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList()); List<Long> ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByIds(ids); List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByIds(ids);
Set<Long> extendGroups = extendTitles.stream().map(ExtendTitlePO::getGroupid).collect(Collectors.toSet()); Set<Long> groupIds = extendTitles.stream().map(ExtendTitlePO::getGroupId).collect(Collectors.toSet());
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listByType(extendType);
// 拓展信息 // 拓展信息
if (CollectionUtils.isNotEmpty(extendGroups)) { if (CollectionUtils.isNotEmpty(extendGroupList) && CollectionUtils.isNotEmpty(groupIds)) {
for (Long groupId : extendGroups) { for (ExtendGroupPO extendGroup : extendGroupList) {
topTabs.add(TopTab.builder().color("#000000").groupId(groupId + "").showcount(false).title(getExtendGroupMapper().getGroupNameById(groupId + "")).viewCondition(groupId + "").build()); if (groupIds.contains(extendGroup.getId())) {
topTabs.add(TopTab.builder().color("#000000").groupId(extendGroup.getId().toString()).showcount(false).title(extendGroup.getGroupName()).viewCondition(extendGroup.getId().toString()).build());
}
} }
} }
return topTabs; return topTabs;

@ -1,15 +1,26 @@
package com.engine.organization.service.impl; package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.entity.extend.bo.ExtendGroupBO; import com.engine.organization.entity.extend.bo.ExtendGroupBO;
import com.engine.organization.entity.extend.po.ExtendGroupPO; import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.fieldset.vo.TypeTreeVO; import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.extend.ExtendGroupMapper; import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.service.FieldDefinedService; import com.engine.organization.service.FieldDefinedService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.weaver.general.Util;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author weaver_cl * @Author weaver_cl
@ -18,6 +29,13 @@ import java.util.List;
* @Version V1.0 * @Version V1.0
**/ **/
public class FieldDefinedServiceImpl extends Service implements FieldDefinedService { public class FieldDefinedServiceImpl extends Service implements FieldDefinedService {
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
@Override @Override
public List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum) { public List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum) {
@ -25,4 +43,48 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
List<ExtendGroupPO> extendGroupPOS = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(extendType); List<ExtendGroupPO> extendGroupPOS = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(extendType);
return ExtendGroupBO.buildTypeTree(extendGroupPOS); return ExtendGroupBO.buildTypeTree(extendGroupPOS);
} }
@Override
public Map<String, Object> getTabInfo(String groupType) {
OrganizationAssert.notBlank(groupType, "分组信息有误,请确认");
Map<String, Object> datas = new HashMap<>();
Long groupId = Long.parseLong(groupType);
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupId);
List<Map<String, Object>> tabs = new ArrayList<>();
int idx = 1;
for (ExtendTitlePO extendTitle : extendTitleList) {
Map<String, Object> tab = new HashMap<>();
tab.put("tabkey", idx++);
tab.put("title", extendTitle.getTitle());
tab.put("isShow", extendTitle.getIsShow());
tab.put("groupid", extendTitle.getGroupId());
tab.put("viewAttr", extendTitle.getGroupId() < 0 ? 1 : 2);
tab.put("editable", editTable(extendTitle.getId()));
tabs.add(tab);
}
datas.put("status", "1");
datas.put("tabs", tabs);
return datas;
}
@Override
public int saveFields(String data) {
if (StringUtils.isEmpty(data)) {
return 0;
}
JSONObject jsonObject = JSON.parseObject(data);
String groupType = Util.null2String(jsonObject.getString("groupType"));
String groupId = Util.null2String(jsonObject.getString("groupId"));
return 0;
}
/**
*
*
* @param id
* @return
*/
private boolean editTable(Long id) {
return getExtendInfoMapper().countFieldsByGroupId(id) > 0;
}
} }

@ -291,7 +291,7 @@ public class JobServiceImpl extends Service implements JobService {
// 拓展页面分组 // 拓展页面分组
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_JOBEXT)); resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_JOBEXT));
// 处理明细表 // 处理明细表
List<Map<String, Object>> extendTables = getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, id, viewAttr, false); List<Map<String, Object>> extendTables = getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId),JCL_ORG_JOBEXT_DT1, id, viewAttr, false);
Map<String, Object> tableMap = new HashMap<>(); Map<String, Object> tableMap = new HashMap<>();
tableMap.put("hide", false); tableMap.put("hide", false);

@ -1,5 +1,6 @@
package com.engine.organization.web; package com.engine.organization.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.util.response.ReturnResult; import com.engine.organization.util.response.ReturnResult;
@ -15,6 +16,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.Map;
/** /**
* @Author weaver_cl * @Author weaver_cl
@ -25,7 +27,7 @@ import javax.ws.rs.core.MediaType;
public class FieldDefinedController { public class FieldDefinedController {
private FieldDefinedWrapper getFieldDefinedWrapper(User user) { private FieldDefinedWrapper getFieldDefinedWrapper(User user) {
return ServiceUtil.getService(FieldDefinedWrapper.class,user); return ServiceUtil.getService(FieldDefinedWrapper.class, user);
} }
@GET @GET
@ -40,4 +42,18 @@ public class FieldDefinedController {
return ReturnResult.exceptionHandle(e.getMessage()); return ReturnResult.exceptionHandle(e.getMessage());
} }
} }
@GET
@Path("/getTabInfo")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getTabInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
String groupType = (String) map.get("groupType");
return ReturnResult.successed(getFieldDefinedWrapper(user).getTabInfo(groupType));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
} }

@ -10,6 +10,7 @@ import com.engine.organization.util.response.ReturnResult;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author weaver_cl * @Author weaver_cl
@ -20,7 +21,7 @@ import java.util.List;
public class FieldDefinedWrapper extends Service { public class FieldDefinedWrapper extends Service {
private FieldDefinedService getFieldDefinedService(User user) { private FieldDefinedService getFieldDefinedService(User user) {
return ServiceUtil.getService(FieldDefinedServiceImpl.class,user); return ServiceUtil.getService(FieldDefinedServiceImpl.class, user);
} }
@ -28,4 +29,14 @@ public class FieldDefinedWrapper extends Service {
List<TypeTreeVO> treeDTOS = getFieldDefinedService(user).getTree(moduleTypeEnum); List<TypeTreeVO> treeDTOS = getFieldDefinedService(user).getTree(moduleTypeEnum);
return ReturnResult.successed(treeDTOS); return ReturnResult.successed(treeDTOS);
} }
/**
*
*
* @param groupType
* @return
*/
public Map<String, Object> getTabInfo(String groupType) {
return getFieldDefinedService(user).getTabInfo(groupType);
}
} }

Loading…
Cancel
Save