Merge pull request '分部、部门,查看、编辑接口调整' (#83) from feature/dxf into develop

Reviewed-on: #83
pull/86/head
dxfeng 2 years ago
commit bfaa56c606

@ -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";
/**
* /titleID
*/
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,43 +177,167 @@ 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查看
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 = 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);
if (2 == viewAttr) {
params.put("viewattr", viewAttr);
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);
}
List<SearchConditionGroup> addGroups = new ArrayList<>();
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1");
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;
}
if (hfm.getGroupCount(lsField) == 0) {
continue;
}
if (!"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)))) {
continue;
}
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
itemList = new ArrayList<>();
for (Object o : lsField) {
String fieldId = (String) o;
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!"1".equals(isUse)) {
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 ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
}
if ("84".equals(fieldId)) {
if (user.getUID() != 1) {
continue;
}
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
}
if (id.length() > 0 && "subshowid".equals(fieldName)) {
fieldValue = id;
}
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 ("showorder".equals(fieldName)) {
searchConditionItem.setPrecision(2);
}
if ("6".equals(fieldHtmlType)) {//附件
Map<String, Object> otherParams1 = new HashMap<>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
searchConditionItem.setViewAttr(viewAttr);
if ("1".equals(isSystem)) {
itemList.add(searchConditionItem);
} else {
extendItemList.add(searchConditionItem);
}
}
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));
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));
}
}
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", 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<>();
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);
apiDatas.put("result", resultMap);
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", retMap);
return apiDatas;
}
@ -256,18 +346,79 @@ public class CompServiceImpl extends Service implements CompService {
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<>();
apiDatas.put("condition", getCompanyConditionGroups(params));
return apiDatas;
}
@Override
public List<SearchConditionGroup> getMoveForm() {
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> condition = new ArrayList<>();
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "转移到", "164", "company", "compBrowser");
compBrowserItem.setHelpfulTip("在不选择分部情况下,默认转移到集团下一级分部!!!");
condition.add(compBrowserItem);
addGroups.add(new SearchConditionGroup("", true, condition));
return addGroups;
}
@Override
public int moveCompany(DepartmentMoveParam moveParam) {
Integer companyId = moveParam.getId();
Integer targetCompanyId = moveParam.getCompany();
// 判断目标分部是否为它本身以及子元素
Set<Integer> disableIds = new HashSet<>();
disableIds.add(companyId);
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
if (CollectionUtils.isNotEmpty(compPOS)) {
addDisableIds(disableIds, compPOS);
}
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
Map<String, Object> map = new HashMap<>();
map.put("id", companyId.toString());
map.put("supsubcomid", targetCompanyId.toString());
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map).sync();
return companyId;
}
/**
*
*
* @param companyPO
* @return
*/
private boolean isFilter(CompPO companyPO) {
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
}
/**
* ID
*
* @param disableIds
* @param compPOS
*/
private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
for (CompPO compPO : compPOS) {
disableIds.add(compPO.getId());
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
addDisableIds(disableIds, childCompPOS);
}
}
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 = "";
String supSubComId = "";
if ("sibling".equals(addType)) {
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
supSubComId = subCompanyComInfo.getSupsubcomid(id);
} else if ("child".equals(addType)) {
supsubcomid = id;
supSubComId = id;
}
if (StringUtils.isNotBlank(addType)) {
id = "";
@ -287,21 +438,20 @@ public class CompServiceImpl extends Service implements CompService {
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<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);
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;
}
@ -312,9 +462,8 @@ public class CompServiceImpl extends Service implements CompService {
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 (StringUtils.isBlank(addType)) {
if ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
@ -336,8 +485,8 @@ public class CompServiceImpl extends Service implements CompService {
}
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
}
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
fieldValue = supsubcomid;
if (supSubComId.length() > 0 && "supsubcomid".equals(fieldName)) {
fieldValue = supSubComId;
}
if ("subshowid".equals(fieldName)) {
@ -385,106 +534,16 @@ public class CompServiceImpl extends Service implements CompService {
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
itemList.add(searchConditionItem);
if ("1".equals(isSystem)) {
itemList.add(searchConditionItem);
} else {
extendItemList.add(searchConditionItem);
}
}
}
groupItem.put("items", itemList);
grouplist.add(groupItem);
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
}
apiDatas.put("condition", grouplist);
return apiDatas;
return groupList;
}
@Override
public List<SearchConditionGroup> getMoveForm() {
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> condition = new ArrayList<>();
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "转移到", "164", "company", "compBrowser");
compBrowserItem.setHelpfulTip("在不选择分部情况下,默认转移到集团下一级分部!!!");
condition.add(compBrowserItem);
addGroups.add(new SearchConditionGroup("", true, condition));
return addGroups;
}
@Override
public int moveCompany(DepartmentMoveParam moveParam) {
Integer companyId = moveParam.getId();
Integer targetCompanyId = moveParam.getCompany();
// 判断目标分部是否为它本身以及子元素
Set<Integer> disableIds = new HashSet<>();
disableIds.add(companyId);
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
if (CollectionUtils.isNotEmpty(compPOS)) {
addDisableIds(disableIds, compPOS);
}
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
Map<String, Object> map = new HashMap<>();
map.put("id", companyId.toString());
map.put("supsubcomid", targetCompanyId.toString());
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map).sync();
return companyId;
}
/**
*
*
* @param companyPO
* @return
*/
private boolean isFilter(CompPO companyPO) {
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
}
/**
*
*
* @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
*
* @param disableIds
* @param compPOS
*/
private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
for (CompPO compPO : compPOS) {
disableIds.add(compPO.getId());
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
addDisableIds(disableIds, childCompPOS);
}
}
}

