分部查看、编辑接口调整
This commit is contained in:
parent
64af65cad3
commit
6fc67d7d67
|
|
@ -12,19 +12,17 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.TopTab;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.dto.CompListDTO;
|
||||
import com.engine.organization.entity.company.param.CompParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.service.CompService;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
|
@ -34,13 +32,16 @@ import com.engine.organization.util.page.PageInfo;
|
|||
import com.engine.organization.util.page.PageUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
|
||||
import weaver.hrm.definedfield.HrmFieldComInfo;
|
||||
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import weaver.systeminfo.systemright.CheckSubCompanyRight;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -52,48 +53,13 @@ import java.util.stream.Collectors;
|
|||
* @version: 1.0
|
||||
*/
|
||||
public class CompServiceImpl extends Service implements CompService {
|
||||
/**
|
||||
* 分组类型
|
||||
* 1:分部
|
||||
* 2:部门
|
||||
* 3:岗位
|
||||
*/
|
||||
private static final String EXTEND_TYPE = "1";
|
||||
/**
|
||||
* 主表表名
|
||||
*/
|
||||
private static final String JCL_ORG_COMP = "JCL_ORG_COMP";
|
||||
/**
|
||||
* 主表拓展表
|
||||
*/
|
||||
private static final String JCL_ORG_COMPEXT = "JCL_ORG_COMPEXT";
|
||||
/**
|
||||
* 明细表拓展表
|
||||
*/
|
||||
private static final String JCL_ORG_COMPEXT_DT1 = "JCL_ORG_COMPEXT_DT1";
|
||||
|
||||
private static final String RIGHT_NAME = "Company:All";
|
||||
|
||||
private static final String HRM_COMPANY = "hrmsubcompany";
|
||||
|
||||
/**
|
||||
* 公司/分部主表title指定ID
|
||||
*/
|
||||
private static final Long GROUP_ID = 1L;
|
||||
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(CompParam params) {
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
|
|
@ -105,7 +71,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
CompPO companyPO = CompBO.convertParamToPO(params, user.getUID());
|
||||
boolean filter = isFilter(companyPO);
|
||||
PageInfo<CompListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()," showorder ");
|
||||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams(), " showorder ");
|
||||
List<CompPO> allList = getCompMapper().listAll(orderSql);
|
||||
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
||||
|
|
@ -211,173 +177,88 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
@Override
|
||||
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
|
||||
// 2编辑 1查看
|
||||
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
|
||||
long id = Long.parseLong((String) params.get("id"));
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
|
||||
HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
buttonsMap.put("hasEdit", true);
|
||||
buttonsMap.put("hasSave", true);
|
||||
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
if ("0".equals(groupId)) {
|
||||
groupId = GROUP_ID.toString();
|
||||
}
|
||||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1");
|
||||
|
||||
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
||||
for (ExtendTitlePO extendTitle : extendTitles) {
|
||||
List<SearchConditionItem> items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_COMP : JCL_ORG_COMPEXT, viewAttr, id, extendTitle.getId() + "", "");
|
||||
if (CollectionUtils.isNotEmpty(items)) {
|
||||
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("buttons", buttonsMap);
|
||||
resultMap.put("conditions", addGroups);
|
||||
resultMap.put("id", id);
|
||||
// 拓展页面分组
|
||||
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_COMPEXT));
|
||||
// 处理明细表
|
||||
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<>();
|
||||
|
||||
apiDatas.put("result", resultMap);
|
||||
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCompSaveForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<Map<String, Object>> grouplist = new ArrayList<>();
|
||||
Map<String, Object> retMap = new HashMap<>();
|
||||
List<SearchConditionGroup> groupList = new ArrayList<>();
|
||||
List<SearchConditionItem> itemList;
|
||||
List<SearchConditionItem> extendItemList = new ArrayList<>();
|
||||
|
||||
String id = Util.null2String(params.get("id"));
|
||||
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
|
||||
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
|
||||
|
||||
String addType = Util.null2String(params.get("addType"));
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
String supsubcomid = "";
|
||||
if ("sibling".equals(addType)) {
|
||||
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
|
||||
} else if ("child".equals(addType)) {
|
||||
supsubcomid = id;
|
||||
}
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
id = "";
|
||||
}
|
||||
if (2 == viewAttr) {
|
||||
params.put("viewattr", viewAttr);
|
||||
Object condition = getCompSaveForm(params).get("condition");
|
||||
if (condition instanceof List) {
|
||||
groupList = getCompanyConditionGroups(params);
|
||||
}
|
||||
} else {
|
||||
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
||||
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
||||
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
||||
SearchConditionItem searchConditionItem;
|
||||
HrmFieldBean hrmFieldBean;
|
||||
HrmDeptFieldManagerE9 hfm;
|
||||
try {
|
||||
hfm = new HrmDeptFieldManagerE9(4);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
||||
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
||||
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
||||
|
||||
|
||||
HrmDeptFieldManagerE9 hfm;
|
||||
try {
|
||||
hfm = new HrmDeptFieldManagerE9(4);
|
||||
} catch (Exception e) {
|
||||
throw new OrganizationRunTimeException("");
|
||||
}
|
||||
hfm.isReturnDecryptData(true);
|
||||
hfm.getCustomData(Util.getIntValue(id));
|
||||
List lsGroup = hfm.getLsGroup();
|
||||
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
|
||||
String groupId = (String) lsGroup.get(tmp);
|
||||
List lsField = hfm.getLsField(groupId);
|
||||
|
||||
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)));
|
||||
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()));
|
||||
groupItem.put("hide", groupHide);
|
||||
groupItem.put("defaultshow", true);
|
||||
for (int j = 0; j < lsField.size(); j++) {
|
||||
String fieldId = (String) lsField.get(j);
|
||||
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
||||
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
||||
if (!"1".equals(isUse)) {
|
||||
hfm.getCustomData(Util.getIntValue(id));
|
||||
List lsGroup = hfm.getLsGroup();
|
||||
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
|
||||
String groupId = (String) lsGroup.get(tmp);
|
||||
List lsField = hfm.getLsField(groupId);
|
||||
if (lsField.size() == 0)
|
||||
continue;
|
||||
}
|
||||
int tmpViewAttr = viewAttr;
|
||||
String rules = "";
|
||||
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
|
||||
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
|
||||
String type = HrmFieldComInfo.getFieldType(fieldId);
|
||||
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
|
||||
String fieldValue = "";
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
} else {
|
||||
if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
|
||||
if (hfm.getGroupCount(lsField) == 0)
|
||||
continue;
|
||||
if (!Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)).equals("1")) continue;
|
||||
|
||||
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
|
||||
itemList = new ArrayList<>();
|
||||
for (Object o : lsField) {
|
||||
String fieldId = (String) o;
|
||||
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
||||
if (!isUse.equals("1")) continue;
|
||||
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
||||
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
|
||||
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
|
||||
String type = HrmFieldComInfo.getFieldType(fieldId);
|
||||
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
|
||||
String isSystem = HrmFieldComInfo.getIssystem(fieldId);
|
||||
String fieldValue;
|
||||
if (isSystem.equals("1")) {
|
||||
fieldValue = hfm.getData(fieldName);
|
||||
} else {
|
||||
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!groupHide && tmpViewAttr == 2 && "1".equals(HrmFieldComInfo.getIsmand(fieldId))) {
|
||||
tmpViewAttr = 3;
|
||||
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
|
||||
rules = "required|integer";
|
||||
} else {
|
||||
rules = "required|string";
|
||||
if ("84".equals(fieldId)) {
|
||||
if (user.getUID() != 1) continue;
|
||||
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
|
||||
}
|
||||
}
|
||||
|
||||
if ("84".equals(fieldId)) {
|
||||
if (user.getUID() != 1) {
|
||||
continue;
|
||||
}
|
||||
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
|
||||
}
|
||||
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
|
||||
fieldValue = supsubcomid;
|
||||
}
|
||||
|
||||
if ("subshowid".equals(fieldName)) {
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
continue;
|
||||
} else {
|
||||
if (id.length() > 0 && fieldName.equals("subshowid")) {
|
||||
fieldValue = id;
|
||||
tmpViewAttr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
HrmFieldBean hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldid(fieldId);
|
||||
hrmFieldBean.setFieldname(fieldName);
|
||||
hrmFieldBean.setFieldlabel(fieldLabel);
|
||||
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
|
||||
hrmFieldBean.setType(type);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setFieldvalue(fieldValue);
|
||||
hrmFieldBean.setDmlurl(dmlUrl);
|
||||
hrmFieldBean.setViewAttr(tmpViewAttr);
|
||||
hrmFieldBean.setRules(rules);
|
||||
hrmFieldBean.setIssystem("1");
|
||||
if ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
|
||||
hrmFieldBean.setHideVirtualOrg(true);
|
||||
}
|
||||
if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
|
||||
hrmFieldBean.setMultilang(false);
|
||||
}
|
||||
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
if (searchConditionItem != null) {
|
||||
searchConditionItem.setLabelcol(8);
|
||||
searchConditionItem.setFieldcol(16);
|
||||
if ("showorder".equals(hrmFieldBean.getFieldname())) {
|
||||
searchConditionItem.setPrecision(2);
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldid(fieldId);
|
||||
hrmFieldBean.setFieldname(fieldName);
|
||||
hrmFieldBean.setFieldlabel(fieldLabel);
|
||||
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
|
||||
hrmFieldBean.setType(type);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setFieldvalue(fieldValue);
|
||||
hrmFieldBean.setDmlurl(dmlUrl);
|
||||
hrmFieldBean.setIssystem("1");
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
if (searchConditionItem.getBrowserConditionParam() != null) {
|
||||
searchConditionItem.getBrowserConditionParam().setViewAttr(viewAttr);
|
||||
}
|
||||
if ("subshowid".equals(fieldName)) {
|
||||
Map<String, Object> otherParams = new HashMap<>();
|
||||
otherParams.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(otherParams);
|
||||
if (fieldName.equals("showorder")) {
|
||||
searchConditionItem.setPrecision(2);
|
||||
}
|
||||
|
||||
if ("6".equals(fieldHtmlType)) {//附件
|
||||
|
|
@ -386,13 +267,81 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
searchConditionItem.setOtherParams(otherParams1);
|
||||
}
|
||||
|
||||
searchConditionItem.setViewAttr(viewAttr);
|
||||
if ("1".equals(isSystem)) {
|
||||
itemList.add(searchConditionItem);
|
||||
} else {
|
||||
extendItemList.add(searchConditionItem);
|
||||
}
|
||||
}
|
||||
|
||||
int operateLevel;
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
boolean hrmDetachAble = manageDetachComInfo.isUseHrmManageDetach();
|
||||
if (hrmDetachAble) {
|
||||
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
|
||||
operateLevel = checkSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmSubCompanyEdit:Edit", Integer.parseInt(id));
|
||||
} else {
|
||||
operateLevel = 2;
|
||||
}
|
||||
|
||||
if (tmp == 0 && HrmUserVarify.checkUserRight("HrmSubCompanyEdit:Edit", user) && operateLevel > 0) {
|
||||
int resourceNum = 0;
|
||||
|
||||
String sql;
|
||||
RecordSet rs = new RecordSet();
|
||||
sql = "SELECT COUNT(*) FROM hrmresource WHERE subcompanyid1 = " + id + " and ( status =0 or status = 1 or status = 2 or status = 3)";
|
||||
rs.execute(sql);
|
||||
if (rs.next()) {
|
||||
resourceNum = rs.getInt(1);
|
||||
}
|
||||
//4:解聘 5:离职 6:退休 7:无效
|
||||
int resourceNum1 = 0;
|
||||
sql = "SELECT COUNT(*) FROM hrmresource WHERE subcompanyid1 = " + id + " and status in(4,5,6,7)";
|
||||
rs.execute(sql);
|
||||
if (rs.next()) {
|
||||
resourceNum1 = rs.getInt(1);
|
||||
}
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("subcomResourceInfo");
|
||||
hrmFieldBean.setFieldlabel("382428");
|
||||
hrmFieldBean.setFieldhtmltype("1");
|
||||
hrmFieldBean.setType("1");
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setFieldvalue(resourceNum + "/" + resourceNum1);
|
||||
hrmFieldBean.setDmlurl("");
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
searchConditionItem.setViewAttr(viewAttr);
|
||||
itemList.add(searchConditionItem);
|
||||
}
|
||||
|
||||
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
grouplist.add(groupItem);
|
||||
}
|
||||
apiDatas.put("condition", grouplist);
|
||||
HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
buttonsMap.put("hasEdit", true);
|
||||
buttonsMap.put("hasSave", true);
|
||||
|
||||
retMap.put("id", id);
|
||||
retMap.put("conditions", groupList);
|
||||
retMap.put("buttons", buttonsMap);
|
||||
List<TopTab> topTabs = new ArrayList<>();
|
||||
topTabs.add(TopTab.builder().color("#000000").groupId("4").showcount(false).title("分部信息").viewCondition("4").build());
|
||||
retMap.put("tabInfo", topTabs);
|
||||
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
||||
apiDatas.put("result", retMap);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCompSaveForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
apiDatas.put("condition", getCompanyConditionGroups(params));
|
||||
return apiDatas;
|
||||
|
||||
}
|
||||
|
|
@ -440,39 +389,6 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断编号是否重复
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String repeatDetermine(String compNo) {
|
||||
//CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
|
||||
//if (StringUtils.isNotBlank(compNo)) {
|
||||
// compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
|
||||
// List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo));
|
||||
// OrganizationAssert.isEmpty(list, "编号不允许重复");
|
||||
//} else {
|
||||
// OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), "编号不允许为空");
|
||||
// compNo = autoCreateCompanyNo();
|
||||
//}
|
||||
//return compNo;
|
||||
return "";
|
||||
}
|
||||
|
||||
///**
|
||||
// * 自动编号处理
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
//private static String autoCreateCompanyNo() {
|
||||
// String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
|
||||
// List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// generateCode = autoCreateCompanyNo();
|
||||
// }
|
||||
// return generateCode;
|
||||
//}
|
||||
|
||||
/**
|
||||
* 添加子元素ID
|
||||
*
|
||||
|
|
@ -487,4 +403,142 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<SearchConditionGroup> getCompanyConditionGroups(Map<String, Object> params) {
|
||||
String id = Util.null2String(params.get("id"));
|
||||
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
|
||||
|
||||
String addType = Util.null2String(params.get("addType"));
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
String supSubComId = "";
|
||||
if ("sibling".equals(addType)) {
|
||||
supSubComId = subCompanyComInfo.getSupsubcomid(id);
|
||||
} else if ("child".equals(addType)) {
|
||||
supSubComId = id;
|
||||
}
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
id = "";
|
||||
}
|
||||
|
||||
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
||||
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
||||
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
||||
|
||||
|
||||
HrmDeptFieldManagerE9 hfm;
|
||||
try {
|
||||
hfm = new HrmDeptFieldManagerE9(4);
|
||||
} catch (Exception e) {
|
||||
throw new OrganizationRunTimeException("");
|
||||
}
|
||||
hfm.isReturnDecryptData(true);
|
||||
hfm.getCustomData(Util.getIntValue(id));
|
||||
List lsGroup = hfm.getLsGroup();
|
||||
List<SearchConditionGroup> groupList = new ArrayList<>();
|
||||
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
|
||||
String groupId = (String) lsGroup.get(tmp);
|
||||
List lsField = hfm.getLsField(groupId);
|
||||
|
||||
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)));
|
||||
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
|
||||
List<SearchConditionItem> itemList = new ArrayList<>();
|
||||
List<SearchConditionItem> extendItemList = new ArrayList<>();
|
||||
for (Object o : lsField) {
|
||||
String fieldId = (String) o;
|
||||
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
||||
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
||||
String isSystem = HrmFieldComInfo.getIssystem(fieldId);
|
||||
if (!"1".equals(isUse)) {
|
||||
continue;
|
||||
}
|
||||
int tmpViewAttr = viewAttr;
|
||||
String rules = "";
|
||||
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
|
||||
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
|
||||
String type = HrmFieldComInfo.getFieldType(fieldId);
|
||||
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
|
||||
String fieldValue = "";
|
||||
if (StringUtils.isBlank(addType)) {
|
||||
if ("1".equals(isSystem)) {
|
||||
fieldValue = hfm.getData(fieldName);
|
||||
} else {
|
||||
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!groupHide && tmpViewAttr == 2 && "1".equals(HrmFieldComInfo.getIsmand(fieldId))) {
|
||||
tmpViewAttr = 3;
|
||||
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
|
||||
rules = "required|integer";
|
||||
} else {
|
||||
rules = "required|string";
|
||||
}
|
||||
}
|
||||
|
||||
if ("84".equals(fieldId)) {
|
||||
if (user.getUID() != 1) {
|
||||
continue;
|
||||
}
|
||||
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
|
||||
}
|
||||
if (supSubComId.length() > 0 && "supsubcomid".equals(fieldName)) {
|
||||
fieldValue = supSubComId;
|
||||
}
|
||||
|
||||
if ("subshowid".equals(fieldName)) {
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
continue;
|
||||
} else {
|
||||
fieldValue = id;
|
||||
tmpViewAttr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
HrmFieldBean hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldid(fieldId);
|
||||
hrmFieldBean.setFieldname(fieldName);
|
||||
hrmFieldBean.setFieldlabel(fieldLabel);
|
||||
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
|
||||
hrmFieldBean.setType(type);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setFieldvalue(fieldValue);
|
||||
hrmFieldBean.setDmlurl(dmlUrl);
|
||||
hrmFieldBean.setViewAttr(tmpViewAttr);
|
||||
hrmFieldBean.setRules(rules);
|
||||
hrmFieldBean.setIssystem("1");
|
||||
if ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
|
||||
hrmFieldBean.setHideVirtualOrg(true);
|
||||
}
|
||||
if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
|
||||
hrmFieldBean.setMultilang(false);
|
||||
}
|
||||
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
if (searchConditionItem != null) {
|
||||
searchConditionItem.setLabelcol(8);
|
||||
searchConditionItem.setFieldcol(16);
|
||||
if ("showorder".equals(hrmFieldBean.getFieldname())) {
|
||||
searchConditionItem.setPrecision(2);
|
||||
}
|
||||
if ("subshowid".equals(fieldName)) {
|
||||
Map<String, Object> otherParams = new HashMap<>();
|
||||
otherParams.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(otherParams);
|
||||
}
|
||||
|
||||
if ("6".equals(fieldHtmlType)) {//附件
|
||||
Map<String, Object> otherParams1 = new HashMap<>();
|
||||
otherParams1.put("showOrder", false);
|
||||
searchConditionItem.setOtherParams(otherParams1);
|
||||
}
|
||||
if ("1".equals(isSystem)) {
|
||||
itemList.add(searchConditionItem);
|
||||
} else {
|
||||
extendItemList.add(searchConditionItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
}
|
||||
return groupList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,8 +184,7 @@ public class CompController {
|
|||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
params.put("viewattr", 2);
|
||||
return ReturnResult.successed(getCompWrapper(user).getCompSaveForm(params));
|
||||
return ReturnResult.successed(getCompWrapper(user).getCompBaseForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue