Pre Merge pull request !13 from dxfeng/feature/dxf

pull/13/MERGE
dxfeng 3 years ago committed by Gitee
commit 9ce6f5789d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -68,14 +68,6 @@ public interface CompService {
*/
Map<String, Object> getHasRight();
/**
* Tab
*
* @return
*/
Map<String, Object> getTabInfo();
/**
*
*
@ -84,15 +76,6 @@ public interface CompService {
*/
Map<String, Object> getCompBaseForm(Map<String, Object> params);
/**
*
*
* @param params
* @return
*/
Map<String, Object> getCompExtForm(Map<String, Object> params);
/**
*
*

@ -222,107 +222,27 @@ public class CompServiceImpl extends Service implements CompService {
return btnDatas;
}
@Override
public Map<String, Object> getTabInfo() {
Map<String, Object> apiDatas = new HashMap<>();
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());
// 拓展信息
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);
return apiDatas;
}
@Override
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 编号
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "编号", "compNo");
// 名称
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, 16, 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);
// 2编辑 1查看
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
long id = Long.parseLong((String) params.get("id"));
// 编辑、查看状态赋值,设置只读状态
// 赋值
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 (1 == viewAttr) {
for (SearchConditionItem item : conditionItems) {
item.setViewAttr(viewAttr);
}
}
String groupId = (String) params.get("viewCondition");
HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true);
HashMap<String, Object> conditionsMap = new HashMap<>();
conditionsMap.put("items", conditionItems);
conditionsMap.put("title", "基本信息");
if (StringUtil.isEmpty(groupId) || "0".equals(groupId)) {
conditionsMap.put("items", getBaseForm(viewAttr, id));
conditionsMap.put("title", "基本信息");
} else {
conditionsMap.put("items", getExtForm(viewAttr, id, groupId));
conditionsMap.put("title", getExtendGroupMapper().getGroupNameById(groupId));
}
conditionsMap.put("hide", false);
conditionsMap.put("defaultshow", true);
@ -331,6 +251,7 @@ public class CompServiceImpl extends Service implements CompService {
resultMap.put("buttons", buttonsMap);
resultMap.put("conditions", conditionsMap);
resultMap.put("id", id);
resultMap.put("tabInfo", getTabInfo());
resultMap.put("tables", getExtendTables(id, viewAttr, false));
Map<String, Object> apiDatas = new HashMap<>();
@ -339,66 +260,6 @@ public class CompServiceImpl extends Service implements CompService {
return apiDatas;
}
@Override
public Map<String, Object> getCompExtForm(Map<String, Object> params) {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 分组名称
String groupId = (String) params.get("viewCondition");
// 2编辑 1查看
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
long id = Long.parseLong((String) params.get("id"));
OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
String tableName = "JCL_ORG_COMPEXT";
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", groupId, tableName);
String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
Map<String, Object> compExtMap = getCompExtMapper().listCompExt(tableName, fields, id);
// 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = null;
switch (ExtendInfoBO.getFieldhtmltype(extendInfoPO.getControlType() + "")) {
case INPUT:
item = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
break;
case TEXTAREA:
item = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 1, 60, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
break;
case BROWSER:
// TODO
// item=OrganizationFormItemUtil.browserItem()
break;
case CHECKBOX:
item = OrganizationFormItemUtil.checkboxItem(user, 2, 16, 1, true, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
break;
case SELECT:
// TODO
// item = OrganizationFormItemUtil.selectItem();
break;
case FILEUPLOAD:
case TEXT:
default:
break;
}
if (null != item) {
// 根据viewAttr设置编辑或只读
item.setViewAttr(viewAttr);
// 是否必填
if (1 == extendInfoPO.getIsrequired()) {
item.setViewAttr(3);
item.setRules("required|string");
}
conditionItems.add(item);
}
}
addGroups.add(new SearchConditionGroup(getExtendGroupMapper().getGroupNameById(groupId), true, conditionItems));
apiDatas.put("condition", addGroups);
return apiDatas;
}
@Override
public Map<String, Object> getCompSaveForm() {
@ -534,4 +395,166 @@ public class CompServiceImpl extends Service implements CompService {
return datas;
}
/**
*
*
* @return
*/
private List<TopTab> getTabInfo() {
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());
// 拓展信息
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());
}
}
return topTabs;
}
/**
*
*
* @param viewAttr
* @param id
* @return
*/
private List<SearchConditionItem> getBaseForm(int viewAttr, long id) {
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 编号
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "编号", "compNo");
// 名称
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, 16, 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);
// 编辑、查看状态赋值,设置只读状态
// 赋值
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 (1 == viewAttr) {
for (SearchConditionItem item : conditionItems) {
item.setViewAttr(viewAttr);
}
}
return conditionItems;
}
/**
* viewCondition
*
* @param viewAttr
* @param id
* @param groupId
* @return
*/
private List<SearchConditionItem> getExtForm(int viewAttr, long id, String groupId) {
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 2编辑 1查看
OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
String tableName = "JCL_ORG_COMPEXT";
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", groupId, tableName);
String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
Map<String, Object> compExtMap = getCompExtMapper().listCompExt(tableName, fields, id);
// 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = null;
switch (ExtendInfoBO.getFieldhtmltype(extendInfoPO.getControlType() + "")) {
case INPUT:
item = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
break;
case TEXTAREA:
item = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 1, 60, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
break;
case BROWSER:
// TODO
// item=OrganizationFormItemUtil.browserItem()
break;
case CHECKBOX:
item = OrganizationFormItemUtil.checkboxItem(user, 2, 16, 1, true, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
break;
case SELECT:
// TODO
// item = OrganizationFormItemUtil.selectItem();
break;
case FILEUPLOAD:
case TEXT:
default:
break;
}
if (null != item) {
// 根据viewAttr设置编辑或只读
item.setViewAttr(viewAttr);
// 是否必填
if (1 == extendInfoPO.getIsrequired()) {
item.setViewAttr(3);
item.setRules("required|string");
}
conditionItems.add(item);
}
}
return conditionItems;
}
}

@ -192,26 +192,6 @@ public class CompController {
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getCompExtForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getCompExtForm(@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).getCompExtForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
@ -232,23 +212,4 @@ public class CompController {
}
}
/**
* 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());
}
}
}

@ -99,16 +99,6 @@ public class CompWrapper extends Service {
return getCompService(user).getCompBaseForm(params);
}
/**
*
*
* @param params
* @return
*/
public Map<String, Object> getCompExtForm(Map<String, Object> params) {
return getCompService(user).getCompExtForm(params);
}
/**
*
*
@ -118,12 +108,4 @@ public class CompWrapper extends Service {
return getCompService(user).getCompSaveForm();
}
/**
* Tab
*
* @return
*/
public Map<String, Object> getTabInfo() {
return getCompService(user).getTabInfo();
}
}

Loading…
Cancel
Save