公司/分部 新增、编辑表单 表结构更新

pull/9/MERGE^2
dxfeng 3 years ago
parent d6c8ac96c2
commit 1bc660ab8d

@ -127,14 +127,14 @@ CREATE TABLE JCL_FIELD_EXTENDINFO (
field_name_desc varchar(100) NULL,
field_type varchar(1000) NULL,
control_type int null,
extend_group int null,
extend_group_id int null,
isenable int null,
isrequired int null,
list_show int null,
search_show int null,
edit_show int null,
add_show int null,
button_show int null,
browser_show int null,
show_order int null,
creator int null,
delete_type int null,

@ -129,14 +129,14 @@ CREATE TABLE JCL_FIELD_EXTENDINFO (
FIELD_NAME_DESC NVARCHAR2(100) NULL,
FIELD_TYPE NVARCHAR2(1000) NULL,
CONTROL_TYPE NUMBER NULL,
EXTEND_GROUP NUMBER NULL,
EXTEND_GROUP_ID NUMBER NULL,
ISENABLE NUMBER NULL,
ISREQUIRED NUMBER NULL,
LIST_SHOW NUMBER NULL,
SEARCH_SHOW NUMBER NULL,
EDIT_SHOW NUMBER NULL,
ADD_SHOW NUMBER NULL,
BUTTON_SHOW NUMBER NULL,
BROWSER_SHOW NUMBER NULL,
SHOW_ORDER NUMBER NULL,
CREATOR NUMBER NULL,
DELETE_TYPE NUMBER NULL,

@ -127,14 +127,14 @@ CREATE TABLE JCL_FIELD_EXTENDINFO (
field_name_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
field_type varchar(1000) COLLATE Chinese_PRC_CI_AS NULL,
control_type int null,
extend_group int null,
extend_group_id int null,
isenable int null,
isrequired int null,
list_show int null,
search_show int null,
edit_show int null,
add_show int null,
button_show int null,
browser_show int null,
show_order int null,
creator int null,
delete_type int null,

@ -0,0 +1,120 @@
package com.engine.organization.entity.extend.bo;
import com.api.hrm.bean.FieldItem;
import com.api.hrm.util.FieldType;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/19
* @version: 1.0
*/
public class ExtendInfoBO {
// 封装对象为table组件
public static List<Map<String, Object>> convertInfoListToTable(List<ExtendInfoPO> infoPOList, int operateType, boolean showLabel) {
List<Map<String, Object>> lsCol = new ArrayList<Map<String, Object>>();
Map<String, Object> col = null;
int width = 100 / infoPOList.size();
for (int i = 0; infoPOList != null && i < infoPOList.size(); i++) {
ExtendInfoPO extendInfoPO = infoPOList.get(i);
String tmpkey = extendInfoPO.getFieldName();
col = new HashMap<String, Object>();
col.put("title", extendInfoPO.getFieldNameDesc());
col.put("key", tmpkey);
col.put("dataIndex", tmpkey);
col.put("com", getFieldDetialInfo(extendInfoPO, operateType, showLabel, width));
col.put("width", width + "%");
lsCol.add(col);
}
return lsCol;
}
/**
*
*
* @param extendInfoPO
* @param operateType
* @return
*/
private static List<FieldItem> getFieldDetialInfo(ExtendInfoPO extendInfoPO, int operateType, boolean showLabel, int width) {
List<FieldItem> ls = new ArrayList<FieldItem>();
FieldItem fieldItem = createField(extendInfoPO, operateType, showLabel, width);
ls.add(fieldItem);
return ls;
}
/**
*
*
* @param extendInfoPO
* @param operateType
* @param showLabel
* @param width
* @return
*/
private static FieldItem createField(ExtendInfoPO extendInfoPO, int operateType, boolean showLabel, int width) {
FieldItem fieldItem = new FieldItem();
if (showLabel) {
fieldItem.setLabel(extendInfoPO.getFieldNameDesc());
} else {
fieldItem.setLabel("");
}
fieldItem.setType(getFieldhtmltype(extendInfoPO.getControlType() + ""));
fieldItem.setKey(extendInfoPO.getFieldName());
// 查看操作 全部设置为只读
if (0 == operateType) {
fieldItem.setViewAttr(1);
} else {
// 必填
if (1 == extendInfoPO.getIsrequired()) {
fieldItem.setViewAttr(3);
fieldItem.setRules("required|string");
} else {
fieldItem.setViewAttr(2);
}
}
fieldItem.setWidth(width + "%");
return fieldItem;
}
/**
*
*
* @param fieldhtmltype
* @return
*/
private static FieldType getFieldhtmltype(String fieldhtmltype) {
FieldType fieldtype = null;
if (fieldhtmltype.equals("1")) {
fieldtype = FieldType.INPUT;
} else if (fieldhtmltype.equals("2")) {
fieldtype = FieldType.TEXTAREA;
} else if (fieldhtmltype.equals("3")) {
fieldtype = FieldType.BROWSER;
} else if (fieldhtmltype.equals("4")) {
fieldtype = FieldType.CHECKBOX;
} else if (fieldhtmltype.equals("5")) {
fieldtype = FieldType.SELECT;
} else if (fieldhtmltype.equals("6")) {
fieldtype = FieldType.FILEUPLOAD;
} else if (fieldhtmltype.equals("7")) {
fieldtype = FieldType.TEXT;
}
return fieldtype;
}
}

@ -1,4 +1,4 @@
package com.engine.organization.entity.comp.po;
package com.engine.organization.entity.extend.po;
import lombok.AllArgsConstructor;
import lombok.Builder;

@ -0,0 +1,105 @@
package com.engine.organization.entity.extend.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/19
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ExtendInfoPO {
/**
*
*/
private Long id;
/**
*
*/
private Integer extendType;
/**
*
*/
private String tableName;
/**
*
*/
private String fieldName;
/**
*
*/
private String fieldNameDesc;
/**
*
*/
private String fieldType;
/**
*
*/
private Integer controlType;
/**
*
*/
private Long extendGroupId;
/**
*
*/
private Integer isenable;
/**
*
*/
private Integer isrequired;
/**
*
*/
private Integer listShow;
/**
*
*/
private Integer searchShow;
/**
*
*/
private Integer editShow;
/**
*
*/
private Integer addShow;
/**
*
*/
private Integer browserShow;
/**
*
*/
private Integer showOrder;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
}

@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @description: TODO
@ -15,10 +16,34 @@ import java.util.List;
public interface CompMapper {
/**
*
* @param compPO
*
* @return
*/
List<CompPO> list();
/**
*
*
* @return
*/
List<CompPO> listParent();
/**
*
*
* @param ids
* @return
*/
List<CompPO> list(CompPO compPO);
List<CompPO> listChild(@Param("ids") Collection ids);
/**
* ID
*
* @param id
* @return
*/
CompPO listById(@Param("id") long id);
/**
* No
@ -28,6 +53,16 @@ public interface CompMapper {
*/
List<CompPO> listByNo(@Param("compNo") String compNo);
/**
* id,
*
* @param tableName
* @param id
* @return
*/
List<Map<String, Object>> listCompExtDT(@Param("tableName") String tableName, @Param("id") long id, @Param("fields") String fields);
/**
*
*
@ -35,6 +70,7 @@ public interface CompMapper {
* @return
*/
int updateForbiddenTagById(CompPO compPO);
/**
*
*

@ -38,13 +38,54 @@
, t.update_time
</sql>
<sql id="nullSql">
and ifnull(parent_company,'0')='0'
</sql>
<sql id="nullSql" databaseId="sqlserver">
and isnull(parent_company,'0')='0'
</sql>
<sql id="nullSql" databaseId="oracle">
and NVL(parent_company,'0')='0'
</sql>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
</select>
<select id="listParent" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
<include refid="nullSql"/>
</select>
<select id="listChild" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
AND parent_company IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="list" resultMap="BaseResultMap" parameterType="com.engine.organization.entity.comp.po.CompPO">
<select id="listById" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
and id = #{id}
</select>
<select id="listByNo" parameterType="com.engine.organization.entity.comp.po.CompPO" resultMap="BaseResultMap">
@ -53,6 +94,14 @@
from jcl_org_comp t where comp_no = #{compNo} AND delete_type = 0
</select>
<select id="listCompExtDT" resultType="java.util.Map">
select ${fields}
from ${tableName}
where mainid = #{id}
and delete_type = 0
</select>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
update jcl_org_comp
<set>

@ -1,6 +1,6 @@
package com.engine.organization.mapper.comp;
package com.engine.organization.mapper.extend;
import com.engine.organization.entity.comp.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -19,4 +19,12 @@ public interface ExtendGroupMapper {
* @return
*/
List<ExtendGroupPO> listByType(@Param("groupType") String groupType);
/**
* ID
*
* @param id
* @return
*/
String getGroupNameById(@Param("id") String id);
}

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.comp.ExtendGroupMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.comp.po.ExtendGroupPO">
<mapper namespace="com.engine.organization.mapper.extend.ExtendGroupMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.extend.po.ExtendGroupPO">
<result column="id" property="id"/>
<result column="extend_type" property="extendType"/>
<result column="group_name" property="groupName"/>
@ -35,6 +35,11 @@
and extend_type = #{extendType}
</if>
</select>
<select id="getGroupNameById" resultType="java.lang.String">
select group_name
from jcl_field_extendgroup
where id = #{id} and delete_type = 0
</select>
</mapper>

@ -0,0 +1,24 @@
package com.engine.organization.mapper.extend;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/19
* @version: 1.0
*/
public interface ExtendInfoMapper {
/**
*
*
* @param extendType
* @param extendGroupId
* @param tableName
* @return
*/
List<ExtendInfoPO> listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName);
}

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.extend.ExtendInfoMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.extend.po.ExtendInfoPO">
<result column="id" property="id"/>
<result column="extend_type" property="extendType"/>
<result column="table_name" property="tableName"/>
<result column="field_name" property="fieldName"/>
<result column="field_name_desc" property="fieldNameDesc"/>
<result column="field_type" property="fieldType"/>
<result column="control_type" property="controlType"/>
<result column="extend_group_id" property="extendGroupId"/>
<result column="isenable" property="isenable"/>
<result column="isrequired" property="isrequired"/>
<result column="list_show" property="listShow"/>
<result column="search_show" property="searchShow"/>
<result column="edit_show" property="editShow"/>
<result column="add_show" property="addShow"/>
<result column="browser_show" property="browserShow"/>
<result column="show_order" property="showOrder"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.extend_type
, t.table_name
, t.field_name
, t.field_name_desc
, t.field_type
, t.control_type
, t.extend_group_id
, t.isenable
, t.isrequired
, t.list_show
, t.search_show
, t.edit_show
, t.add_show
, t.browser_show
, t.show_order
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="listFields" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_field_extendinfo t
WHERE t.delete_type = 0
<if test=" extendType != null and extendType != '' ">
and extend_type = #{extendType}
</if>
<if test=" extendGroupId != null and extendGroupId != '' ">
and extend_group_id = #{extendGroupId}
</if>
<if test=" tableName != null and tableName != '' ">
and table_name = #{tableName}
</if>
</select>
</mapper>

@ -65,6 +65,14 @@ public interface CompService {
* @param params
* @return
*/
Map<String, Object> getCompForm(Map<String, Object> params);
Map<String, Object> getCompBaseForm(Map<String, Object> params);
/**
*
*
* @return
*/
Map<String, Object> getCompSaveForm();
}

@ -1,6 +1,7 @@
package com.engine.organization.service.impl;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
@ -13,9 +14,11 @@ import com.engine.organization.entity.comp.bo.CompBO;
import com.engine.organization.entity.comp.dto.CompListDTO;
import com.engine.organization.entity.comp.param.CompSearchParam;
import com.engine.organization.entity.comp.po.CompPO;
import com.engine.organization.entity.comp.po.ExtendGroupPO;
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.comp.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.service.CompService;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
@ -25,7 +28,9 @@ import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
import org.apache.commons.collections4.CollectionUtils;
import weaver.crm.Maint.SectorInfoComInfo;
import weaver.general.StringUtil;
import weaver.hrm.resource.ResourceComInfo;
import java.util.*;
import java.util.stream.Collectors;
@ -45,18 +50,25 @@ public class CompServiceImpl extends Service implements CompService {
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
}
private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
@Override
public Map<String, Object> listPage(CompSearchParam params) {
Map<String, Object> datas = new HashMap<>();
PageUtil.start(params.getCurrent(), params.getPageSize());
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
List<CompPO> list = getCompMapper().list(compPO);
PageInfo<CompPO> pageInfo = new PageInfo<>(list, CompPO.class);
Collection<CompPO> compPOS = pageInfo.getList();
List<CompPO> parentList = getCompMapper().listParent();
List<CompPO> list = new ArrayList<>();
list.addAll(parentList);
// 递归查询子数据
getChildPOs(parentList, list);
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
// 搜索条件过滤数据
List<CompPO> filterList = filterListByParams(compPOS, compPO);
List<CompPO> filterList = filterListByParams(list, compPO);
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(list, filterList);
PageInfo<CompListDTO> pageInfos = new PageInfo<>(compListDTOS, CompListDTO.class);
@ -159,11 +171,13 @@ public class CompServiceImpl extends Service implements CompService {
List<TopTab> topTabs = new ArrayList<>();
// 基本信息
topTabs.add(TopTab.builder().color("#000000").groupId("0").showcount(false).title("基本信息").viewCondition("0").build());
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", "", "JCL_ORG_COMPEXT");
List<Long> extendGroups = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
// 拓展信息
List<ExtendGroupPO> groupPOList = getExtendGroupMapper().listByType("");
if (CollectionUtils.isNotEmpty(groupPOList)) {
for (ExtendGroupPO groupPO : groupPOList) {
topTabs.add(TopTab.builder().color("#000000").groupId(groupPO.getId() + "").showcount(false).title(groupPO.getGroupName()).viewCondition(groupPO.getId() + "").build());
if (CollectionUtils.isNotEmpty(extendGroups)) {
for (Long groupId : extendGroups) {
topTabs.add(TopTab.builder().color("#000000").groupId(groupId + "").showcount(false).title(getExtendGroupMapper().getGroupNameById(groupId + "")).viewCondition(groupId + "").build());
}
}
apiDatas.put("topTabs", topTabs);
@ -171,17 +185,18 @@ public class CompServiceImpl extends Service implements CompService {
}
@Override
public Map<String, Object> getCompForm(Map<String, Object> params) {
// operateType 0 查看 1新增 2编辑
String operateType = (String) params.get("operateType");
long id = Long.parseLong((String) params.get("id"));
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
OrganizationAssert.notNull(params.get("operateType"), "请标识操作类型");
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 编号
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "compNo");
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "compNo");
compNoItem.setRules("required|string");
// 名称
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "compName");
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "compName");
compNameItem.setRules("required|string");
// 简称
SearchConditionItem compNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "compNameShort");
SearchConditionItem compNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "简称", "compNameShort");
compNameShortItem.setRules("required|string");
// TODO 自定义按钮
// 上级公司
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级公司", "161", "parentCompany", "compBrowser");
@ -191,13 +206,9 @@ public class CompServiceImpl extends Service implements CompService {
SearchConditionItem industryItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "行业", "63", "industry", "");
// 负责人
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "负责人", "1", "compPrincipal", "");
// 禁用标记
List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption enableOption = new SearchConditionOption("true", "启用");
SearchConditionOption disableOption = new SearchConditionOption("false", "禁用");
selectOptions.add(enableOption);
selectOptions.add(disableOption);
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag");
// 说明
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "description");
conditionItems.add(compNoItem);
conditionItems.add(compNameItem);
@ -206,8 +217,53 @@ public class CompServiceImpl extends Service implements CompService {
conditionItems.add(orgCodeItem);
conditionItems.add(industryItem);
conditionItems.add(compPrincipalItem);
conditionItems.add(forbiddenTagItem);
conditionItems.add(descriptionItem);
// 0 查看 1新增 2编辑
int operateType = Integer.parseInt((String) params.get("operateType"));
long id = Long.parseLong((String) params.get("id"));
// 编辑、查看状态赋值,设置只读状态
if (1 != operateType) {
// 赋值
CompPO compPO = getCompMapper().listById(id);
OrganizationAssert.notNull(compPO, "数据不存在或数据已删除");
compNoItem.setValue(compPO.getCompNo());
compNameItem.setValue(compPO.getCompName());
compNameShortItem.setValue(compPO.getCompNameShort());
// compBrowserItem
if (null != compPO.getParentCompany()) {
BrowserBean compBrowserBean = compBrowserItem.getBrowserConditionParam();
compBrowserBean.setReplaceDatas(creatReplaceDatas(compPO.getParentCompany(), getCompMapper().listById(compPO.getParentCompany()).getCompName()));
compBrowserItem.setBrowserConditionParam(compBrowserBean);
}
orgCodeItem.setValue(compPO.getOrgCode());
// industryItem
BrowserBean industryBean = industryItem.getBrowserConditionParam();
industryBean.setReplaceDatas(creatReplaceDatas(compPO.getIndustry(), new SectorInfoComInfo().getSectorInfoname(compPO.getIndustry() + "")));
industryItem.setBrowserConditionParam(industryBean);
try {
// compPrincipalItem
BrowserBean PrincipalBean = compPrincipalItem.getBrowserConditionParam();
PrincipalBean.setReplaceDatas(creatReplaceDatas(compPO.getCompPrincipal(), new ResourceComInfo().getLastname(compPO.getCompPrincipal() + "")));
compPrincipalItem.setBrowserConditionParam(PrincipalBean);
} catch (Exception e) {
throw new RuntimeException(e);
}
descriptionItem.setValue(compPO.getDescription());
// 查看,全部置位只读
if (0 == operateType) {
for (SearchConditionItem item : conditionItems) {
item.setViewAttr(1);
}
}
}
HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true);
HashMap<String, Object> conditionsMap = new HashMap<>();
conditionsMap.put("items", conditionItems);
@ -216,15 +272,11 @@ public class CompServiceImpl extends Service implements CompService {
conditionsMap.put("defaultshow", true);
HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("buttons", buttonsMap);
resultMap.put("conditions", conditionsMap);
resultMap.put("id", id);
resultMap.put("tables", null);
resultMap.put("tables", getExtendTables(id, operateType, false));
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap);
@ -232,6 +284,65 @@ public class CompServiceImpl extends Service implements CompService {
return apiDatas;
}
@Override
public Map<String, Object> getCompSaveForm() {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 编号
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "compNo");
compNoItem.setRules("required|string");
// 名称
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "compName");
compNameItem.setRules("required|string");
// 简称
SearchConditionItem compNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "简称", "compNameShort");
compNameShortItem.setRules("required|string");
// TODO 自定义按钮
// 上级公司
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级公司", "161", "parentCompany", "compBrowser");
// 组织机构代码
SearchConditionItem orgCodeItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "组织机构代码", "orgCode");
// 行业
SearchConditionItem industryItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "行业", "63", "industry", "");
// 负责人
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "负责人", "1", "compPrincipal", "");
// 说明
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "description");
conditionItems.add(compNoItem);
conditionItems.add(compNameItem);
conditionItems.add(compNameShortItem);
conditionItems.add(compBrowserItem);
conditionItems.add(orgCodeItem);
conditionItems.add(industryItem);
conditionItems.add(compPrincipalItem);
conditionItems.add(descriptionItem);
addGroups.add(new SearchConditionGroup("基本信息", true, conditionItems));
apiDatas.put("condition", addGroups);
return apiDatas;
}
/**
*
*
* @param parentList
* @param list
*/
private void getChildPOs(List<CompPO> parentList, List<CompPO> list) {
List<Long> ids = parentList.stream().map(CompPO::getId).collect(Collectors.toList());
List<CompPO> listchild = getCompMapper().listChild(ids);
if (CollectionUtils.isNotEmpty(listchild)) {
list.addAll(listchild);
getChildPOs(listchild, list);
}
}
/**
* list
*
@ -260,4 +371,51 @@ public class CompServiceImpl extends Service implements CompService {
}
return filterList;
}
/**
*
*
* @return
*/
private List<Map<String, Object>> getExtendTables(long id, int operateType, boolean showLabel) {
List<Map<String, Object>> tables = new ArrayList<>();
String tableName = "JCL_ORG_COMPEXT_DT1";
// 查询所有分布模块,拓展明细表信息
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", "", tableName);
Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
// 遍历Map,组装数据
for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) {
Map<String, Object> tableMap = new HashMap<>();
tableMap.put("hide", false);
tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(entry.getKey() + ""));
Map<String, Object> tabinfoMap = new HashMap<>();
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(entry.getValue(), operateType, showLabel));
tabinfoMap.put("rownum", "rownum");
String fields = entry.getValue().stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
tabinfoMap.put("datas", getCompMapper().listCompExtDT(tableName, id, fields));
tableMap.put("tabinfo", tabinfoMap);
tables.add(tableMap);
}
return tables;
}
/**
*
*
* @param id
* @param name
* @return
*/
private List<Map<String, Object>> creatReplaceDatas(Object id, Object name) {
List<Map<String, Object>> datas = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("name", name);
datas.add(map);
return datas;
}
}

@ -131,18 +131,55 @@ public class CompController {
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getCompForm")
@Path("/getCompBaseForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getCompForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
public ReturnResult getCompBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getCompWrapper(user).getCompForm(map));
return ReturnResult.successed(getCompWrapper(user).getCompBaseForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
@GET
@Path("/getCompSaveForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getCompSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getCompWrapper(user).getCompSaveForm());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
* Tab
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getTabInfo")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getTabInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getCompWrapper(user).getTabInfo());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
}

@ -74,7 +74,25 @@ public class CompWrapper extends Service {
* @param params
* @return
*/
public Map<String, Object> getCompForm(Map<String, Object> params) {
return getCompService(user).getCompForm(params);
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
return getCompService(user).getCompBaseForm(params);
}
/**
*
*
* @return
*/
public Map<String, Object> getCompSaveForm() {
return getCompService(user).getCompSaveForm();
}
/**
* Tab
*
* @return
*/
public Map<String, Object> getTabInfo() {
return getCompService(user).getTabInfo();
}
}

Loading…
Cancel
Save