人员管理:左侧树、列表接口
This commit is contained in:
parent
fe0417618c
commit
187be45bdf
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.organization.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/bs/hrmorganization/hrmresource")
|
||||
public class HrmResourceController extends com.engine.organization.web.HrmResourceController{
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ public class DepartmentBO {
|
|||
.deptName(e.getDeptName())
|
||||
.parentComp(e.getParentComp())
|
||||
.parentDept(e.getParentDept())
|
||||
.parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept().intValue()))
|
||||
.parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept()))
|
||||
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.build()).collect(Collectors.toList());
|
||||
//获取非一级部门
|
||||
|
|
@ -142,7 +142,7 @@ public class DepartmentBO {
|
|||
}
|
||||
|
||||
|
||||
public static String getDeptNameById(Integer id) {
|
||||
public static String getDeptNameById(Long id) {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.organization.entity.extend.bo;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.bean.BrowserValueInfo;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
|
|
@ -106,7 +108,7 @@ public class ExtendInfoBO {
|
|||
.editShow("0".equals(infoFieldParam.getIsModify()) ? 0 : 1)
|
||||
.addShow(1)
|
||||
.browserShow(1)
|
||||
.customValue(infoFieldParam.getFieldType().toString())
|
||||
.customValue(convertSelectCustom(controlType, infoFieldParam.getFieldType().toString()))
|
||||
.showOrder(showOrder)
|
||||
// 非系统初始化字段
|
||||
.isSystemDefault(1)
|
||||
|
|
@ -116,6 +118,31 @@ public class ExtendInfoBO {
|
|||
.build();
|
||||
}
|
||||
|
||||
private static String convertSelectCustom(String controlType, String fieldType) {
|
||||
if (!"5".equals(controlType)) {
|
||||
return fieldType;
|
||||
}
|
||||
JSONArray objects = JSONObject.parseArray(fieldType);
|
||||
if (objects.size() < 3) {
|
||||
return objects.toString();
|
||||
}
|
||||
JSONObject o = (JSONObject) objects.get(2);
|
||||
JSONArray datas = o.getJSONArray("datas");
|
||||
if (!datas.isEmpty()) {
|
||||
int size = datas.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
JSONObject jsonObject = (JSONObject) datas.get(i);
|
||||
if (StringUtils.isBlank(jsonObject.getString("id"))) {
|
||||
jsonObject.put("id", i + "");
|
||||
}
|
||||
if (StringUtils.isBlank(jsonObject.getString("key"))) {
|
||||
jsonObject.put("key", i + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return objects.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前自定义字段是否已使用
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
|
|
@ -110,21 +109,4 @@ public class ExtendInfoFieldParam {
|
|||
}
|
||||
return fp.getFielddbtype();
|
||||
}
|
||||
|
||||
public static String toDbc(String input) {
|
||||
if (StringUtils.isBlank(input)) {
|
||||
return "";
|
||||
}
|
||||
char[] c = input.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == 12288) {
|
||||
c[i] = (char) 32;
|
||||
continue;
|
||||
}
|
||||
if (c[i] > 65280 && c[i] < 65375) {
|
||||
c[i] = (char) (c[i] - 65248);
|
||||
}
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.engine.organization.entity.hrmresource.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HrmResourceSearchParam {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String lastName;
|
||||
|
||||
/**
|
||||
* 直接上级
|
||||
*/
|
||||
private Long managerId;
|
||||
|
||||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 移动电话
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 办公电话
|
||||
*/
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* 其他电话
|
||||
*/
|
||||
private String mobileCall;
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
private Long jobTitle;
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
package com.engine.organization.entity.hrmresource.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HrmResourcePO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String workCode;
|
||||
|
||||
/**
|
||||
* 登录名
|
||||
*/
|
||||
private String loginId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String lastName;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 账号类型
|
||||
*/
|
||||
private Integer accountType;
|
||||
|
||||
/**
|
||||
* 主账号
|
||||
*/
|
||||
private Long belongTo;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 职务
|
||||
*/
|
||||
private Long jobActivity;
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
private Long jobTitle;
|
||||
|
||||
/**
|
||||
* 职称
|
||||
*/
|
||||
private Long jobCall;
|
||||
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
private Long jobLevel;
|
||||
|
||||
/**
|
||||
* 职务类别
|
||||
*/
|
||||
private Long jobGroupId;
|
||||
|
||||
/**
|
||||
* 职责描述
|
||||
*/
|
||||
private String jobActivityDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 系统语言
|
||||
*/
|
||||
private Integer systemLanguage;
|
||||
|
||||
/**
|
||||
* 照片
|
||||
*/
|
||||
private String resourceImageId;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String messagerUrl;
|
||||
|
||||
/**
|
||||
* 办公地点
|
||||
*/
|
||||
private Integer locationId;
|
||||
|
||||
/**
|
||||
* 直接上级
|
||||
*/
|
||||
private Long managerId;
|
||||
|
||||
/**
|
||||
* 助理
|
||||
*/
|
||||
private Long assistantId;
|
||||
|
||||
/**
|
||||
* 移动电话
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 办公室电话
|
||||
*/
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* 其他电话
|
||||
*/
|
||||
private String mobileCall;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String fax;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 办公室
|
||||
*/
|
||||
private String workroom;
|
||||
|
||||
private Long creator;
|
||||
private int deleteType;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.engine.organization.entity.hrmresource.vo;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.organization.annotation.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "c0583f20-f10c-11ec-9947-00e04c680716",
|
||||
fields = "t.id," +
|
||||
"t.last_name," +
|
||||
"t.department_id," +
|
||||
"t.company_id," +
|
||||
"t.mobile," +
|
||||
"t.telephone," +
|
||||
"t.manager_id,",
|
||||
fromSql = "FROM jcl_org_hrmresource t ",
|
||||
orderby = "id desc",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(index = "0", text = "发消息"),
|
||||
@OrganizationTableOperate(index = "1", text = "发送邮件"),
|
||||
@OrganizationTableOperate(index = "1", text = "发送短信"),
|
||||
@OrganizationTableOperate(index = "1", text = "新建日程"),
|
||||
@OrganizationTableOperate(index = "1", text = "系统信息"),
|
||||
},
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
public class HrmResourceVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@OrganizationTableColumn(text = "姓名", width = "25%", column = "last_name")
|
||||
private String lastName;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
@OrganizationTableColumn(text = "部门", width = "25%", column = "department_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getDepartmentName")
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 分部
|
||||
*/
|
||||
@OrganizationTableColumn(text = "分部", width = "25%", column = "company_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getCompanyName")
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 移动电话
|
||||
*/
|
||||
@OrganizationTableColumn(text = "移动电话", width = "25%", column = "mobile")
|
||||
private String mobile;
|
||||
/**
|
||||
* 办公室电话
|
||||
*/
|
||||
@OrganizationTableColumn(text = "办公室电话", width = "25%", column = "telephone")
|
||||
private String telephone;
|
||||
/**
|
||||
* 直接上级
|
||||
*/
|
||||
@OrganizationTableColumn(text = "直接上级", width = "25%", column = "manager_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getManagerName")
|
||||
private String managerName;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public interface DepartmentMapper {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getDeptNameById(@Param("id") int id);
|
||||
String getDeptNameById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -17,5 +18,13 @@ public interface HrmResourceService {
|
|||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getSearchTree(SearchTreeParams params);
|
||||
Map<String, Object> getSearchTree(SearchTreeParams params);
|
||||
|
||||
/**
|
||||
* 人员列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> listPage(HrmResourceSearchParam params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
deptBrowserItem.setRules("required|string");
|
||||
SearchConditionItem mergeNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "合并后名称", "mergeName");
|
||||
mergeNameItem.setRules("required|string");
|
||||
String departmentName = getDepartmentMapper().getDeptNameById(id.intValue());
|
||||
String departmentName = getDepartmentMapper().getDeptNameById(id);
|
||||
mergeNameItem.setValue(departmentName);
|
||||
|
||||
condition.add(deptBrowserItem);
|
||||
|
|
|
|||
|
|
@ -188,24 +188,25 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|||
int updateBaseComp;
|
||||
List<ExtendInfoPO> extInfoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName, ExtendInfoOperateType.EDIT.getValue());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (ExtendInfoPO extendInfoPO : extInfoPOList) {
|
||||
String key = extendInfoPO.getFieldName();
|
||||
Object value = params.get(extendInfoPO.getFieldName());
|
||||
// 遍历Map
|
||||
Map<String, ExtendInfoPO> collect = extInfoPOList.stream().collect(Collectors.toMap(ExtendInfoPO::getFieldName, item -> item));
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (null != value && StringUtils.isBlank(value.toString())) {
|
||||
value = null;
|
||||
}
|
||||
if (null == value) {
|
||||
if ("int".equals(extendInfoPO.getFieldType())) {
|
||||
if ("int".equals(collect.get(key).getFieldType())) {
|
||||
value = null;
|
||||
}
|
||||
// 兼容sqlServer数据库text字段类型
|
||||
if ("text".equals(extendInfoPO.getFieldType())) {
|
||||
if ("text".equals(collect.get(key).getFieldType())) {
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
map.put(key, value);
|
||||
}
|
||||
// 遍历Map
|
||||
|
||||
if (null != id) {
|
||||
// 判断更新还是插入
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import com.engine.organization.entity.job.bo.JobBO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
|
|
@ -14,9 +18,12 @@ import com.engine.organization.mapper.comp.CompMapper;
|
|||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.HrmResourceService;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.tree.SearchTreeUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
|
|
@ -62,6 +69,64 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return SearchTreeUtil.getSearchTree(type, treeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(HrmResourceSearchParam params) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class);
|
||||
String sqlWhere = buildSqlWhere(params);
|
||||
table.setSqlwhere(sqlWhere);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
resultMap.putAll(result.getResultMap());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String buildSqlWhere(HrmResourceSearchParam params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where t.delete_type ='0' ";
|
||||
String lastName = params.getLastName();
|
||||
if (StringUtils.isNotBlank(lastName)) {
|
||||
sqlWhere += " AND t.last_name " + dbType.like(lastName);
|
||||
}
|
||||
Long managerId = params.getManagerId();
|
||||
if (null != managerId) {
|
||||
sqlWhere += " AND t.manager_id = '" + managerId + "'";
|
||||
}
|
||||
Long companyId = params.getCompanyId();
|
||||
if (null != companyId) {
|
||||
sqlWhere += " AND t.company_id = '" + companyId + "'";
|
||||
}
|
||||
Long departmentId = params.getDepartmentId();
|
||||
if (null != departmentId) {
|
||||
sqlWhere += " AND t.department_id = '" + departmentId + "'";
|
||||
}
|
||||
String telephone = params.getTelephone();
|
||||
if (StringUtils.isNotBlank(telephone)) {
|
||||
sqlWhere += " AND t.telephone " + dbType.like(telephone);
|
||||
}
|
||||
String mobile = params.getMobile();
|
||||
if (StringUtils.isNotBlank(mobile)) {
|
||||
sqlWhere += " AND t.mobile " + dbType.like(mobile);
|
||||
}
|
||||
String mobileCall = params.getMobileCall();
|
||||
if (StringUtils.isNotBlank(mobileCall)) {
|
||||
sqlWhere += " AND t.mobile_call " + dbType.like(mobileCall);
|
||||
}
|
||||
Long jobTitle = params.getJobTitle();
|
||||
if (null != jobTitle) {
|
||||
sqlWhere += " AND t.job_title = '" + jobTitle + "'";
|
||||
}
|
||||
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
public List<SearchTree> getFilterCompany(String id, String type, String keyword) {
|
||||
List<SearchTree> searchTree = new ArrayList<>();
|
||||
// 通过分部、公司 组装数据
|
||||
|
|
@ -123,7 +188,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts,false));
|
||||
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts, false));
|
||||
// 添加部门的上级分部
|
||||
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentCompS)) {
|
||||
|
|
@ -163,7 +228,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts,false), jobTrees);
|
||||
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts, false), jobTrees);
|
||||
}
|
||||
|
||||
private void buildParentJobs(JobPO jobPO, Set<JobPO> builderJobs) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class HrmResourceTransMethod {
|
||||
|
||||
public static String getDepartmentName(String departmentId) {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Long.parseLong(departmentId));
|
||||
}
|
||||
|
||||
public static String getCompanyName(String companyId) {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class).listById(Long.parseLong(companyId)).getCompName();
|
||||
}
|
||||
|
||||
public static String getManagerName(String managerId) {
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.parseLong(managerId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.engine.organization.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.HrmResourceWrapper;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class HrmResourceController {
|
||||
public HrmResourceWrapper getHrmResourceWrapper(User user) {
|
||||
return ServiceUtil.getService(HrmResourceWrapper.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 左侧树接口
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSearchTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Map<String, Object> getSearchTree(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
SearchTreeParams params = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), SearchTreeParams.class);
|
||||
return getHrmResourceWrapper(user).getSearchTree(params);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取list列表
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/listPage")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
HrmResourceSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), HrmResourceSearchParam.class);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).listPage(param));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.service.HrmResourceService;
|
||||
import com.engine.organization.service.impl.HrmResourceServiceImpl;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class HrmResourceWrapper extends Service {
|
||||
private HrmResourceService getHrmResourceService(User user) {
|
||||
return ServiceUtil.getService(HrmResourceServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
||||
return getHrmResourceService(user).getSearchTree(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> listPage(HrmResourceSearchParam params) {
|
||||
return getHrmResourceService(user).listPage(params);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue