人员卡片查看页面逻辑重写

pull/80/head
dxfeng 3 years ago
parent fb17f43323
commit 85ec966813

@ -24,7 +24,7 @@ public class CompBO {
}
public static List<SearchTree> buildSetToSearchTree(Set<CompPO> comps) {
return comps.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).map(item -> {
return comps.stream().sorted(Comparator.comparing(item -> null == item.getShowOrder() ? 0 : item.getShowOrder())).map(item -> {
SearchTree tree = new SearchTree();
tree.setCanClick(true);
tree.setCanceled(item.getCanceled() != null && item.getCanceled() != 0);

@ -11,25 +11,37 @@ import com.api.browser.util.BrowserInitUtil;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.api.hrm.bean.FieldItem;
import com.api.hrm.util.FieldType;
import com.api.hrm.util.ServiceUtil;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.*;
import com.cloudstore.dev.api.util.TextUtil;
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
import com.engine.organization.entity.SelectOptionParam;
import com.engine.organization.entity.browser.po.CustomBrowserBean;
import com.engine.organization.entity.extend.param.ExtendInfoFieldParam;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.entity.browser.po.CustomBrowserBean;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.sensitive.biz.SensitiveWordTypeComInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.docs.docs.CustomFieldManager;
import weaver.encrypt.EncryptUtil;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
import weaver.hrm.definedfield.HrmFieldManager;
import weaver.hrm.moduledetach.ManageDetachComInfo;
import weaver.hrm.resource.CustomFieldTreeManager;
import weaver.hrm.resource.HrmListValidate;
import weaver.systeminfo.SystemEnv;
import weaver.systeminfo.systemright.CheckSubCompanyRight;
import java.util.*;
@ -546,4 +558,309 @@ public class ExtendInfoBO {
return searchConditionItem;
}
// 基本信息明细表
// 个人信息明细表
// 工作信息明细表
public Map<String, Object> getFormFields(User user, String id, Integer viewAttr, boolean isAdd) {
Map<String, Object> result = new HashMap<String, Object>();
List<Object> lsGroup = new ArrayList<Object>();
Map<String, Object> groupitem = null;
List<Object> itemlist = null;
try {
if (isAdd) viewAttr = 2;
if (id.length() == 0) {
id = "" + user.getUID();
}
boolean isSelf = false;
if (id.equals("" + user.getUID())) {
isSelf = true;
}
String subcompanyid = "", departmentId = "";
RecordSet recordSet = new RecordSet();
//不能直接判断是否有人力资源维护权限,也需要根据分权进行判断
boolean canEdit = false;
recordSet.executeSql("select subcompanyid1, status, departmentId from hrmresource where id = " + id);
if (recordSet.next()) {
subcompanyid = Util.toScreen(recordSet.getString("subcompanyid1"), user.getLanguage());
departmentId = StringUtil.vString(recordSet.getString("departmentId"));
if (subcompanyid == null || subcompanyid.equals("") || subcompanyid.equalsIgnoreCase("null"))
subcompanyid = "-1";
}
int operatelevel = -1;
//人力资源模块是否开启了管理分权,如不是,则不显示框架,直接转向到列表页面(新的分权管理)
int hrmdetachable = 0;
ManageDetachComInfo ManageDetachComInfo = new ManageDetachComInfo();
boolean isUseHrmManageDetach = ManageDetachComInfo.isUseHrmManageDetach();
if (isUseHrmManageDetach) {
hrmdetachable = 1;
} else {
hrmdetachable = 0;
}
if (hrmdetachable == 1) {
CheckSubCompanyRight CheckSubCompanyRight = new CheckSubCompanyRight();
operatelevel = CheckSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmResourceEdit:Edit", Util.getIntValue(subcompanyid));
} else {
if (HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user, departmentId)) {
operatelevel = 2;
}
}
if (operatelevel > 0) {
canEdit = true;
}
int scopeId = 1;
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
com.engine.hrm.biz.HrmFieldManager hfm = new com.engine.hrm.biz.HrmFieldManager("HrmCustomFieldByInfoType", scopeId);
CustomFieldManager cfm = new CustomFieldManager("HrmCustomFieldByInfoType", scopeId);
if (viewAttr != 1) hfm.isReturnDecryptData(true);
hfm.getHrmData(Util.getIntValue(id));
cfm.getCustomData(Util.getIntValue(id));
HrmListValidate hrmListValidate = new HrmListValidate();
while (HrmFieldGroupComInfo.next()) {
int grouptype = Util.getIntValue(HrmFieldGroupComInfo.getType());
if (grouptype != scopeId) continue;
int grouplabel = Util.getIntValue(HrmFieldGroupComInfo.getLabel());
int groupid = Util.getIntValue(HrmFieldGroupComInfo.getid());
hfm.getCustomFields(groupid);
groupitem = new HashMap<String, Object>();
itemlist = new ArrayList<Object>();
groupitem.put("title", SystemEnv.getHtmlLabelName(grouplabel, user.getLanguage()));
groupitem.put("defaultshow", true);
if (groupid == 4) {
groupitem.put("hide", (!isAdd && !canEdit && isSelf && viewAttr == 2 && hfm.getContactEditCount() == 0) || !hrmListValidate.isValidate(42));
} else {
groupitem.put("hide", (!isAdd && !canEdit && isSelf && viewAttr == 2 && hfm.getContactEditCount() == 0) || !Util.null2String(HrmFieldGroupComInfo.getIsShow()).equals("1"));
}
groupitem.put("items", itemlist);
lsGroup.add(groupitem);
while (hfm.next()) {
int tmpviewattr = viewAttr;
String fieldName = hfm.getFieldname();
String cusFieldname = "";
String fieldValue = "";
if (hfm.isBaseField(fieldName)) {
fieldValue = hfm.getHrmData(fieldName);
} else {
fieldValue = Util.null2String(new EncryptUtil().decrypt("cus_fielddata", "field" + hfm.getFieldid(), "HrmCustomFieldByInfoType", "" + scopeId, cfm.getData("field" + hfm.getFieldid()), viewAttr == 2, true));
cusFieldname = "customfield" + hfm.getFieldid();
if (isAdd) cusFieldname = "customfield_1_" + hfm.getFieldid();
}
if (!hfm.isUse() || (!isAdd && viewAttr == 2 && !canEdit && isSelf && !hfm.isModify())) {
HrmFieldBean hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname(cusFieldname.length() > 0 ? cusFieldname : fieldName);
hrmFieldBean.setFieldhtmltype("1");
hrmFieldBean.setType("1");
if (!isAdd) {
hrmFieldBean.setFieldvalue(fieldValue);
}
hrmFieldBean.setIsFormField(true);
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
Map<String, Object> otherParams = new HashMap<String, Object>();
otherParams.put("hide", true);
searchConditionItem.setOtherParams(otherParams);
itemlist.add(searchConditionItem);
continue;
}
org.json.JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
HrmFieldBean hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid((String) hrmFieldConf.get("id"));
hrmFieldBean.setFieldname(cusFieldname.length() > 0 ? cusFieldname : fieldName);
hrmFieldBean.setFieldlabel(hfm.getLable());
hrmFieldBean.setFieldhtmltype((String) hrmFieldConf.get("fieldhtmltype"));
hrmFieldBean.setType((String) hrmFieldConf.get("type"));
hrmFieldBean.setDmlurl((String) hrmFieldConf.get("dmlurl"));
hrmFieldBean.setIssystem("" + (Integer) hrmFieldConf.get("issystem"));
if (!isAdd) {
hrmFieldBean.setFieldvalue(fieldValue);
}
hrmFieldBean.setIsFormField(true);
if (viewAttr == 2 && ((String) hrmFieldConf.get("ismand")).equals("1")) {
tmpviewattr = 3;
if (hrmFieldBean.getFieldhtmltype().equals("3")) {
hrmFieldBean.setRules("required|string");
// if (hrmFieldBean.getType().equals("2")||hrmFieldBean.getType().equals("161")||hrmFieldBean.getType().equals("162")) {
// hrmFieldBean.setRules("required|string");
// }else{
// hrmFieldBean.setRules("required|integer");
// }
} else if (hrmFieldBean.getFieldhtmltype().equals("4") ||
hrmFieldBean.getFieldhtmltype().equals("5")) {
hrmFieldBean.setRules("required|integer");
} else if (hrmFieldBean.getFieldhtmltype().equals("1") && hrmFieldBean.getType().equals("2")) {
hrmFieldBean.setRules("required|integer");
} else {
hrmFieldBean.setRules("required|string");
}
}
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem == null) continue;
if (searchConditionItem.getBrowserConditionParam() != null) {
searchConditionItem.getBrowserConditionParam().setViewAttr(tmpviewattr);
}
searchConditionItem.setViewAttr(tmpviewattr);
itemlist.add(searchConditionItem);
}
if (itemlist.size() == 0) lsGroup.remove(groupitem);
}
result.put("conditions", lsGroup);
//明细信息
List<Object> lsTable = new ArrayList<Object>();
List<HrmFieldBean> titles = null;
Map<String, Object> table = null;
Map<String, Object> maptab = null;
HrmFieldBean hrmFieldBean = null;
List<Map<String, Object>> columns = null;
List<Map<String, Object>> datas = null;
Map<String, Object> data = null;
result.put("tables", lsTable);
//标头信息--家庭信息
HrmFieldDetailComInfo HrmFieldDetailComInfo = new HrmFieldDetailComInfo();
LinkedHashMap<String, List<HrmFieldBean>> detialTable = HrmFieldDetailComInfo.getDetialTable("" + scopeId, viewAttr, "80%");
Iterator<Map.Entry<String, List<HrmFieldBean>>> entries = detialTable.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, List<HrmFieldBean>> entry = entries.next();
String tablename = entry.getKey();
titles = entry.getValue();
table = new HashMap<String, Object>();
columns = HrmFieldUtil.getHrmDetailTable(titles, null, user);
table.put("columns", columns);
datas = new ArrayList<Map<String, Object>>();
RecordSet rs = new RecordSet();
String sql = "select * from " + tablename + " where resourceid = " + id;
rs.executeSql(sql);
while (rs.next()) {
data = new HashMap<String, Object>();
for (HrmFieldBean fieldInfo : titles) {
if (!isAdd) {
data.put(fieldInfo.getFieldname(), TextUtil.toBase64ForMultilang(Util.null2String(rs.getString(fieldInfo.getFieldname()))));
}
}
datas.add(data);
}
table.put("datas", datas);
table.put("rownum", "rownum");
maptab = new Hashtable<String, Object>();
String tablabel = HrmResourceDetailTab.HrmResourceDetailTabInfo.get(tablename.toUpperCase());
maptab.put("tabname", SystemEnv.getHtmlLabelNames(tablabel, user.getLanguage()));
maptab.put("hide", (!hrmListValidate.isValidate(45) || (!isAdd && !canEdit && isSelf && viewAttr == 2)));
maptab.put("tabinfo", table);
lsTable.add(maptab);
}
//自定义信息
RecordSet RecordSet = new RecordSet();
CustomFieldTreeManager CustomFieldTreeManager = new CustomFieldTreeManager();
LinkedHashMap<String, String> ht = new LinkedHashMap<String, String>();
RecordSet.executeSql("select id, formlabel,viewtype from cus_treeform where parentid=" + scopeId + " order by scopeorder");
while (RecordSet.next()) {
if (RecordSet.getInt("viewtype") != 1) continue;
titles = new ArrayList<HrmFieldBean>();
int subId = RecordSet.getInt("id");
CustomFieldManager cfm2 = new CustomFieldManager("HrmCustomFieldByInfoType", subId);
cfm2.getCustomFields();
CustomFieldTreeManager.getMutiCustomData("HrmCustomFieldByInfoType", subId, Util.getIntValue(id, 0));
int colcount1 = 0;
int rowcount = 0;
int col = 0;
while (cfm2.next()) {
rowcount++;
if (!cfm2.isUse() || (!isAdd && viewAttr == 2 && !canEdit && isSelf && !cfm2.isModify())) continue;
col++;
}
if (rowcount == 0) continue;
cfm2.beforeFirst();
ht.put("cus_list_" + subId, RecordSet.getString("formlabel"));
cfm2.beforeFirst();
while (cfm2.next()) {
if (!cfm2.isUse() || (!isAdd && viewAttr == 2 && !canEdit && isSelf && !cfm2.isModify())) continue;
int tmpviewattr = viewAttr;
//创建表头
String fieldname = "customfield" + cfm2.getId() + "_" + subId;
if (isAdd) fieldname = "customfield_1_" + cfm2.getId() + "_" + subId;
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid("" + cfm2.getId());
hrmFieldBean.setFieldname(fieldname);
hrmFieldBean.setFieldlabel(cfm2.getLable());
hrmFieldBean.setFieldhtmltype(cfm2.getHtmlType());
hrmFieldBean.setType("" + cfm2.getType());
hrmFieldBean.setDmlurl(cfm2.getDmrUrl());
if (viewAttr == 2 && cfm2.isMand()) {
tmpviewattr = 3;
hrmFieldBean.setRules("required|string");
}
hrmFieldBean.setViewAttr(tmpviewattr);
hrmFieldBean.setWidth("80%");
titles.add(hrmFieldBean);
}
table = new HashMap<String, Object>();
if (col > 0) {
columns = HrmFieldUtil.getHrmDetailTable(titles, null, user);
table.put("columns", columns);
}
datas = new ArrayList<Map<String, Object>>();
cfm2.beforeFirst();
while (CustomFieldTreeManager.nextMutiData()) {
data = new HashMap<String, Object>();
while (cfm2.next()) {
// if(!cfm2.isUse()||(!isAdd&&viewAttr==2&&!canEdit&&isSelf&&!cfm2.isModify()))continue;
int fieldid = cfm2.getId(); //字段id
int type = cfm2.getType();
String dmlurl = cfm2.getDmrUrl();
int fieldhtmltype = Util.getIntValue(cfm2.getHtmlType());
String fieldname = "customfield" + cfm2.getId() + "_" + subId;
if (isAdd) fieldname = "customfield_1_" + cfm2.getId() + "_" + subId;
String fieldvalue = "";
if (!isAdd) {
fieldvalue = Util.null2String(CustomFieldTreeManager.getMutiData("field" + fieldid));
}
data.put(fieldname, fieldvalue);
if (cfm2.getHtmlType().equals("1") && cfm2.getType() == 1) {
data.put(fieldname, TextUtil.toBase64ForMultilang(Util.null2String(fieldvalue)));
} else if (cfm2.getHtmlType().equals("3")) {
String fieldshowname = hfm.getFieldvalue(user, dmlurl, fieldid, fieldhtmltype, type, fieldvalue, 0);
data.put(fieldname, fieldvalue);
data.put(fieldname + "span", fieldshowname);
} else if (cfm2.getHtmlType().equals("4")) {
data.put(fieldname, fieldvalue.equals("1"));
}
//只允许有权限的人删除明细行,没有权限的人只能修改不能删除
if (canEdit) {
data.put("viewAttr", 2);
} else {
data.put("viewAttr", 1);
}
}
cfm2.beforeFirst();
datas.add(data);
}
table.put("datas", datas);
table.put("rownum", "nodesnum_" + subId);
maptab = new Hashtable<String, Object>();
RecordSet rs = new RecordSet();
rs.executeSql("select id, formlabel from cus_treeform where parentid=" + scopeId + " and id=" + subId + " order by scopeorder");
if (rs.next()) {
maptab.put("tabname", rs.getString("id"));
maptab.put("tabname", rs.getString("formlabel"));
}
maptab.put("hide", col == 0);
maptab.put("tabinfo", table);
lsTable.add(maptab);
}
} catch (Exception e) {
new BaseBean().writeLog(e);
}
return result;
}
}

@ -17,4 +17,5 @@ import lombok.NoArgsConstructor;
public class FieldTransferParam {
private String id;
private String name;
private boolean check;
}

@ -18,16 +18,16 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@OrganizationTable(pageId = "c0583f20-f10c-11ec-9947-00e04c680716",
fields = "t.id," +
"t.last_name," +
"t.department_id," +
"t.company_id," +
"t.job_title," +
"t.lastname," +
"t.departmentid," +
"t.subcompanyid1," +
"t.jobtitle," +
"t.mobile," +
"t.telephone," +
"t.manager_id, " +
"t.show_order ",
fromSql = "FROM jcl_org_hrmresource t ",
orderby = " show_order ",
"t.managerid, " +
"t.dsporder ",
fromSql = "FROM hrmresource t ",
orderby = " dsporder ",
sortway = " asc",
primarykey = "id",
operates = {
@ -45,21 +45,21 @@ public class HrmResourceVO {
/**
*
*/
@OrganizationTableColumn(text = "姓名", width = "25%", column = "last_name")
@OrganizationTableColumn(text = "姓名", width = "25%", column = "lastname")
private String lastName;
/**
*
*/
@OrganizationTableColumn(text = "部门", width = "25%", column = "department_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getDepartmentName")
@OrganizationTableColumn(text = "部门", width = "25%", column = "departmentid", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getDepartmentName")
private String departmentName;
/**
*
*/
@OrganizationTableColumn(text = "分部", width = "25%", column = "company_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getCompanyName")
@OrganizationTableColumn(text = "分部", width = "25%", column = "subcompanyid1", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getCompanyName")
private String companyName;
@OrganizationTableColumn(text = "岗位", width = "25%", column = "job_title", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getJobName")
@OrganizationTableColumn(text = "岗位", width = "25%", column = "jobtitle", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getJobName")
private String jobName;
/**
@ -75,9 +75,9 @@ public class HrmResourceVO {
/**
*
*/
@OrganizationTableColumn(text = "直接上级", width = "25%", column = "manager_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getManagerName")
@OrganizationTableColumn(text = "直接上级", width = "25%", column = "managerid", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getManagerName")
private String managerName;
@OrganizationTableColumn(text = "显示顺序", width = "25%", column = "show_order", orderkey = "show_order")
@OrganizationTableColumn(text = "显示顺序", width = "25%", column = "dsporder", orderkey = "dsporder")
private Integer showOrder;
}

@ -31,17 +31,10 @@ public class UserCard {
private String status;
public String getAccountType() {
if (StringUtils.isBlank(accountType)) {
return "";
}
switch (accountType) {
case "0":
return "主账号";
case "1":
if ("1".equals(accountType)) {
return "次账号";
default:
return "";
}
return "主账号";
}
public String getStatus() {

@ -0,0 +1,24 @@
package com.engine.organization.entity.personnelcard.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2022/12/05
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CusTreeFormPO {
private String scope;
private String formLabel;
private Integer id;
private Integer parentId;
private String viewType;
private Integer scopeOrder;
}

@ -0,0 +1,24 @@
package com.engine.organization.entity.personnelcard.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2022/12/05
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class HrmFieldGroupPO {
private Integer id;
private Integer groupLabel;
private Integer groupOrder;
private Integer groupType;
private Integer isShow;
private String labelName;
}

@ -2,6 +2,7 @@ package com.engine.organization.mapper.personnelcard;
import com.engine.organization.entity.personnelcard.ResourceBaseTab;
import com.engine.organization.entity.personnelcard.UserCard;
import com.engine.organization.entity.personnelcard.po.CusTreeFormPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -22,7 +23,16 @@ public interface PersonnelCardMapper {
/**
*
*
* @return
*/
List<ResourceBaseTab> getResourceBaseTabList();
/**
*
*
* @return
*/
List<CusTreeFormPO> getCusTreeForms(@Param("parentId") Integer parentId);
}

@ -3,8 +3,8 @@
<mapper namespace="com.engine.organization.mapper.personnelcard.PersonnelCardMapper">
<resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.UserCard">
<result column="id" property="id"/>
<result column="resource_image_id" property="image"/>
<result column="last_name" property="name"/>
<result column="resourceimageid" property="image"/>
<result column="lastname" property="name"/>
<result column="sex" property="sex"/>
<result column="email" property="email"/>
<result column="mobile" property="phone"/>
@ -25,17 +25,26 @@
<result column="tabnum" property="tabNum"/>
</resultMap>
<resultMap id="CusTreeFormMap" type="com.engine.organization.entity.personnelcard.po.CusTreeFormPO">
<result column="scope" property="scope"/>
<result column="formLabel" property="formLabel"/>
<result column="id" property="id"/>
<result column="parentId" property="parentId"/>
<result column="viewType" property="viewType"/>
<result column="scopeOrder" property="scopeOrder"/>
</resultMap>
<select id="getUserById" resultMap="UserMap">
select id,
resource_image_id,
last_name,
resourceimageid,
lastname,
sex,
email,
mobile,
account_type,
accounttype,
status
from jcl_org_hrmresource
from hrmresource
where id = #{id}
</select>
@ -45,4 +54,12 @@
where isopen = 1
order by dsporder
</select>
<select id="getCusTreeForms" resultMap="CusTreeFormMap">
select *
from cus_treeform
where parentid = #{parentId}
<if test="null!=parentId and parentId !=0">
and viewtype = 1
</if>
</select>
</mapper>

@ -2,46 +2,35 @@ package com.engine.organization.service.impl;
import com.engine.common.service.HrmCommonService;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.bo.ExtendGroupBO;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.personnelcard.*;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import com.engine.organization.entity.personnelcard.po.CardButtonPO;
import com.engine.organization.entity.personnelcard.po.CusTreeFormPO;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.personnelcard.CardAccessMapper;
import com.engine.organization.mapper.personnelcard.CardButtonMapper;
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.service.HrmPersonnelCardService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.field.FieldDefinedValueUtil;
import com.engine.portal.biz.constants.ModuleConstants;
import com.engine.portal.biz.nonstandardfunction.SysModuleInfoBiz;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import weaver.blog.BlogShareManager;
import weaver.cowork.CoworkShareManager;
import weaver.crm.CrmShareBase;
import weaver.docs.search.DocSearchComInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.definedfield.HrmFieldManager;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.search.WorkflowRequestUtil;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author:dxfeng
@ -49,32 +38,11 @@ import java.util.stream.Collectors;
* @version: 1.0
*/
public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnelCardService {
private static final String IS_SHOW = "1";
private PersonnelCardMapper getPersonnelCardMapper() {
return MapperProxyFactory.getProxy(PersonnelCardMapper.class);
}
private ExtendGroupMapper getExtendGroupMapper() {
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
}
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
private ExtMapper getExtMapper() {
return MapperProxyFactory.getProxy(ExtMapper.class);
}
private ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
private CardButtonMapper getCardButtonMapper() {
return MapperProxyFactory.getProxy(CardButtonMapper.class);
}
@ -85,35 +53,39 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
Map<String, Object> resultMap = new HashMap<>();
UserCard userInfo;
if (null == uId) {
uId = getResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
uId = (long) user.getUID();
}
String ecResourceId = getResourceMapper().getEcResourceId(uId.toString());
userInfo = getPersonnelCardMapper().getUserById(uId);
userInfo.setEcId(ecResourceId);
userInfo.setEcId(uId.toString());
OrganizationAssert.notNull(uId, "未找到对应数据");
// 人员基本信息
// 统计报表
Statistical statistical = getStatistical(ecResourceId);
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listByType(4, IS_SHOW);
// 过滤卡片权限
extendGroupList.removeIf(item -> !hasGroupAccess(item.getId().intValue(), ecResourceId));
Statistical statistical = getStatistical(userInfo.getEcId());
// 获取所有模块的信息
// 获取类型分组信息
List<CusTreeFormPO> cusTreeForms = getPersonnelCardMapper().getCusTreeForms(0);
// TODO 权限过滤
//cusTreeForms.removeIf(item -> !hasGroupAccess(item.getId(), userInfo.getEcId()));
List<FormItem> formItemList = new ArrayList<>();
for (ExtendGroupPO groupPO : extendGroupList) {
FormItem formItem = getFormItem(groupPO, uId);
try {
for (CusTreeFormPO cusTreeForm : cusTreeForms) {
FormItem formItem = getFormItem(cusTreeForm, uId);
if (CollectionUtils.isEmpty(formItem.getItems())) {
continue;
}
// 处理明细表数据
List<Map<String, Object>> detailList = ServiceUtil.getService(ExtServiceImpl.class, user).getExtendTables(user, "4", groupPO.getId(), "JCL_ORG_HRMRESOURCEEXT_DT1", uId, 1, false);
formItem.setTables(detailList);
formItemList.add(formItem);
//TODO 明细表暂不处理
//List<Map<String, Object>> detailList = ServiceUtil.getService(ExtServiceImpl.class, user).getExtendTables(user, "4", groupPO.getId(), "JCL_ORG_HRMRESOURCEEXT_DT1", uId, 1, false);
//formItem.setTables(detailList);
formItemList.add(formItem);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
// 所有锚点
List<Anchor> anchorList = new ArrayList<>();
// 添加字段分组信息
@ -125,7 +97,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
anchorList.add(Anchor.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).build());
}
resultMap.put("buttons", getButtonList(ecResourceId));
resultMap.put("buttons", getButtonList(userInfo.getEcId()));
resultMap.put("user", userInfo);
resultMap.put("statistical", statistical);
resultMap.put("formItems", formItemList);
@ -191,33 +163,29 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
}
}
private FormItem getFormItem(ExtendGroupPO extendGroup, Long uId) {
/**
*
*
* @param cusTreeFormPO
* @param uId
* @return
* @throws Exception
*/
private FormItem getFormItem(CusTreeFormPO cusTreeFormPO, Long uId) throws Exception {
FormItem formItem = new FormItem();
formItem.setId("group" + extendGroup.getId());
formItem.setTitle(extendGroup.getGroupName());
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(extendGroup.getId(), IS_SHOW);
formItem.setId(cusTreeFormPO.getId().toString());
formItem.setTitle(cusTreeFormPO.getFormLabel());
List<Item> itemList = new ArrayList<>();
for (ExtendTitlePO extendTitlePO : extendTitleList) {
List<ExtendInfoPO> extendInfoList = getExtendInfoMapper().listFields(extendGroup.getExtendType().toString(), extendTitlePO.getId().toString(), ExtendGroupBO.getTableNameByGroupPO(extendGroup), ExtendInfoOperateType.LIST.getValue(), IS_SHOW);
String fields = extendInfoList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
if (StringUtils.isBlank(fields)) {
continue;
}
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(ExtendGroupBO.getTableNameByGroupPO(extendGroup)).fields(fields).params(null).id(uId).build();
Map<String, Object> fieldValueMap = getExtMapper().listExt(infoParams);
for (ExtendInfoPO extendInfoPO : extendInfoList) {
String fieldShowName = "";
if (null != fieldValueMap) {
Object fieldValue;
if (DBType.isOracle()) {
fieldValue = fieldValueMap.get(extendInfoPO.getFieldName().toUpperCase());
} else {
fieldValue = fieldValueMap.get(extendInfoPO.getFieldName());
}
fieldShowName = FieldDefinedValueUtil.getFieldValue(user, extendInfoPO, Util.null2String(fieldValue));
}
itemList.add(Item.builder().fieldId(extendInfoPO.getFieldNameDesc()).fieldValue(fieldShowName).build());
}
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", cusTreeFormPO.getId());
hfm.getHrmData(uId.intValue());
hfm.getCustomFields();
while (hfm.next()) {
String fieldName = hfm.getFieldname();
JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
String fieldLabel = Util.toScreen(SystemEnv.getHtmlLabelName(hrmFieldConf.getInt("fieldlabel"), user.getLanguage()), user.getLanguage());
String hrmData = hfm.getHrmData(fieldName);
String fieldValue = hfm.getFieldvalue(null, user, null, null, hrmFieldConf.getInt("id"), hrmFieldConf.getInt("fieldhtmltype"), hrmFieldConf.getInt("type"), hrmData, 0, fieldName);
itemList.add(Item.builder().fieldId(fieldLabel).fieldValue(fieldValue).build());
}
formItem.setItems(itemList);
return formItem;

@ -0,0 +1,21 @@
package com.engine.organization.util.saveimport;
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
import java.util.LinkedHashSet;
/**
* @author:dxfeng
* @createTime: 2022/12/01
* @version: 1.0
*/
public class CompanyImport {
LinkedHashSet<FieldTransferParam> columns;
static {
}
// 自定义选择字段
}
Loading…
Cancel
Save