@ -12,6 +12,7 @@ import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.TopTab;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.po.CompPO;
@ -20,7 +21,6 @@ import com.engine.organization.entity.department.dto.DepartmentListDTO;
import com.engine.organization.entity.department.param.*;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
@ -32,10 +32,8 @@ import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService;
import com.engine.organization.thread.JobTriggerRunnable;
import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*;
@ -52,12 +50,14 @@ import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.company.DepartmentComInfo;
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;
@ -70,34 +70,8 @@ import java.util.stream.Collectors;
**/
public class DepartmentServiceImpl extends Service implements DepartmentService {
/**
*
* 1
* 2
* 3
*/
private static final String EXTEND_TYPE = "2";
/**
*
*/
private static final String JCL_ORG_DEPT = "JCL_ORG_DEPT";
/**
*
*/
private static final String JCL_ORG_DEPTEXT = "JCL_ORG_DEPTEXT";
/**
*
*/
private static final String JCL_ORG_DEPTEXT_DT1 = "JCL_ORG_DEPTEXT_DT1";
private static final String RIGHT_NAME = "Department:All";
/**
* titleID
*/
private static final Long GROUP_ID = 2L;
private static DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
@ -110,19 +84,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
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 PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门
//PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).listAll("showOrder");
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
@ -167,7 +132,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()," showorder ");
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " showorder ");
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(allList);
// 通过子级遍历父级元素
@ -272,194 +237,162 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
@Override
public Map<String, Object> getDeptBaseForm(Map<String, Object> params) {
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_DEPT : JCL_ORG_DEPTEXT, viewAttr, id, extendTitle.getId().toString(), "");
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_DEPTEXT));
// 处理明细表
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<>();
apiDatas.put("result", resultMap);
return apiDatas;
}
@Override
public Map<String, Object> getSaveForm(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> groupItem;
List<Object> itemList;
List<SearchConditionGroup> groupList = new ArrayList<>();
List<SearchConditionItem> itemList;
List<SearchConditionItem> extendItemList;
String id = Util.null2String(params.get("id"));
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
String nodeType = Util.null2String(params.get("type"));
String addType = Util.null2String(params.get("addType"));
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String subcompanyid1 = "";
String supDepId = "";
switch (addType) {
case "normal":
if (nodeType.equals("subcompany")) {
subcompanyid1 = id;
} else {
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
}
break;
case "sibling":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = departmentComInfo.getDepartmentsupdepid(id);
break;
case "child":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = id;
break;
}
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem;
HrmFieldBean hrmFieldBean;
HrmDeptFieldManagerE9 hfm;
try {
hfm = new HrmDeptFieldManagerE9(5);
} 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);
if (2 == viewAttr) {
params.put("viewattr", viewAttr);
groupList = getDepartmentConditionGroups(params);
} else {
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1");
String grouplabel = HrmFieldGroupComInfo.getLabel(groupid);
itemList = new ArrayList<>();
groupItem = new HashMap<>();
groupItem.put("title", SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()));
groupItem.put("hide", groupHide);
groupItem.put("defaultshow", true);
for (Object o : lsField) {
String fieldId = (String) o;
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!isUse.equals("1")) 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 (HrmFieldComInfo.getIssystem(fieldId).equals("1")) {
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem;
HrmFieldBean hrmFieldBean;
HrmDeptFieldManagerE9 hfm;
try {
hfm = new HrmDeptFieldManagerE9(5);
} catch (Exception e) {
throw new RuntimeException(e);
}
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;
if (hfm.getGroupCount(lsField) == 0)
continue;
if (!"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)))) continue;
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
itemList = new ArrayList<>();
extendItemList = new ArrayList<>();
for (Object o : lsField) {
String fieldId = (String) o;
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!"1".equals(isUse)) 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 ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmdepartmentdefined", fieldName);
}
}
if (!groupHide && tmpViewAttr == 2 && HrmFieldComInfo.getIsmand(fieldId).equals("1")) {
tmpViewAttr = 3;
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
rules = "required|integer";
} else {
rules = "required|string";
if (id.length() > 0 && "showid".equals(fieldName)) {
fieldValue = id;
}
}
if (subcompanyid1.length() > 0 && fieldName.equals("subcompanyid1")) {
fieldValue = subcompanyid1;
}
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 ("showorder".equals(fieldName)) {
searchConditionItem.setPrecision(2);
}
if (supDepId.length() > 0 && fieldName.equals("supdepid")) {
fieldValue = supDepId;
}
if ("6".equals(fieldHtmlType)) {//附件
Map<String, Object> otherParams1 = new HashMap<>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
if (fieldName.equals("showid")) {
if (addType.length() > 0) {
continue;
searchConditionItem.setViewAttr(viewAttr);
if ("1".equals(isSystem)) {
itemList.add(searchConditionItem);
} else {
fieldValue = id;
tmpViewAttr = 1;
extendItemList.add(searchConditionItem);
}
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldId);
hrmFieldBean.setFieldname(fieldName);
hrmFieldBean.setFieldlabel(fieldLabel);
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setIssystem("1");
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlUrl);
hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules);
if (hrmFieldBean.getFieldname().equals("subcompanyid1") || hrmFieldBean.getFieldname().equals("supdepid")) {
hrmFieldBean.setHideVirtualOrg(true);
}
if (hrmFieldBean.getFieldname().equals("departmentcode")) {
hrmFieldBean.setMultilang(false);
int operateLevel;
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
boolean hrmDetachAble = manageDetachComInfo.isUseHrmManageDetach();
if (hrmDetachAble) {
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
operateLevel = checkSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmDepartmentEdit:Edit", Integer.parseInt(departmentComInfo.getSubcompanyid1(id)));
} else {
operateLevel = 2;
}
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
if (fieldName.equals("showorder")) {
searchConditionItem.setPrecision(2);
}
if (fieldName.equals("showid")) {
Map<String, Object> otherParams = new HashMap<>();
otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams);
if (tmp == 0 && HrmUserVarify.checkUserRight("HrmDepartmentEdit:Edit", user) && operateLevel > 0) {
int resourceNum = 0;
RecordSet rs = new RecordSet();
String sql = "SELECT COUNT(*) FROM hrmresource WHERE departmentid = " + id + " and ( status =0 or status = 1 or status = 2 or status = 3)";
rs.execute(sql);
if (rs.next()) {
resourceNum = rs.getInt(1);
}
if ("6".equals(fieldHtmlType)) {//附件
Map<String, Object> otherParams1 = new HashMap<>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
//4:解聘 5:离职 6:退休 7:无效
int resourceNum1 = 0;
sql = "SELECT COUNT(*) FROM hrmresource WHERE departmentid = " + id + " and status in(4,5,6,7)";
rs.execute(sql);
if (rs.next()) {
resourceNum1 = rs.getInt(1);
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname("deptResourceInfo");
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);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("buttons", buttonsMap);
resultMap.put("conditions", groupList);
resultMap.put("id", id);
List<TopTab> topTabs = new ArrayList<>();
topTabs.add(TopTab.builder().color("#000000").groupId("4").showcount(false).title("部门信息").viewCondition("4").build());
resultMap.put("tabInfo", topTabs);
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap);
return apiDatas;
}
@Override
public Map<String, Object> getSaveForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("condition", getDepartmentConditionGroups(params));
return apiDatas;
}
@ -626,7 +559,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 更新子部门下岗位的所属分部
for (DepartmentPO departmentPO : firstChildDeptList) {
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(targetDepartment.getSubCompanyId1(), Util.null2String(targetDepartment.getSubCompanyId1()), deptList);
forbiddenChildTag(targetDepartment.getSubCompanyId1(), deptList);
}
// 原部门删除
// DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
@ -713,7 +646,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
//for (Long hrmResourceId : hrmResourceIds) {
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
//}
forbiddenChildTag(deptById.getSubCompanyId1(), Util.null2String(deptById.getSubCompanyId1()), deptList);
forbiddenChildTag(deptById.getSubCompanyId1(), deptList);
// 递归更新下级部门、岗位
return 1;
}
@ -721,20 +654,20 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
/**
* id
*
* @param parentComp
* @param subCompanyId1
* @param deptList
*/
void forbiddenChildTag(Integer parentComp, String ecCompanyId, List<DepartmentPO> deptList) {
void forbiddenChildTag(Integer subCompanyId1, List<DepartmentPO> deptList) {
if (CollectionUtils.isNotEmpty(deptList)) {
for (DepartmentPO departmentPO : deptList) {
departmentPO.setSubCompanyId1(parentComp);
departmentPO.setSubCompanyId1(subCompanyId1);
// 更新EC表部门
updateEcDepartment(departmentPO);
updateEcDepartment(departmentPO);
// 更新组织架构图
// TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
// 刷新岗位所属分部
refreshJobComp(departmentPO.getId(), parentComp);
refreshJobComp(departmentPO.getId(), subCompanyId1);
// 更新当前部门下的人员
// String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
//new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
@ -745,7 +678,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
//}
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(parentComp, ecCompanyId, childList);
forbiddenChildTag(subCompanyId1, childList);
}
}
}
@ -892,7 +825,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("coadjutant", Util.null2String(departmentPO.getCoadjutant()));
map.put("id", Util.null2String(departmentPO.getId()));
map.put("id", Util.null2String(departmentPO.getId()));
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync();
}
@ -913,17 +846,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync();
}
/**
* EC
*
* @param id
*/
private void cancelEcDepartment(Long id) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("forbiddenTag", 1);
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
}
private void addDisableIds(Set<Integer> disableIds, List<DepartmentPO> deptListByPId) {
for (DepartmentPO departmentPO : deptListByPId) {
@ -951,4 +873,154 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
}
}
private List<SearchConditionGroup> getDepartmentConditionGroups(Map<String, Object> params) {
List<SearchConditionGroup> groupList = new ArrayList<>();
List<SearchConditionItem> itemList;
List<SearchConditionItem> extendItemList;
String id = Util.null2String(params.get("id"));
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
String nodeType = Util.null2String(params.get("type"));
String addType = Util.null2String(params.get("addType"));
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String subcompanyid1 = "";
String supDepId = "";
switch (addType) {
case "normal":
if ("subcompany".equals(nodeType)) {
subcompanyid1 = id;
} else {
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
}
break;
case "sibling":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = departmentComInfo.getDepartmentsupdepid(id);
break;
case "child":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = id;
break;
default:
break;
}
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem;
HrmFieldBean hrmFieldBean;
HrmDeptFieldManagerE9 hfm;
try {
hfm = new HrmDeptFieldManagerE9(5);
} 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);
itemList = new ArrayList<>();
extendItemList = new ArrayList<>();
for (Object o : lsField) {
String fieldId = (String) o;
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String isUse = HrmFieldComInfo.getIsused(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 isSystem = HrmFieldComInfo.getIssystem(fieldId);
String fieldValue = "";
if (StringUtils.isBlank(addType)) {
if ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmdepartmentdefined", 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 (subcompanyid1.length() > 0 && "subcompanyid1".equals(fieldName)) {
fieldValue = subcompanyid1;
}
if (supDepId.length() > 0 && "supdepid".equals(fieldName)) {
fieldValue = supDepId;
}
if ("showid".equals(fieldName)) {
if (addType.length() > 0) {
continue;
} else {
fieldValue = id;
tmpViewAttr = 1;
}
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldId);
hrmFieldBean.setFieldname(fieldName);
hrmFieldBean.setFieldlabel(fieldLabel);
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setIssystem("1");
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlUrl);
hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules);
if ("subcompanyid1".equals(hrmFieldBean.getFieldname()) || "supdepid".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setHideVirtualOrg(true);
}
if ("departmentcode".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setMultilang(false);
}
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
if ("showorder".equals(fieldName)) {
searchConditionItem.setPrecision(2);
}
if ("showid".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…
Cancel
Save