commit
3036fb425d
|
|
@ -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{
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ public class DepartmentBO {
|
|||
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
|
||||
.forbiddenTag(e.getForbiddenTag())
|
||||
.build() ).collect(Collectors.toList());
|
||||
.build()).collect(Collectors.toList());
|
||||
Map<Long, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept));
|
||||
// 处理被引用数据
|
||||
List<String> usedIds = MapperProxyFactory.getProxy(DepartmentMapper.class).listUsedId();
|
||||
|
|
@ -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());
|
||||
//获取非一级部门
|
||||
|
|
@ -118,13 +118,17 @@ public class DepartmentBO {
|
|||
return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getParentComp())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Set<DepartmentPO> departmentPOS) {
|
||||
return buildSetToSearchTree(departmentPOS, true);
|
||||
}
|
||||
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Set<DepartmentPO> departmentPOS, boolean isLeaf) {
|
||||
return departmentPOS.stream().map(item -> {
|
||||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(false);
|
||||
tree.setIcon("icon-coms-Branch");
|
||||
tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
|
|
@ -138,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;
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.engine.organization.entity.job.dto.JobListDTO;
|
|||
import com.engine.organization.entity.job.param.JobSearchParam;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.transmethod.JobTransMethod;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
|
@ -142,4 +143,22 @@ public class JobBO {
|
|||
}
|
||||
}
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Set<JobPO> builderJobs) {
|
||||
return builderJobs.stream().map(item -> {
|
||||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(false);
|
||||
tree.setIcon("icon-coms-Branch");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
tree.setName(item.getJobName());
|
||||
tree.setPid(null == item.getParentJob() ? "0" : item.getParentJob().toString());
|
||||
tree.setSelected(false);
|
||||
tree.setType("3");
|
||||
tree.setParentComp(null == item.getParentDept() ? "0" : item.getParentDept().toString());
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public interface DepartmentMapper {
|
|||
*/
|
||||
List<Map<String, Object>> listDeptsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
List<DepartmentPO> getDeptsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
*
|
||||
|
|
@ -66,7 +68,7 @@ public interface DepartmentMapper {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getDeptNameById(@Param("id") int id);
|
||||
String getDeptNameById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
|
|
|
|||
|
|
@ -125,6 +125,16 @@
|
|||
from JCL_ORG_STAFF
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="getDeptsByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
|
||||
keyProperty="id"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,13 @@ public interface JobMapper {
|
|||
*/
|
||||
List<JobListDTO> listNoFilter();
|
||||
|
||||
/**
|
||||
* 根据搜索条件查询数据
|
||||
* @param jobPO
|
||||
* @return
|
||||
*/
|
||||
List<JobPO> listPOsByFilter(JobPO jobPO);
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -295,6 +295,31 @@
|
|||
from jcl_org_job t
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="listPOsByFilter" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
FROM jcl_org_job t
|
||||
WHERE t.delete_type = 0
|
||||
<include refid="likeSQL"/>
|
||||
<if test=" parentComp != null ">
|
||||
and t.parent_comp = #{parentComp}
|
||||
</if>
|
||||
<if test=" parentDept != null ">
|
||||
and t.parent_dept = #{parentDept}
|
||||
</if>
|
||||
<if test=" sequenceId != null ">
|
||||
and t.sequence_id = #{sequenceId}
|
||||
</if>
|
||||
<if test=" schemeId != null ">
|
||||
and t.scheme_id = #{schemeId}
|
||||
</if>
|
||||
<if test=" isKey != null ">
|
||||
and t.is_key = #{isKey}
|
||||
</if>
|
||||
<if test=" forbiddenTag != null ">
|
||||
and t.forbidden_tag = #{forbiddenTag}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="likeSQL">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface HrmResourceService {
|
||||
|
||||
/**
|
||||
* 列表左侧树
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
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,23 +188,26 @@ 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);
|
||||
}
|
||||
|
||||
if (null != id) {
|
||||
// 判断更新还是插入
|
||||
int count = getExtMapper().countExtById(tableName, id);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,278 @@
|
|||
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;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
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;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class HrmResourceServiceImpl extends Service implements HrmResourceService {
|
||||
/**
|
||||
* 左侧树 类型表示
|
||||
* <p>
|
||||
* 0:集团
|
||||
* 1:分部
|
||||
* 2:部门
|
||||
* 3:岗位
|
||||
*/
|
||||
private static final String TYPE_COMP = "1";
|
||||
private static final String TYPE_DEPT = "2";
|
||||
private static final String TYPE_JOB = "3";
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
||||
String keyword = params.getKeyword();
|
||||
String id = params.getId();
|
||||
String type = Util.null2String(params.getType());
|
||||
List<SearchTree> treeList = getFilterCompany(id, type, keyword);
|
||||
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<>();
|
||||
// 通过分部、公司 组装数据
|
||||
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
|
||||
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build();
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build();
|
||||
// 所属分部下的岗位
|
||||
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build();
|
||||
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
|
||||
} else if (TYPE_DEPT.equals(type)) {
|
||||
Long parentDeptId = Long.parseLong(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentDept(parentDeptId).build();
|
||||
// 所属分部下的岗位
|
||||
JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build();
|
||||
searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild);
|
||||
|
||||
} else if (TYPE_JOB.equals(type)) {
|
||||
// 查询部门信息
|
||||
List<JobPO> filterDeparts = getJobMapper().listPOsByFilter(JobPO.builder().jobName(keyword).parentJob(Long.parseLong(id)).build());
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
for (JobPO departmentPO : filterDeparts) {
|
||||
buildParentJobs(departmentPO, builderJobs);
|
||||
}
|
||||
searchTree = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs));
|
||||
}
|
||||
return searchTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分部、部门 组装左侧树
|
||||
*
|
||||
* @param departmentBuild
|
||||
* @param compBuild
|
||||
* @param jobBuild
|
||||
* @return
|
||||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild);
|
||||
// 添加父级岗位
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
buildParentJobs(jobPO, builderJobs);
|
||||
}
|
||||
// 添加岗位的上级部门或分部
|
||||
List<SearchTree> jobTrees = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs));
|
||||
String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentDeptS)) {
|
||||
List<DepartmentPO> compsByIds = getDepartmentMapper().getDeptsByIds(DeleteParam.builder().ids(parentDeptS).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
||||
filterDeparts.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts, false));
|
||||
// 添加部门的上级分部
|
||||
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentCompS)) {
|
||||
List<CompPO> compsByIds = getCompMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
||||
filterComps.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps);
|
||||
}
|
||||
List<SearchTree> searchTrees = SearchTreeUtil.builderTreeMode(deptTrees, jobTrees);
|
||||
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
|
||||
}
|
||||
|
||||
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild);
|
||||
// 添加父级岗位
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
buildParentJobs(jobPO, builderJobs);
|
||||
}
|
||||
// 添加岗位的上级部门或分部
|
||||
List<SearchTree> jobTrees = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs));
|
||||
String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentDeptS)) {
|
||||
List<DepartmentPO> compsByIds = getDepartmentMapper().getDeptsByIds(DeleteParam.builder().ids(parentDeptS).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
||||
filterDeparts.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询分部信息
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts, false), jobTrees);
|
||||
}
|
||||
|
||||
private void buildParentJobs(JobPO jobPO, Set<JobPO> builderJobs) {
|
||||
builderJobs.add(jobPO);
|
||||
if (SearchTreeUtil.isTop(jobPO.getParentJob())) {
|
||||
return;
|
||||
}
|
||||
JobPO parentJob = getJobMapper().getJobById(jobPO.getParentJob());
|
||||
if (null != parentJob) {
|
||||
buildParentJobs(parentJob, builderJobs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加查询元素的父级元素
|
||||
*
|
||||
* @param departmentPO
|
||||
* @param builderDeparts
|
||||
*/
|
||||
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
|
||||
builderDeparts.add(departmentPO);
|
||||
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) {
|
||||
return;
|
||||
}
|
||||
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept());
|
||||
if (null != parentDept) {
|
||||
buildParentDepts(parentDept, builderDeparts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加查询元素的父级元素
|
||||
*
|
||||
* @param compPO
|
||||
* @param builderComps
|
||||
*/
|
||||
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps) {
|
||||
builderComps.add(compPO);
|
||||
if (SearchTreeUtil.isTop(compPO.getParentCompany())) {
|
||||
return;
|
||||
}
|
||||
CompPO parentComp = getCompMapper().listById(compPO.getParentCompany());
|
||||
if (null != parentComp) {
|
||||
buildParentComps(parentComp, builderComps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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