独立项目分支。由dev分支回退、BUG修复
This commit is contained in:
parent
47b8f651a9
commit
5715a02a47
|
|
@ -19,15 +19,12 @@ import com.engine.organization.mapper.department.DepartmentMapper;
|
|||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.tree.SearchTreeUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -127,11 +124,6 @@ public class JobBrowserService extends BrowserService {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 分权
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
sqlWhere += " AND t.parent_comp in (" + detachUtil.getJclRoleLevels() + ")";
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
|
|
@ -143,59 +135,26 @@ public class JobBrowserService extends BrowserService {
|
|||
*/
|
||||
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
|
||||
// 分权
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
List<Long> jclRoleLevelList;
|
||||
if (StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) {
|
||||
jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
}else{
|
||||
jclRoleLevelList = new ArrayList<>();
|
||||
}
|
||||
List<TreeNode> treeNodes = new ArrayList<>();
|
||||
if (StringUtils.isBlank(params.getId())) {
|
||||
// 集团总部
|
||||
SearchTree topGroup = SearchTreeUtil.getTopGroup();
|
||||
if(detachUtil.isDETACH()&& StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) {
|
||||
topGroup.setIsParent(true);
|
||||
}else{
|
||||
topGroup.setIsParent(false);
|
||||
}
|
||||
topGroup.setIsParent(true);
|
||||
treeNodes.add(topGroup);
|
||||
} else {
|
||||
// 分部存在下级的ID
|
||||
List<String> compHasSubs;
|
||||
if (detachUtil.isDETACH()) {
|
||||
if(CollectionUtils.isNotEmpty(jclRoleLevelList)) {
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
|
||||
}else{
|
||||
compHasSubs = new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
|
||||
}
|
||||
List<String> compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
|
||||
// 部门存在下级的ID
|
||||
List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs();
|
||||
|
||||
if ("0".equals(params.getId())) {
|
||||
List<CompPO> compList;
|
||||
if (detachUtil.isDETACH()) {
|
||||
if(CollectionUtils.isNotEmpty(jclRoleLevelList)) {
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
|
||||
detachUtil.filterCompanyList(compList);
|
||||
}else{
|
||||
compList = new ArrayList<>();
|
||||
}
|
||||
}else{
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
|
||||
}
|
||||
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
|
||||
// 获取顶层分部
|
||||
compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
} else if ("1".equals(params.getType())) {
|
||||
// 当前节点下的元素
|
||||
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order");
|
||||
if (detachUtil.isDETACH()) {
|
||||
detachUtil.filterCompanyList(compList);
|
||||
}
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
|
||||
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
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{
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.api.organization.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Path("/bs/hrmorganization/detach")
|
||||
public class ManagerDetachController extends com.engine.organization.web.ManagerDetachController {
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.api.organization.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/bs/hrmorganization/personnelcard")
|
||||
public class PersonnelCardController extends com.engine.organization.web.PersonnelCardController {
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.engine.organization.entity.cusfielddata.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CusFieldData {
|
||||
private Integer seqOrder;
|
||||
private String scope;
|
||||
private Long scopeId;
|
||||
private Long id;
|
||||
/**
|
||||
* 职等职级字段,内容其实是职等树
|
||||
*/
|
||||
private String field100001;
|
||||
/**
|
||||
* 担任岗位,内容其实是树id
|
||||
*/
|
||||
private String field100002;
|
||||
/**
|
||||
* 职务,内容是树id
|
||||
*/
|
||||
private String field100003;
|
||||
/**
|
||||
* 虚线上级
|
||||
*/
|
||||
private String field100004;
|
||||
/**
|
||||
* 岗位序列
|
||||
*/
|
||||
private String field100005;
|
||||
/**
|
||||
* 职等职级方案
|
||||
*/
|
||||
private String field100006;
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
private String field100007;
|
||||
/**
|
||||
* 职等
|
||||
*/
|
||||
private String field100008;
|
||||
/**
|
||||
* 职务类型
|
||||
*/
|
||||
private String field100009;
|
||||
/**
|
||||
* 职务信息
|
||||
*/
|
||||
private String field100010;
|
||||
private String field100011;
|
||||
private String field100012;
|
||||
private String field100013;
|
||||
private String field100014;
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "80e7830c-18e8-4e14-8241-18821195ef31",
|
||||
fields = "t.id," +
|
||||
"t.last_name," +
|
||||
"t.lastname," +
|
||||
"t.mobile," +
|
||||
"t.company_start_date," +
|
||||
"t.companystartdate," +
|
||||
"t.sex",
|
||||
fromSql = "FROM jcl_org_hrmresource t ",
|
||||
fromSql = "FROM hrmresource t ",
|
||||
orderby = "id",
|
||||
primarykey = "id",
|
||||
tableType = WeaTableType.NONE
|
||||
|
|
@ -35,7 +35,7 @@ public class EmployeeTableVO {
|
|||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
@OrganizationTableColumn(text = "姓名", width = "25%", column = "last_name")
|
||||
@OrganizationTableColumn(text = "姓名", width = "25%", column = "lastname")
|
||||
private String lastname;
|
||||
|
||||
@OrganizationTableColumn(text = "性别", width = "25%", column = "sex",transmethod = "com.engine.organization.transmethod.JobTransMethod.getSexName")
|
||||
|
|
@ -44,7 +44,7 @@ public class EmployeeTableVO {
|
|||
@OrganizationTableColumn(text = "手机", width = "25%", column = "mobile")
|
||||
private String mobile;
|
||||
|
||||
@OrganizationTableColumn(text = "入职日期", width = "25%", column = "company_start_date")
|
||||
@OrganizationTableColumn(text = "入职日期", width = "25%", column = "companystartdate")
|
||||
private String companystartdate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,151 +0,0 @@
|
|||
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 lastName;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 账号类型
|
||||
*/
|
||||
private Integer accountType;
|
||||
|
||||
/**
|
||||
* 主账号
|
||||
*/
|
||||
private Long belongTo;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 职务
|
||||
*/
|
||||
private Long jobActivity;
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
private Long jobTitle;
|
||||
|
||||
/**
|
||||
* 职等
|
||||
*/
|
||||
private String jobLevel;
|
||||
|
||||
/**
|
||||
* 职务类别
|
||||
*/
|
||||
private Long jobGroupId;
|
||||
|
||||
/**
|
||||
* 职责描述
|
||||
*/
|
||||
private String jobActivityDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 照片
|
||||
*/
|
||||
private String resourceImageId;
|
||||
|
||||
/**
|
||||
* 办公地点
|
||||
*/
|
||||
private Integer locationId;
|
||||
|
||||
/**
|
||||
* 移动电话
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 办公室电话
|
||||
*/
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
private Long creator;
|
||||
private int deleteType;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
private String companyStartDate;
|
||||
|
||||
/**
|
||||
* 参加工作日期
|
||||
*/
|
||||
private String workStartDate;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer showOrder;
|
||||
|
||||
private Long ecDepartment;
|
||||
|
||||
private Long ecCompany;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private String jobGrade;
|
||||
|
||||
private String schemeId;
|
||||
|
||||
private String sequenceId;
|
||||
|
||||
private String baseFieldsValue;
|
||||
|
||||
private String baseFields;
|
||||
|
||||
}
|
||||
|
|
@ -399,10 +399,6 @@
|
|||
select company_id
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where delete_type = 0
|
||||
union
|
||||
select jcl_rolelevel
|
||||
from jcl_org_detach
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="getCompanyByUUID" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.engine.organization.mapper.hrmresource;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
|
|
@ -10,16 +13,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
*/
|
||||
public interface HrmResourceMapper {
|
||||
|
||||
/**
|
||||
* 获取最大ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long getMaxId();
|
||||
|
||||
Long getMaxShowOrder();
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询姓名
|
||||
*
|
||||
|
|
@ -28,24 +21,7 @@ public interface HrmResourceMapper {
|
|||
*/
|
||||
String getLastNameById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据所选关键字段查询ID
|
||||
*
|
||||
* @param keyField
|
||||
* @param keyFieldValue
|
||||
* @return
|
||||
*/
|
||||
Long getIdByKeyField(@Param("keyField") String keyField, @Param("keyFieldValue") String keyFieldValue);
|
||||
List<HrmResourceVO> listAll(@Param("ids") List<Long> ids);
|
||||
|
||||
///**
|
||||
// * 根据所选关键字段,查询关键列
|
||||
// *
|
||||
// * @param keyField
|
||||
// * @return
|
||||
// */
|
||||
//List<JSONObject> getKeyMapByKetField(@Param("keyField") String keyField);
|
||||
|
||||
String getEcResourceId(@Param("jclResourceId") String jclResourceId);
|
||||
|
||||
Long getJclResourceId(@Param("ecResourceId") String ecResourceId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,60 +2,20 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.hrmresource.HrmResourceMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
</sql>
|
||||
|
||||
<select id="getMaxId" resultType="java.lang.Long">
|
||||
select max(id)
|
||||
from jcl_org_hrmresource
|
||||
</select>
|
||||
|
||||
<select id="getLastNameById" resultType="java.lang.String">
|
||||
select last_name
|
||||
from jcl_org_hrmresource
|
||||
where delete_type = 0
|
||||
and id = #{id}
|
||||
from hrmresource
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getIdByKeyField" resultType="java.lang.Long">
|
||||
select id
|
||||
from jcl_org_hrmresource
|
||||
where delete_type = 0
|
||||
and ${keyField} = #{keyFieldValue}
|
||||
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
|
||||
select t.lastname as lastname, d.departmentname as departmentname, c.subcompanyname as companyname, t.mobile,
|
||||
t.telephone, t1.lastname as managername from hrmresource t left join hrmdepartment d on t.departmentid = d.id
|
||||
left join hrmsubcompany c on t.subcompanyid1 = c.id left join hrmresource t1 on t.managerid = t1.id where 1 = 1
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND t.id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="getEcResourceId" resultType="java.lang.String">
|
||||
select a.id
|
||||
from hrmresource a
|
||||
inner join jcl_org_hrmresource b on a.uuid = b.uuid
|
||||
where b.id = #{jclResourceId}
|
||||
</select>
|
||||
<select id="getJclResourceId" resultType="java.lang.Long">
|
||||
select a.id
|
||||
from jcl_org_hrmresource a
|
||||
inner join hrmresource b on a.uuid = b.uuid
|
||||
where b.id = #{ecResourceId}
|
||||
</select>
|
||||
<select id="getMaxShowOrder" resultType="java.lang.Long">
|
||||
select max(show_order)
|
||||
from jcl_org_hrmresource
|
||||
</select>
|
||||
<!-- <select id="getKeyMapByKetField" resultType="com.alibaba.fastjson.JSONObject">-->
|
||||
<!-- select id, account_type, certificate_num, login_id, work_code, ${keyField}-->
|
||||
<!-- from jcl_org_hrmresource-->
|
||||
<!-- </select>-->
|
||||
</mapper>
|
||||
|
|
@ -2,6 +2,7 @@ package com.engine.organization.mapper.hrmresource;
|
|||
|
||||
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import com.engine.organization.entity.jclimport.po.CusFormFieldPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclSelectItem;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -61,4 +62,10 @@ public interface SystemDataMapper {
|
|||
|
||||
List<String> getBatchUuidByIds(@Param("tableName") String tableName,@Param("ecIds") List<String> ecIds);
|
||||
|
||||
CusFieldData getHrmCusFieldDataByIdAndScopeId(@Param("id") Long id, @Param("scopeId") Long scopeId);
|
||||
|
||||
int insertCusFieldData(CusFieldData cusFieldData);
|
||||
|
||||
int updateCusFieldData(CusFieldData cusFieldData);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,9 +154,11 @@
|
|||
from hrmresource
|
||||
</select>
|
||||
<select id="getHrmResourceIdsByDept" resultType="java.lang.Long">
|
||||
select id
|
||||
from jcl_org_hrmresource
|
||||
where department_id = #{departmentId}
|
||||
select a.id
|
||||
from hrmresource a
|
||||
inner join hrmdepartment b on a.DEPARTMENTID = b.id
|
||||
inner join jcl_org_dept c on b.uuid = c.uuid
|
||||
where c.id = #{departmentId}
|
||||
</select>
|
||||
|
||||
<select id="getBatchUuidByIds" resultType="java.lang.String">
|
||||
|
|
@ -166,5 +168,36 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getHrmCusFieldDataByIdAndScopeId"
|
||||
resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
|
||||
select *
|
||||
from cus_fielddata
|
||||
where scope = 'HrmCustomFieldByInfoType'
|
||||
and scopeid = #{scopeId}
|
||||
and id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateCusFieldData">
|
||||
update cus_fielddata
|
||||
<set>
|
||||
field100001=#{field100001},
|
||||
field100002=#{field100002},
|
||||
field100003=#{field100003},
|
||||
field100008=#{field100008},
|
||||
field100006=#{field100006},
|
||||
field100007=#{field100007},
|
||||
field100005=#{field100005},
|
||||
field100010=#{field100010},
|
||||
field100009=#{field100009},
|
||||
</set>
|
||||
where scope = 'HrmCustomFieldByInfoType'
|
||||
and id = #{id}
|
||||
and scopeid = #{scopeId}
|
||||
</update>
|
||||
|
||||
<insert id="insertCusFieldData">
|
||||
insert into cus_fielddata(scope, scopeid, id)
|
||||
values ('HrmCustomFieldByInfoType', #{scopeId}, #{id})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -468,8 +468,11 @@
|
|||
from JCL_ORG_STAFF
|
||||
where delete_type = 0
|
||||
union
|
||||
select job_title
|
||||
from jcl_org_hrmresource
|
||||
select field100002
|
||||
from cus_fielddata
|
||||
inner join
|
||||
hrmresource on
|
||||
cus_fielddata.ID = hrmresource.ID
|
||||
where STATUS < 4
|
||||
</select>
|
||||
<select id="listJobsByDepartmentId" resultMap="BaseResultMap">
|
||||
|
|
@ -571,10 +574,11 @@
|
|||
</select>
|
||||
<select id="isHasResource" resultType="java.lang.Integer">
|
||||
select count(a.id)
|
||||
from jcl_org_hrmresource a
|
||||
inner join jcl_org_job b on a.job_title = b.id
|
||||
from hrmresource a
|
||||
inner join cus_fielddata b on a.id = b.id and b.scope = 'hrmcustomfieldbyinfotype' and b.scopeid = -1
|
||||
inner join jcl_org_job c on b.field100002 = c.id
|
||||
where a.status < 4
|
||||
and b.id = #{jobId}
|
||||
and c.id = #{jobId}
|
||||
</select>
|
||||
|
||||
<sql id="nullparentJob">
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
package com.engine.organization.mapper.personnelcard;
|
||||
|
||||
import com.engine.organization.entity.detach.po.ManagerDetachPO;
|
||||
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/24
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface CardAccessMapper {
|
||||
|
||||
int insertIgnoreNull(CardAccessPO cardAccessPO);
|
||||
|
||||
int updateCardAccess(CardAccessPO cardAccessPO);
|
||||
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
ManagerDetachPO selectById(@Param("id") Integer id);
|
||||
}
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.personnelcard.CardAccessMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.personnelcard.po.CardAccessPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="type_id" property="typeId"/>
|
||||
<result column="type_name" property="typeName"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="all_people" property="allPeople"/>
|
||||
<result column="superior" property="superior"/>
|
||||
<result column="all_superior" property="allSuperior"/>
|
||||
<result column="custom" property="custom"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
, t.type_id
|
||||
, t.type_name
|
||||
, t.status
|
||||
, t.all_people
|
||||
, t.superior
|
||||
, t.all_superior
|
||||
, t.custom
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO" keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_org_cardaccess
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="typeId != null ">
|
||||
type_id,
|
||||
</if>
|
||||
<if test="typeName != null ">
|
||||
type_name,
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
status,
|
||||
</if>
|
||||
<if test="allPeople != null ">
|
||||
all_people,
|
||||
</if>
|
||||
<if test="superior != null ">
|
||||
superior,
|
||||
</if>
|
||||
<if test="allSuperior != null ">
|
||||
all_superior,
|
||||
</if>
|
||||
<if test="custom != null">
|
||||
custom,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="typeId != null ">
|
||||
#{typeId},
|
||||
</if>
|
||||
<if test="typeName != null ">
|
||||
#{typeName},
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="allPeople != null ">
|
||||
#{allPeople},
|
||||
</if>
|
||||
<if test="superior != null ">
|
||||
#{superior},
|
||||
</if>
|
||||
<if test="allSuperior != null ">
|
||||
#{allSuperior},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="custom != null">
|
||||
#{custom},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO" databaseId="oracle">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
select JCL_ORG_CARDACCESS_ID.currval from dual
|
||||
</selectKey>
|
||||
INSERT INTO jcl_org_cardaccess
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="typeId != null ">
|
||||
type_id,
|
||||
</if>
|
||||
<if test="typeName != null ">
|
||||
type_name,
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
status,
|
||||
</if>
|
||||
<if test="allPeople != null ">
|
||||
all_people,
|
||||
</if>
|
||||
<if test="superior != null ">
|
||||
superior,
|
||||
</if>
|
||||
<if test="allSuperior != null ">
|
||||
all_superior,
|
||||
</if>
|
||||
<if test="custom != null">
|
||||
custom,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="typeId != null ">
|
||||
#{typeId},
|
||||
</if>
|
||||
<if test="typeName != null ">
|
||||
#{typeName},
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="allPeople != null ">
|
||||
#{allPeople},
|
||||
</if>
|
||||
<if test="superior != null ">
|
||||
#{superior},
|
||||
</if>
|
||||
<if test="allSuperior != null ">
|
||||
#{allSuperior},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="custom != null">
|
||||
#{custom},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCardAccess" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO">
|
||||
update jcl_org_cardaccess
|
||||
<set>
|
||||
type_id=#{typeId},
|
||||
type_name=#{typeName},
|
||||
status=#{status},
|
||||
all_people=#{allPeople},
|
||||
all_superior=#{allSuperior},
|
||||
custom=#{custom},
|
||||
update_time=#{updateTime},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE jcl_org_cardaccess
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_cardaccess t
|
||||
WHERE delete_type = 0
|
||||
AND id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.engine.organization.mapper.personnelcard;
|
||||
|
||||
import com.engine.organization.entity.personnelcard.ResourceBaseTab;
|
||||
import com.engine.organization.entity.personnelcard.User;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface PersonnelCardMapper {
|
||||
/**
|
||||
* 获取人员卡片User对象
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
User getUserById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 获取自定义显示栏目
|
||||
* @return
|
||||
*/
|
||||
List<ResourceBaseTab> getResourceBaseTabList();
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.personnelcard.PersonnelCardMapper">
|
||||
<resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.User">
|
||||
<result column="id" property="id"/>
|
||||
<result column="resource_image_id" property="image"/>
|
||||
<result column="last_name" property="name"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="mobile" property="phone"/>
|
||||
<result column="belong_to" property="belongTo"/>
|
||||
<result column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseTabMap" type="com.engine.organization.entity.personnelcard.ResourceBaseTab">
|
||||
<result column="id" property="id"/>
|
||||
<result column="groupname" property="groupName"/>
|
||||
<result column="grouplabel" property="groupLabel"/>
|
||||
<result column="dsporder" property="dspOrder"/>
|
||||
<result column="isopen" property="isOpen"/>
|
||||
<result column="ismand" property="isMand"/>
|
||||
<result column="isused" property="isUsed"/>
|
||||
<result column="issystem" property="isSystem"/>
|
||||
<result column="linkurl" property="linkUrl"/>
|
||||
<result column="tabnum" property="tabNum"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="getUserById" resultMap="UserMap">
|
||||
select id,
|
||||
resource_image_id,
|
||||
last_name,
|
||||
sex,
|
||||
email,
|
||||
mobile,
|
||||
belong_to,
|
||||
status
|
||||
from jcl_org_hrmresource
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getResourceBaseTabList" resultMap="BaseTabMap">
|
||||
select *
|
||||
from HrmResourceBaseTab
|
||||
where isopen = 1
|
||||
order by dsporder
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.engine.organization.mapper.resource;
|
||||
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/6/28
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface ResourceMapper {
|
||||
|
||||
List<HrmResourceVO> listAll(@Param("ids")List<Long> ids);
|
||||
|
||||
List<HrmResourceVO> listDetachAll(@Param("ids") List<Long> ids, @Param("companyIds") List<Long> companyIds);
|
||||
|
||||
List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId);
|
||||
|
||||
int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Long parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Long ecCompany, @Param("ecDepartment") Long ecDepartment);
|
||||
|
||||
HrmResourcePO getResourceById(@Param("id") String id);
|
||||
|
||||
List<HrmResourcePO> listByNo(@Param("workCode") String workCode);
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.resource.ResourceMapper">
|
||||
<resultMap id="HrmResourceMap" type="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="last_name" property="lastName"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="account_type" property="accountType"/>
|
||||
<result column="belong_to" property="belongTo"/>
|
||||
<result column="company_id" property="companyId"/>
|
||||
<result column="department_id" property="departmentId"/>
|
||||
<result column="job_activity" property="jobActivity"/>
|
||||
<result column="job_title" property="jobTitle"/>
|
||||
<result column="job_level" property="jobLevel"/>
|
||||
<result column="job_group_id" property="jobGroupId"/>
|
||||
<result column="job_activity_desc" property="jobActivityDesc"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="resource_image_id" property="resourceImageId"/>
|
||||
<result column="location_id" property="locationId"/>
|
||||
<result column="mobile" property="mobile"/>
|
||||
<result column="telephone" property="telephone"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="company_start_date" property="companyStartDate"/>
|
||||
<result column="work_start_date" property="workStartDate"/>
|
||||
<result column="show_order" property="showOrder"/>
|
||||
<result column="ec_department" property="ecDepartment"/>
|
||||
<result column="ec_company" property="ecCompany"/>
|
||||
<result column="uuid" property="uuid"/>
|
||||
<result column="job_grade" property="jobGrade"/>
|
||||
<result column="scheme_id" property="schemeId"/>
|
||||
<result column="sequence_id" property="sequenceId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id,t.work_code,t.last_name,t.sex,t.status,t.account_type,
|
||||
t.belong_to,t.ec_company,t.job_title,t.ec_department,t.
|
||||
scheme_id,t.sequence_id,t.job_grade,t.job_level,t.job_group_id,
|
||||
t.job_activity,t.location_id,t.show_order,t.company_start_date,
|
||||
t.work_start_date,t.job_activity_desc,t.resource_image_id,t.mobile,
|
||||
t.telephone,t.email,t.uuid
|
||||
</sql>
|
||||
<update id="updateResourceJob">
|
||||
update jcl_org_hrmresource
|
||||
<set>
|
||||
job_title = #{targetJobId},
|
||||
company_id = #{parentComp},
|
||||
department_id = #{parentDept},
|
||||
ec_company = #{ecCompany},
|
||||
ec_department = #{ecDepartment},
|
||||
</set>
|
||||
where delete_type = 0 and job_title =#{originalJobId}
|
||||
</update>
|
||||
|
||||
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
|
||||
SELECT t.last_name as lastName,d.dept_name as departmentName,
|
||||
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
|
||||
from jcl_org_hrmresource t
|
||||
left join JCL_ORG_DEPT d on t.department_id = d.id
|
||||
left join jcl_org_comp c on t.company_id = c.id
|
||||
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
|
||||
where 1 = 1
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND t.id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!--<include refid="likeSql"/>-->
|
||||
<!--<if test="param.departmentId != null and param.departmentId != ''">-->
|
||||
<!--and t.department_id = #{param.departmentId}-->
|
||||
<!--</if>-->
|
||||
<!--<if test="param.companyId != null and param.companyId != ''">-->
|
||||
<!--and t.company_id = #{param.companyId}-->
|
||||
<!--</if>-->
|
||||
<!--<if test="param.mobile != null and param.mobile != ''">-->
|
||||
<!--and t.mobile = #{param.mobile}-->
|
||||
<!--</if>-->
|
||||
<!--<if test="param.telephone != null and param.telephone != ''">-->
|
||||
<!--and t.telephone = #{param.telephone}-->
|
||||
<!--</if>-->
|
||||
<!--<if test="param.managerId != null and param.managerId != ''">-->
|
||||
<!--and t.manager_id = #{param.managerId}-->
|
||||
<!--</if>-->
|
||||
<!--<if test="param.mobileCall != null and param.mobileCall != ''">-->
|
||||
<!--and t.mobile_call = #{param.mobileCall}-->
|
||||
<!--</if>-->
|
||||
<!--<if test="param.jobTitle != null and param.jobTitle != ''">-->
|
||||
<!--and t.job_title = #{param.jobTitle}-->
|
||||
<!--</if>-->
|
||||
order by t.id asc;
|
||||
</select>
|
||||
<select id="getResourceListByJobId"
|
||||
resultMap="HrmResourceMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_hrmresource t where job_title = #{jobId}
|
||||
</select>
|
||||
<select id="getResourceById" resultType="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_hrmresource t where delete_type = 0 and id = #{id}
|
||||
</select>
|
||||
<select id="listByNo" resultMap="HrmResourceMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
|
||||
</select>
|
||||
<select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
|
||||
SELECT t.last_name as lastName,d.dept_name as departmentName,
|
||||
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
|
||||
from jcl_org_hrmresource t
|
||||
left join JCL_ORG_DEPT d on t.department_id = d.id
|
||||
left join jcl_org_comp c on t.company_id = c.id
|
||||
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
|
||||
where 1 = 1
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND t.id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
AND c.id IN
|
||||
<foreach collection="companyIds" open="(" item="companyId" separator="," close=")">
|
||||
#{companyId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<sql id="likeSql">
|
||||
<if test="param.lastName != null and param.lastName != ''">
|
||||
AND t.last_name like CONCAT('%',#{param.lastName},'%')
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="likeSql" databaseId="oracle">
|
||||
<if test="param.lastName != null and param.lastName != ''">
|
||||
AND t.last_name like '%'||#{param.lastName}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="likeSql" databaseId="sqlserver">
|
||||
<if test="param.lastName != null and param.lastName != ''">
|
||||
AND t.last_name like '%'+#{param.lastName}+'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.engine.organization.mapper.trigger;
|
||||
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
|
|
@ -20,11 +20,11 @@ public interface CompTriggerMapper {
|
|||
|
||||
String getJobTitleMarkById(@Param("id") Integer id);
|
||||
|
||||
CusFieldData getCusFieldDataById(@Param("id") Integer id);
|
||||
|
||||
Integer sumStaffNum(@Param("fdatebegin") Date fdatebegin, @Param("compId") Integer compId);
|
||||
|
||||
int deleteMap(@Param("ftype") Integer ftype, @Param("fobjid") Integer fobjid, @Param("fdatebegin") Date fdatebegin);
|
||||
|
||||
int updateMap(@Param("ftype") Integer ftype, @Param("fobjid") Integer fobjid, @Param("fdatebegin") Date fdatebegin, @Param("fdate") Date fdate);
|
||||
|
||||
HrmResourcePO getResourceByEcId(@Param("ecId") Integer ecId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@
|
|||
from hrmjobtitles
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getCusFieldDataById" resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
|
||||
select field100008, field100007
|
||||
from cus_fielddata
|
||||
where scope = 'HrmCustomFieldByInfoType'
|
||||
and scopeid = 3
|
||||
and id = #{id}
|
||||
</select>
|
||||
<select id="sumStaffNum" resultType="java.lang.Integer">
|
||||
select sum(staff_num)
|
||||
from JCL_ORG_STAFF
|
||||
|
|
@ -40,11 +47,4 @@
|
|||
and time_end >= #{fdatebegin})
|
||||
and comp_id = #{compId}
|
||||
</select>
|
||||
<select id="getResourceByEcId" resultMap="com.engine.organization.mapper.resource.ResourceMapper.HrmResourceMap">
|
||||
select
|
||||
<include refid="com.engine.organization.mapper.resource.ResourceMapper.baseColumns"/>
|
||||
from jcl_org_hrmresource t
|
||||
inner join hrmresource a on t.uuid = a.uuid
|
||||
where t.delete_type = 0 and a.id = #{ecId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.mapper.trigger;
|
||||
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
|
|
@ -14,6 +15,11 @@ import java.util.List;
|
|||
public interface HrmResourceTriggerMapper {
|
||||
HrmResource getHrmResource(@Param("id") Long id);
|
||||
|
||||
CusFieldData getCusFieldDataById(@Param("fObjId") Integer fObjId);
|
||||
|
||||
String getField100002(@Param("fObjId") Integer fObjId);
|
||||
|
||||
|
||||
List<Long> getFidsByFleader(@Param("fLeader") String fLeader, @Param("currentDate") Date currentDate);
|
||||
|
||||
int updateLeaders(@Param("currentDate") Date currentDate,@Param("fLeader") String fLeader, @Param("fLeaderImg") String fLeaderImg, @Param("fLeaderName") String fLeaderName, @Param("fLeaderJobId") Integer fLeaderJobId, @Param("fLeaderJob") String fLeaderJob, @Param("fLeaderLv") String fLeaderLv, @Param("fLeaderSt") String fLeaderSt);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@
|
|||
from hrmresource
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getCusFieldDataById" resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
|
||||
select field100008, field100007
|
||||
from cus_fielddata
|
||||
where scope = 'HrmCustomFieldByInfoType'
|
||||
and scopeid = 3
|
||||
and id = #{fObjId}
|
||||
</select>
|
||||
|
||||
<select id="getFidsByFleader" resultType="java.lang.Long">
|
||||
SELECT fid
|
||||
|
|
@ -28,4 +35,11 @@
|
|||
AND FDATEBEGIN <= #{currentDate}
|
||||
AND FDATEEND >= #{currentDate}
|
||||
</select>
|
||||
<select id="getField100002" resultType="java.lang.String">
|
||||
select field100002
|
||||
from cus_fielddata
|
||||
where scope = 'HrmCustomFieldByInfoType'
|
||||
and scopeid = -1
|
||||
and id = #{fObjId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -96,8 +96,11 @@
|
|||
AND FDATEEND >= #{currentDate}
|
||||
</select>
|
||||
<select id="countOnJobByJObId" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from jcl_org_hrmresource a
|
||||
where a.job_title = #{jobId} and a.status < 4
|
||||
select count(a.id)
|
||||
from hrmresource a
|
||||
inner join cus_fielddata b on a.id = b.id and b.scope = 'hrmcustomfieldbyinfotype' and b.scopeid = -1
|
||||
inner join jcl_org_job c on b.field100002 = c.id
|
||||
where a.status < 4
|
||||
and c.id = #{jobId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.personnelcard.Iframe;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface HrmPersonnelCardService {
|
||||
/**
|
||||
* 获取人事卡片信息
|
||||
*
|
||||
* @param uId
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getPersonnelCard(Long uId);
|
||||
|
||||
/**
|
||||
* 获取人事自定义显示栏目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Iframe> getIframeList();
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface ManagerDetachService {
|
||||
|
||||
/**
|
||||
* 获取table列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> listPage(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 新建编辑表单
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getForm(Integer id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int deleteByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int save(ManagerDetachParam param);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int updateDetach(ManagerDetachParam param);
|
||||
|
||||
/**
|
||||
* 分权开关
|
||||
* @param isDetach
|
||||
*/
|
||||
String doDetach(String isDetach);
|
||||
}
|
||||
|
|
@ -34,7 +34,6 @@ import com.engine.organization.thread.OrganizationSyncEc;
|
|||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.coderule.CodeRuleUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.page.Column;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.page.PageUtil;
|
||||
|
|
@ -114,12 +113,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
PageInfo<CompListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
|
||||
List<CompPO> allList = getCompMapper().list(orderSql);
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
||||
|
||||
// 添加父级元素
|
||||
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ import com.engine.organization.thread.OrganizationSyncEc;
|
|||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.coderule.CodeRuleUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.page.Column;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.page.PageUtil;
|
||||
|
|
@ -178,12 +177,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
PageInfo<DepartmentListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
|
||||
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql);
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeptPOs);
|
||||
// 添加父级元素
|
||||
List<DepartmentListDTO> compListDTOS = DepartmentBO.buildDeptDTOList(allList, filterDeptPOs);
|
||||
List<DepartmentListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS);
|
||||
|
|
@ -660,7 +657,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
// 更新当前部门下的人员
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString());
|
||||
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getEcCompany(), targetEcDeptId, mergeEcDeptId);
|
||||
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? ,department_id = ?, ec_department = ?where department_id =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
// 更新人员组织架构图
|
||||
for (Long hrmResourceId : hrmResourceIds) {
|
||||
new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
|
|
@ -763,7 +759,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
|
||||
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString());
|
||||
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
|
||||
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", deptById.getParentComp(), ecCompanyId, deptById.getId());
|
||||
// 更新人员组织架构图
|
||||
for (Long hrmResourceId : hrmResourceIds) {
|
||||
new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
|
|
@ -796,7 +791,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
|
||||
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
|
||||
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
|
||||
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId());
|
||||
// 更新人员组织架构图
|
||||
for (Long hrmResourceId : hrmResourceIds) {
|
||||
new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
|
|
@ -839,9 +833,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build();
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,17 @@ package com.engine.organization.service.impl;
|
|||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.service.ExportCommonService;
|
||||
import com.engine.organization.util.HrmI18nUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.excel.ExcelUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -28,18 +25,8 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
@Override
|
||||
public XSSFWorkbook resourceExport(List<Long> ids) {
|
||||
|
||||
List<HrmResourceVO> hrmResourceVOS ;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
if (StringUtils.isBlank(detachUtil.getJclRoleLevels())) {
|
||||
hrmResourceVOS = new ArrayList<>();
|
||||
} else {
|
||||
List<Long> jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listDetachAll(ids, jclRoleLevelList);
|
||||
}
|
||||
} else {
|
||||
hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listAll(ids);
|
||||
}
|
||||
List<HrmResourceVO> hrmResourceVOS= MapperProxyFactory.getProxy(HrmResourceMapper.class).listAll(ids);
|
||||
|
||||
if (hrmResourceVOS == null) {
|
||||
hrmResourceVOS = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,210 +0,0 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
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.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.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
|
||||
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 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.workflow.search.WorkflowRequestUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/08
|
||||
* @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 HrmResourceMapper getHrmResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getPersonnelCard(Long uId) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
User userInfo;
|
||||
//TODO 人员表之前关联关系,处理UID
|
||||
if (null == uId) {
|
||||
uId = getHrmResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
|
||||
}
|
||||
String ecResourceId = getHrmResourceMapper().getEcResourceId(uId.toString());
|
||||
userInfo = getPersonnelCardMapper().getUserById(uId);
|
||||
userInfo.setEcId(ecResourceId);
|
||||
|
||||
OrganizationAssert.notNull(uId, "未找到对应数据");
|
||||
// 人员基本信息
|
||||
|
||||
// 统计报表
|
||||
Statistical statistical = getStatistical(ecResourceId);
|
||||
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listByType(4, IS_SHOW);
|
||||
// 获取前三个模块的信息
|
||||
List<FormItem> formItemList = new ArrayList<>();
|
||||
for (ExtendGroupPO groupPO : extendGroupList) {
|
||||
FormItem formItem = getFormItem(groupPO, uId);
|
||||
if (CollectionUtils.isEmpty(formItem.getItems())) {
|
||||
continue;
|
||||
}
|
||||
formItemList.add(formItem);
|
||||
}
|
||||
// 所有锚点
|
||||
List<Anchor> anchorList = new ArrayList<>();
|
||||
// 添加字段分组信息
|
||||
for (FormItem formItem : formItemList) {
|
||||
anchorList.add(Anchor.builder().id(formItem.getId()).title(formItem.getTitle()).build());
|
||||
}
|
||||
// 添加拓展页面信息
|
||||
List<ResourceBaseTab> resourceBaseTabList = getPersonnelCardMapper().getResourceBaseTabList();
|
||||
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
|
||||
anchorList.add(Anchor.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).build());
|
||||
}
|
||||
|
||||
resultMap.put("user", userInfo);
|
||||
resultMap.put("statistical", statistical);
|
||||
resultMap.put("formItems", formItemList);
|
||||
resultMap.put("anchorList", anchorList);
|
||||
resultMap.put("iframeList", getIframeList());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Iframe> getIframeList() {
|
||||
List<Iframe> iframeList = new ArrayList<>();
|
||||
List<ResourceBaseTab> resourceBaseTabList = getPersonnelCardMapper().getResourceBaseTabList();
|
||||
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
|
||||
iframeList.add(Iframe.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).url(resourceBaseTab.getLinkUrl()).build());
|
||||
}
|
||||
return iframeList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取报表统计数据
|
||||
*
|
||||
* @param ecResourceId
|
||||
* @return
|
||||
*/
|
||||
private Statistical getStatistical(String ecResourceId) {
|
||||
try {
|
||||
// 获取Ec用户ID
|
||||
Statistical statistical = new Statistical();
|
||||
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Workflow)) {
|
||||
statistical.setWorkflowCount(new WorkflowRequestUtil().getRequestCount(user, ecResourceId));
|
||||
} else {
|
||||
statistical.setWorkflowCount(0);
|
||||
}
|
||||
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Doc)) {
|
||||
Object[] docCount4Hrm = new DocSearchComInfo().getDocCount4Hrm(ecResourceId, user);
|
||||
statistical.setDocCount(null == docCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(docCount4Hrm[1])));
|
||||
} else {
|
||||
statistical.setDocCount(0);
|
||||
}
|
||||
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Crm)) {
|
||||
String[] crmCount4Hrm = new CrmShareBase().getCrmCount4Hrm(ecResourceId, ecResourceId);
|
||||
statistical.setCusCount(null == crmCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(crmCount4Hrm[1])));
|
||||
} else {
|
||||
statistical.setCusCount(0);
|
||||
}
|
||||
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Cowork)) {
|
||||
String[] coworkCount4Hrm = new CoworkShareManager().getCoworkCount4Hrm(ecResourceId, ecResourceId);
|
||||
statistical.setCollaborationCount(null == coworkCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(coworkCount4Hrm[1])));
|
||||
} else {
|
||||
statistical.setCollaborationCount(0);
|
||||
}
|
||||
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Blog)) {
|
||||
String[] blogCount4Hrm = new BlogShareManager().getBlogCount4Hrm(ecResourceId);
|
||||
statistical.setWeiboCount(null == blogCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(blogCount4Hrm[1])));
|
||||
} else {
|
||||
statistical.setWeiboCount(0);
|
||||
}
|
||||
return statistical;
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private FormItem getFormItem(ExtendGroupPO extendGroup, Long uId) {
|
||||
FormItem formItem = new FormItem();
|
||||
formItem.setId("group" + extendGroup.getId());
|
||||
formItem.setTitle(extendGroup.getGroupName());
|
||||
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(extendGroup.getId(), IS_SHOW);
|
||||
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());
|
||||
}
|
||||
}
|
||||
formItem.setItems(itemList);
|
||||
return formItem;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,769 +0,0 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrm.entity.RuleCodeType;
|
||||
import com.engine.hrm.util.face.HrmFaceCheckManager;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
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.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.entity.hrmresource.bo.HrmRelationBO;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmRelationPO;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
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.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
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.hrmresource.HrmRelationMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.post.PostInfoMapper;
|
||||
import com.engine.organization.mapper.post.PostMapper;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.mapper.sequence.SequenceMapper;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.service.HrmResourceService;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.coderule.CodeRuleUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.page.PageUtil;
|
||||
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 weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @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 static final Long GROUP_ID = 4L;
|
||||
|
||||
/**
|
||||
* 分组类型
|
||||
* 1:分部
|
||||
* 2:部门
|
||||
* 3:岗位
|
||||
* 4:人员
|
||||
*/
|
||||
private static final String EXTEND_TYPE = "4";
|
||||
|
||||
/**
|
||||
* 主表表名
|
||||
*/
|
||||
private static final String JCL_ORG_HRM = "JCL_ORG_HRMRESOURCE";
|
||||
/**
|
||||
* 主表拓展表
|
||||
*/
|
||||
private static final String JCL_ORG_HRMEXT = "JCL_ORG_HRMRESOURCEEXT";
|
||||
/**
|
||||
* 明细表拓展表
|
||||
*/
|
||||
private static final String JCL_ORG_HRMEXT_DT1 = "JCL_ORG_HRMRESOURCEEXT_DT1";
|
||||
|
||||
private static final String HRM_RESOURCE = "hrmresource";
|
||||
|
||||
|
||||
private static final String RIGHT_NAME = "Roster:All";
|
||||
|
||||
private SchemeMapper getSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
}
|
||||
|
||||
private LevelMapper getLevelMapper() {
|
||||
return MapperProxyFactory.getProxy(LevelMapper.class);
|
||||
}
|
||||
|
||||
private GradeMapper getGradeMapper() {
|
||||
return MapperProxyFactory.getProxy(GradeMapper.class);
|
||||
}
|
||||
|
||||
private SequenceMapper getSequenceMapper() {
|
||||
return MapperProxyFactory.getProxy(SequenceMapper.class);
|
||||
}
|
||||
|
||||
private PostMapper getPostMapper() {
|
||||
return MapperProxyFactory.getProxy(PostMapper.class);
|
||||
}
|
||||
|
||||
private PostInfoMapper getPostInfoMapper() {
|
||||
return MapperProxyFactory.getProxy(PostInfoMapper.class);
|
||||
}
|
||||
|
||||
private HrmRelationMapper getHrmRelationMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmRelationMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private HrmResourceMapper getHrmResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
private static ResourceMapper getResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(ResourceMapper.class);
|
||||
}
|
||||
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private SystemDataMapper getSystemDataMapper() {
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@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) {
|
||||
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();
|
||||
return new HashMap<>(result.getResultMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSaveForm() {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1");
|
||||
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
||||
for (ExtendTitlePO extendTitle : extendTitles) {
|
||||
List<SearchConditionItem> items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_HRM, 2, extendTitle.getId().toString(), null, null, null);
|
||||
if (CollectionUtils.isNotEmpty(items)) {
|
||||
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
||||
}
|
||||
}
|
||||
}
|
||||
apiDatas.put("condition", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long saveBaseForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
String workCode = (String) params.get("work_code");
|
||||
// 判断是否开启自动编号
|
||||
workCode = repeatDetermine(workCode);
|
||||
params.put("work_code", workCode);
|
||||
// 完善新增参数
|
||||
completeParams(params);
|
||||
|
||||
// 新增EC人员,新增成功后,新增到聚才林人员表
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.ADD, params).sync();
|
||||
String ecResourceId = Util.null2String(syncMap.get("id"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecResourceId), Util.null2String(syncMap.get("message")));
|
||||
// 获取人员UUID
|
||||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId);
|
||||
params.put("uuid", recordInfo.getUuid());
|
||||
Long resourceId = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
|
||||
new HrmResourceTriggerRunnable(resourceId).run();
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBaseForm(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_HRM : JCL_ORG_HRMEXT, viewAttr, id, extendTitle.getId() + "", "");
|
||||
if (CollectionUtils.isNotEmpty(items)) {
|
||||
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("buttons", buttonsMap);
|
||||
resultMap.put("conditions", addGroups);
|
||||
resultMap.put("id", id);
|
||||
// 拓展页面分组
|
||||
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_HRMEXT));
|
||||
// 处理明细表
|
||||
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_HRMEXT_DT1, id, viewAttr, false));
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
||||
apiDatas.put("result", resultMap);
|
||||
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateForm(Map<String, Object> params) {
|
||||
Long id = Long.parseLong((String) params.get("id"));
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
if ("0".equals(groupId)) {
|
||||
groupId = GROUP_ID.toString();
|
||||
}
|
||||
// 判断编号是否重复
|
||||
String workCode = Util.null2String(params.get("work_code"));
|
||||
HrmResourcePO resourceById = getResourceMapper().getResourceById(id.toString());
|
||||
if (!workCode.equals(resourceById.getWorkCode())) {
|
||||
workCode = repeatDetermine(workCode);
|
||||
params.put("work_code", workCode);
|
||||
}
|
||||
|
||||
// 完善更新参数
|
||||
completeParams(params);
|
||||
|
||||
// 更新EC人员,更新成功后,更新聚才林人员表
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.UPDATE, params).sync();
|
||||
String ecResourceId = Util.null2String(syncMap.get("id"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecResourceId), Util.null2String(syncMap.get("message")));
|
||||
|
||||
int updateCount = 0;
|
||||
// 更新主表数据
|
||||
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", id);
|
||||
// 更新主表拓展表
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRMEXT, params, groupId, id);
|
||||
//更新明细表
|
||||
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_HRMEXT_DT1, params, id);
|
||||
|
||||
new HrmResourceTriggerRunnable(id).run();
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
SearchConditionItem lastNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "姓名", "lastName");
|
||||
SearchConditionItem jobTitleItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "666", "jobTitle", "");
|
||||
SearchConditionItem companyIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "164", "ecCompany", "");
|
||||
SearchConditionItem departmentIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "4", "ecDepartment", "");
|
||||
SearchConditionItem telephoneItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "办公电话", "telephone");
|
||||
SearchConditionItem mobileItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "移动电话", "mobile");
|
||||
|
||||
conditionItems.add(lastNameItem);
|
||||
conditionItems.add(jobTitleItem);
|
||||
conditionItems.add(companyIdItem);
|
||||
conditionItems.add(departmentIdItem);
|
||||
conditionItems.add(telephoneItem);
|
||||
conditionItems.add(mobileItem);
|
||||
|
||||
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||
apiDatas.put("conditions", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getHasRight() {
|
||||
Map<String, Object> btnDatas = new HashMap<>();
|
||||
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
||||
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
||||
topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
|
||||
btnDatas.put("topMenu", topMenuList);
|
||||
rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
|
||||
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build());
|
||||
rightMenuList.add(MenuBtn.rightMenu_btnLog());
|
||||
btnDatas.put("rightMenu", rightMenuList);
|
||||
btnDatas.put("hasRight", HasRightUtil.hasRight(user, RIGHT_NAME, true));
|
||||
return btnDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTabForm(Map<String, Object> params) {
|
||||
String viewAttrStr = (String) params.get("viewAttr");
|
||||
OrganizationAssert.notBlank(viewAttrStr, "未指定操作类型,请确认");
|
||||
String id = Util.null2String(params.get("id"));
|
||||
OrganizationAssert.notBlank(id, "数据有误,请确认");
|
||||
int viewAttr = Integer.parseInt(viewAttrStr);
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
SearchConditionItem schemeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "等级方案", "161", "schemeId", "schemeBrowser");
|
||||
schemeId.setRules("required");
|
||||
SearchConditionItem gradeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职级", "161", "gradeId", "gradeBrowser");
|
||||
gradeId.setRules("required");
|
||||
SearchConditionItem levelId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职等", "162", "levelId", "levelBrowser");
|
||||
levelId.setRules("required");
|
||||
SearchConditionItem sequenceId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
||||
sequenceId.setRules("required");
|
||||
SearchConditionItem postId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务分类", "161", "postId", "postBrowser");
|
||||
postId.setRules("required");
|
||||
SearchConditionItem postInfoId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务信息", "161", "postInfoId", "postInfoBrowser");
|
||||
postInfoId.setRules("required");
|
||||
SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "分部", "164", "companyId", "");
|
||||
companyId.setRules("required");
|
||||
SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "部门", "4", "departmentId", "");
|
||||
departmentId.setRules("required");
|
||||
SearchConditionItem jobId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位", "161", "jobId", "jobBrowser");
|
||||
jobId.setRules("required");
|
||||
|
||||
|
||||
// 编辑状态下赋值操作
|
||||
HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(Long.parseLong(id));
|
||||
if (null != relationPO) {
|
||||
setBrowserValue(schemeId, relationPO.getSchemeId(), getSchemeMapper().listSchemesByIds(Stream.of(relationPO.getSchemeId()).collect(Collectors.toList())), null, null);
|
||||
setBrowserValue(gradeId, relationPO.getGradeId(), getGradeMapper().listGradessByIds(Stream.of(relationPO.getGradeId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId());
|
||||
setBrowserValue(levelId, relationPO.getLevelId(), getLevelMapper().listLevelsByIds(DeleteParam.builder().ids(relationPO.getLevelId()).build().getIds()), "grade_id", relationPO.getGradeId());
|
||||
setBrowserValue(sequenceId, relationPO.getSequenceId(), getSequenceMapper().listSequencesByIds(Stream.of(relationPO.getSequenceId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId());
|
||||
setBrowserValue(postId, relationPO.getPostId(), getPostMapper().listPostsByIds(Stream.of(relationPO.getPostId()).collect(Collectors.toList())), null, null);
|
||||
setBrowserValue(postInfoId, relationPO.getPostInfoId(), getPostInfoMapper().listPostInfosByIds(Stream.of(relationPO.getPostInfoId()).collect(Collectors.toList())), "post_id", relationPO.getPostId());
|
||||
|
||||
List<Map<String, Object>> companyMaps = new ArrayList<>();
|
||||
String scCompanyNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScCompanyNameById(relationPO.getCompanyId().toString());
|
||||
Map<String, Object> companyMap = new HashMap<>();
|
||||
companyMap.put(relationPO.getCompanyId().toString(), scCompanyNameById);
|
||||
companyMaps.add(companyMap);
|
||||
setBrowserValue(companyId, relationPO.getCompanyId(), companyMaps, null, null);
|
||||
|
||||
List<Map<String, Object>> departmentMaps = new ArrayList<>();
|
||||
String departmentNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(relationPO.getDepartmentId().toString());
|
||||
Map<String, Object> departmentMap = new HashMap<>();
|
||||
departmentMap.put(relationPO.getDepartmentId().toString(), departmentNameById);
|
||||
departmentMaps.add(departmentMap);
|
||||
setBrowserValue(departmentId, relationPO.getDepartmentId(), departmentMaps, "subcompany1", relationPO.getCompanyId());
|
||||
|
||||
setBrowserValue(jobId, relationPO.getJobId(), getJobMapper().listJobsByIds(Stream.of(relationPO.getJobId()).collect(Collectors.toList())), "departmentid", relationPO.getDepartmentId());
|
||||
}
|
||||
|
||||
addGroups.add(new SearchConditionGroup("岗职位体系", true, Stream.of(schemeId, gradeId, levelId, sequenceId, postId, postInfoId).collect(Collectors.toList())));
|
||||
addGroups.add(new SearchConditionGroup("组织机构", true, Stream.of(companyId, departmentId, jobId).collect(Collectors.toList())));
|
||||
HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
buttonsMap.put("hasEdit", true);
|
||||
buttonsMap.put("hasSave", true);
|
||||
apiDatas.put("buttons", buttonsMap);
|
||||
apiDatas.put("conditions", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long saveTabForm(HrmRelationSaveParam params) {
|
||||
HrmRelationPO hrmRelationPO = HrmRelationBO.convertSaveParamToPO(params);
|
||||
hrmRelationPO.setCreator((long) user.getUID());
|
||||
hrmRelationPO.setCreateTime(new Date());
|
||||
hrmRelationPO.setDeleteType(0);
|
||||
getHrmRelationMapper().insertIgnoreNull(hrmRelationPO);
|
||||
return hrmRelationPO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long updateTabForm(HrmRelationSaveParam params) {
|
||||
HrmRelationPO hrmRelationPO = HrmRelationBO.convertSaveParamToPO(params);
|
||||
// 判断新增OR更新
|
||||
HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(params.getId());
|
||||
if (null == relationPO) {
|
||||
hrmRelationPO.setCreator((long) user.getUID());
|
||||
hrmRelationPO.setCreateTime(new Date());
|
||||
hrmRelationPO.setDeleteType(0);
|
||||
getHrmRelationMapper().insertIgnoreNull(hrmRelationPO);
|
||||
} else {
|
||||
hrmRelationPO.setUpdateTime(new Date());
|
||||
getHrmRelationMapper().updateHrmRelation(hrmRelationPO);
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("update HrmResource set subcompanyid1 = " + params.getCompanyId() + " ,departmentid = " + params.getDepartmentId() + " ,jobtitle = " + params.getJobId() + " where id = " + params.getId());
|
||||
HrmFaceCheckManager.sync(params.getId().toString(), HrmFaceCheckManager.getOptUpdate(), "hrm_e9_HrmResourceBaseService_editResourceBase", HrmFaceCheckManager.getOaResource());
|
||||
return hrmRelationPO.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览按钮赋值
|
||||
*
|
||||
* @param browserItem
|
||||
* @param browserValue
|
||||
* @param maps
|
||||
*/
|
||||
private void setBrowserValue(SearchConditionItem browserItem, Object browserValue, List<Map<String, Object>> maps, String relateField, Object relatedValue) {
|
||||
browserItem.setValue(browserValue);
|
||||
BrowserBean browserBean = browserItem.getBrowserConditionParam();
|
||||
browserBean.setReplaceDatas(maps);
|
||||
browserItem.setBrowserConditionParam(browserBean);
|
||||
|
||||
if (StringUtils.isNotBlank(relateField) && 1 != browserItem.getViewAttr()) {
|
||||
long l = System.currentTimeMillis();
|
||||
Map<String, Object> completeParams = browserBean.getCompleteParams();
|
||||
completeParams.put("currenttime", l);
|
||||
completeParams.put(relateField + "_" + l, relatedValue);
|
||||
Map<String, Object> conditionDataParams = browserBean.getConditionDataParams();
|
||||
conditionDataParams.put("currenttime", l);
|
||||
conditionDataParams.put(relateField + "_" + l, relatedValue);
|
||||
Map<String, Object> dataParams = browserBean.getDataParams();
|
||||
dataParams.put("currenttime", l);
|
||||
dataParams.put(relateField + "_" + l, relatedValue);
|
||||
Map<String, Object> destDataParams = browserBean.getDestDataParams();
|
||||
destDataParams.put("currenttime", l);
|
||||
destDataParams.put(relateField + "_" + l, relatedValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String buildSqlWhere(HrmResourceSearchParam params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where 1=1 ";
|
||||
String lastName = params.getLastName();
|
||||
if (StringUtils.isNotBlank(lastName)) {
|
||||
sqlWhere += " AND t.last_name " + dbType.like(lastName);
|
||||
}
|
||||
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 + "'";
|
||||
}
|
||||
Long ecCompany = params.getEcCompany();
|
||||
if (null != ecCompany) {
|
||||
sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
|
||||
}
|
||||
Long ecDepartment = params.getEcDepartment();
|
||||
if (null != ecDepartment) {
|
||||
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
|
||||
}
|
||||
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);
|
||||
}
|
||||
Long jobTitle = params.getJobTitle();
|
||||
if (null != jobTitle) {
|
||||
sqlWhere += " AND t.job_title = '" + jobTitle + "'";
|
||||
}
|
||||
|
||||
// 分权查询
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
String parentCompanyIds = detachUtil.getJclRoleLevels();
|
||||
if (detachUtil.isDETACH()) {
|
||||
sqlWhere += " And t.company_id in(" + parentCompanyIds + ")";
|
||||
}
|
||||
|
||||
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);
|
||||
new DetachUtil(user.getUID()).filterJobList(jobPOS);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
// 添加父级岗位
|
||||
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)) {
|
||||
// 兼容SQLServer每次最多in,2100条数据
|
||||
List<Long> ids = (List<Long>) DeleteParam.builder().ids(parentDeptS).build().getIds();
|
||||
int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
|
||||
List<DepartmentPO> departmentsByIds = new ArrayList<>();
|
||||
for (int i = 1; i < ceilCount + 1; i++) {
|
||||
List<Long> longs = PageUtil.subList(i, 1000, ids);
|
||||
List<DepartmentPO> departmentsById = getDepartmentMapper().getDeptsByIds(longs);
|
||||
if (CollectionUtils.isNotEmpty(departmentsById)) {
|
||||
departmentsByIds.addAll(departmentsById);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
|
||||
filterDeparts.addAll(departmentsByIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
List<SearchTree> departmentList = DepartmentBO.buildSetToSearchTree(builderDeparts, false);
|
||||
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(departmentList);
|
||||
List<SearchTree> searchTrees = SearchTreeUtil.builderTreeMode(departmentList, jobTrees);
|
||||
// 添加部门的上级分部
|
||||
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);
|
||||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps,allMaps);
|
||||
}
|
||||
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, "show_order");
|
||||
// 添加父级岗位
|
||||
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)) {
|
||||
// 兼容SQLServer每次最多in,2100条数据
|
||||
List<Long> ids = (List<Long>) DeleteParam.builder().ids(parentDeptS).build().getIds();
|
||||
int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
|
||||
List<DepartmentPO> departmentsByIds = new ArrayList<>();
|
||||
for (int i = 0; i < ceilCount - 1; i++) {
|
||||
List<DepartmentPO> departmentsById = getDepartmentMapper().getDeptsByIds(PageUtil.subList(i, 1000, ids));
|
||||
if (CollectionUtils.isNotEmpty(departmentsById)) {
|
||||
departmentsByIds.addAll(departmentsById);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
|
||||
filterDeparts.addAll(departmentsByIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询分部信息
|
||||
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,Map<Long, CompPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
if (null != parentComp) {
|
||||
buildParentComps(parentComp, builderComps,allMaps);
|
||||
}
|
||||
}
|
||||
|
||||
private void completeParams(Map<String, Object> params) {
|
||||
String jobId = Util.null2String(params.get("job_title"));
|
||||
if (StringUtils.isNotBlank(jobId)) {
|
||||
JobPO jobById = getJobMapper().getJobById(Long.parseLong(jobId));
|
||||
params.put("department_id", jobById.getParentDept());
|
||||
params.put("company_id", jobById.getParentComp());
|
||||
params.put("ec_department", jobById.getEcDepartment());
|
||||
params.put("ec_company", jobById.getEcCompany());
|
||||
// 等级方案、岗位序列、职等、职级
|
||||
params.put("scheme_id", jobById.getSchemeId());
|
||||
params.put("sequence_id", jobById.getSequenceId());
|
||||
params.put("job_level", jobById.getLevelId());
|
||||
params.put("job_grade", jobById.getGradeId());
|
||||
String showOrder = Util.null2String(params.get("show_order"));
|
||||
// 初始化排序字段
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Long orderNum = getHrmResourceMapper().getMaxShowOrder();
|
||||
params.put("show_order", null == orderNum ? 1 : orderNum + 1);
|
||||
}
|
||||
|
||||
// 人员状态
|
||||
String status = Util.null2String(params.get("status"));
|
||||
if(StringUtils.isBlank(status)){
|
||||
params.put("status", "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断编号是否重复
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String repeatDetermine(String workCode) {
|
||||
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.USER.getValue());
|
||||
if (StringUtils.isNotBlank(workCode)) {
|
||||
workCode = CodeRuleUtil.generateCode(RuleCodeType.USER, workCode);
|
||||
List<HrmResourcePO> list = getResourceMapper().listByNo(Util.null2String(workCode));
|
||||
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
||||
} else {
|
||||
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
|
||||
workCode = autoCreateWorkCode();
|
||||
}
|
||||
}
|
||||
return workCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动编号处理
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static String autoCreateWorkCode() {
|
||||
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.USER, "");
|
||||
List<HrmResourcePO> list = getResourceMapper().listByNo(Util.null2String(generateCode));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
generateCode = autoCreateWorkCode();
|
||||
}
|
||||
return generateCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,10 +16,10 @@ import com.engine.organization.entity.extend.ExtendInfoOperateType;
|
|||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
|
||||
import com.engine.organization.entity.jclimport.po.CusFormFieldPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
|
||||
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.enums.OrgImportEnum;
|
||||
|
|
@ -27,18 +27,22 @@ import com.engine.organization.mapper.comp.CompMapper;
|
|||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.ImportCommonService;
|
||||
import com.engine.organization.thread.*;
|
||||
import com.engine.organization.thread.CompanyTriggerRunnable;
|
||||
import com.engine.organization.thread.DepartmentTriggerRunnable;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.excel.ExcelUtil;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
|
||||
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
|
|
@ -46,11 +50,13 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
|
|||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.file.FileUploadToPath;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
import weaver.join.hrm.in.HrmResourceVo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -79,7 +85,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
private static final String RIGHT_NAME = "DataImport:All";
|
||||
private static final String HRM_COMPANY = "hrmsubcompany";
|
||||
private static final String HRM_DEPARTMENT = "hrmdepartment";
|
||||
private static final String HRM_RESOURCE = "hrmresource";
|
||||
|
||||
|
||||
private ExtendInfoMapper getExtendInfoMapper() {
|
||||
|
|
@ -120,11 +125,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
break;
|
||||
case "resource":
|
||||
extendType = "4";
|
||||
tableName = "JCL_ORG_HRMRESOURCE";
|
||||
excludeFields.add("scheme_id");
|
||||
excludeFields.add("sequence_id");
|
||||
excludeFields.add("job_grade");
|
||||
excludeFields.add("job_level");
|
||||
tableName = "hrmResource";
|
||||
break;
|
||||
default:
|
||||
errorMsg = "未找到对应的导入类型,请确认";
|
||||
|
|
@ -138,14 +139,42 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return returnMaps;
|
||||
}
|
||||
|
||||
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
|
||||
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
|
||||
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
|
||||
//fieldDatas.addAll(0, includeFields);
|
||||
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
|
||||
//selectedKeys.addAll(0, selectedList);
|
||||
returnMaps.put("data", fieldDatas);
|
||||
returnMaps.put("selectedKeys", selectedKeys);
|
||||
if ("4".equals(extendType)) {
|
||||
String voField = "subcompanyid1,departmentid," +
|
||||
"workcode,lastname,loginid,password,seclevel,sex," +
|
||||
// "jobtitle,jobactivity,jobgroupid,jobcall,joblevel," +
|
||||
"jobactivitydesc,managerid,assistantid,status," +
|
||||
"workroom,locationid,telephone,mobile,mobilecall," +
|
||||
"fax,email,systemlanguage,birthday,folk," +
|
||||
"nativeplace,regresidentplace,certificatenum," +
|
||||
"maritalstatus,policy,bememberdate,bepartydate," +
|
||||
"islabouunion,educationlevel,degree,healthinfo,height," +
|
||||
"weight,usekind,startdate,enddate,probationenddate," +
|
||||
"residentplace,homeaddress,tempresidentnumber," +
|
||||
"companystartdate,workstartdate," +
|
||||
"accumfundaccount,accounttype,belongto,height,weight,accountname,bankid1,accountid1," +
|
||||
"telephone,dsporder,classification";
|
||||
Collection<String> hrmFields = Arrays.asList(voField.split(","));
|
||||
// 获取人员表单字段
|
||||
List<CusFormFieldPO> hrmFieldBeanList = getSystemDataMapper().getHrmFieldBeanListByFields(hrmFields);
|
||||
List<CusFormFieldPO> customFieldList = getSystemDataMapper().getHrmCustomFieldList();
|
||||
List<CusFormFieldPO> mergeList = new ArrayList<>();
|
||||
mergeList.addAll(hrmFieldBeanList);
|
||||
mergeList.addAll(customFieldList);
|
||||
|
||||
List<FieldTransferParam> fieldDatas = mergeList.stream().map(item -> FieldTransferParam.builder().id(item.getScopeId() + item.getTableName() + item.getFieldId()).name(item.getFieldLabel()).build()).collect(Collectors.toList());
|
||||
List<String> selectedKeys = mergeList.stream().filter(item -> ("1".equals(item.getRequired()) || "workcode".equals(item.getFieldName()) || "subcompanyid1".equals(item.getFieldName()) || "departmentid".equals(item.getFieldName()))).map(item -> item.getScopeId() + item.getTableName() + item.getFieldId()).collect(Collectors.toList());
|
||||
|
||||
returnMaps.put("data", fieldDatas);
|
||||
returnMaps.put("selectedKeys", selectedKeys);
|
||||
} else {
|
||||
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
|
||||
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
|
||||
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
|
||||
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
|
||||
returnMaps.put("data", fieldDatas);
|
||||
returnMaps.put("selectedKeys", selectedKeys);
|
||||
}
|
||||
|
||||
return returnMaps;
|
||||
}
|
||||
|
|
@ -203,29 +232,25 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
returnMap.put("pId", jobImport(operateType, excelFile));
|
||||
break;
|
||||
case "resource":
|
||||
//Long importHistoryId = saveImportLog("resource", operateType);
|
||||
//HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9();
|
||||
//FileUploadToPath fu = new FileUploadToPath(request);
|
||||
//
|
||||
//List<String> errorInfo = importAdapt.creatImportMap(fu);
|
||||
//
|
||||
////如果读取数据和验证模板没有发生错误
|
||||
//if (errorInfo.isEmpty()) {
|
||||
// Map<String, HrmResourceVo> hrMap = importAdapt.getHrmImportMap();
|
||||
//
|
||||
// HrmImportProcessE9 importProcess = new HrmImportProcessE9();
|
||||
// importProcess.init(request, importHistoryId);
|
||||
//
|
||||
//
|
||||
// importProcess.processMap(hrMap);
|
||||
//} else {
|
||||
// for (String s : errorInfo) {
|
||||
// MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(s)).status("0").build());
|
||||
// }
|
||||
//}
|
||||
//returnMap.put("pId", importHistoryId);
|
||||
Long importHistoryId = saveImportLog("resource", operateType);
|
||||
HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9();
|
||||
FileUploadToPath fu = new FileUploadToPath(request);
|
||||
|
||||
returnMap.put("pId", hrmResourceImport(operateType, excelFile,keyField));
|
||||
List<String> errorInfo = importAdapt.creatImportMap(fu);
|
||||
|
||||
//如果读取数据和验证模板没有发生错误
|
||||
if (errorInfo.isEmpty()) {
|
||||
Map<String, HrmResourceVo> hrMap = importAdapt.getHrmImportMap();
|
||||
|
||||
HrmImportProcessE9 importProcess = new HrmImportProcessE9();
|
||||
importProcess.init(request, importHistoryId);
|
||||
importProcess.processMap(hrMap);
|
||||
} else {
|
||||
for (String s : errorInfo) {
|
||||
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(s)).status("0").build());
|
||||
}
|
||||
}
|
||||
returnMap.put("pId", importHistoryId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -480,11 +505,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
|
||||
//重复验证字段
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("last_name", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("work_code", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
|
||||
//statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("lastname", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("workcode", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
|
||||
statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24638, "keyField", statusOptions);
|
||||
searchConditionItem.setValue("last_name");
|
||||
searchConditionItem.setValue("lastname");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//导入类型
|
||||
|
|
@ -1199,252 +1224,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return importHistoryId;
|
||||
}
|
||||
|
||||
private Long hrmResourceImport(String operateType, String excelFile, String keyField) {
|
||||
Long importHistoryId = saveImportLog("resource", operateType);
|
||||
JclImportHistoryDetailPO historyDetailPO;
|
||||
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(Util.getIntValue(excelFile));
|
||||
XSSFWorkbook workbook;
|
||||
try {
|
||||
workbook = new XSSFWorkbook(manager.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 当前sheet
|
||||
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
|
||||
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
|
||||
|
||||
// 遍历每一行数据
|
||||
nextRow:
|
||||
for (int i = 0; i <= lastRow; i++) {
|
||||
historyDetailPO = new JclImportHistoryDetailPO();
|
||||
historyDetailPO.setPid(importHistoryId);
|
||||
XSSFRow row = sheetAt.getRow(i);
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Long parentCompanyId = null;
|
||||
Long parentDepartmentId = null;
|
||||
Long parentJobId = null;
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
||||
XSSFCell cell = row.getCell((short) cellIndex);
|
||||
String cellValue = getCellValue(cell).trim();
|
||||
if (i == 0) {
|
||||
// 首行 初始化字段信息
|
||||
ExtendInfoPO extendInfoPO = getExtendInfoMapper().getInfoByExtendAndLabelName(RESOURCE_TYPE, cellValue);
|
||||
extendInfoPOS.add(extendInfoPO);
|
||||
} else {
|
||||
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
||||
// 数据校验
|
||||
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
|
||||
Object reallyValue;
|
||||
try {
|
||||
reallyValue = getReallyValue(infoPO, cellValue);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "转换失败");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName()) && !"ec_department".equals(infoPO.getFieldName()) && !"job_title".equals(infoPO.getFieldName())) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
map.put(infoPO.getFieldName(), reallyValue);
|
||||
// 上级分部
|
||||
if ("ec_company".equals(infoPO.getFieldName())) {
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("分部层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ("ec_department".equals(infoPO.getFieldName())) {
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("部门层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentDepartmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
|
||||
if (null == parentDepartmentId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "部门未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ("job_title".equals(infoPO.getFieldName())) {
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("岗位层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
|
||||
if (null == parentJobId) {
|
||||
historyDetailPO.setOperateDetail(s + "岗位未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("company_id", parentCompanyId);
|
||||
map.put("department_id", parentDepartmentId);
|
||||
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId)));
|
||||
if (null != parentDepartmentId) {
|
||||
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
|
||||
}
|
||||
map.put("job_title", parentJobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 校验、数据交互
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
// 根据岗位获取等级方案、岗位序列、职等、职级
|
||||
if (null != parentJobId) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(parentJobId);
|
||||
map.put("scheme_id", jobById.getSchemeId());
|
||||
map.put("sequence_id", jobById.getSequenceId());
|
||||
map.put("job_level", jobById.getLevelId());
|
||||
map.put("job_grade", jobById.getGradeId());
|
||||
}
|
||||
|
||||
String keyFieldValue = Util.null2String(map.get(keyField));
|
||||
if(StringUtils.isBlank(keyFieldValue)){
|
||||
historyDetailPO.setOperateDetail("所选重复验证字段为空");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
historyDetailPO.setRelatedName(keyFieldValue);
|
||||
|
||||
// 判断当前人员是否存在
|
||||
Long resourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getIdByKeyField(keyField, keyFieldValue);
|
||||
if ("add".equals(operateType)) {
|
||||
if (resourceId != null) {
|
||||
historyDetailPO.setOperateDetail(keyFieldValue+"已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 自动编号
|
||||
String workCode = Util.null2String(map.get("work_code"));
|
||||
try {
|
||||
// 自动编号
|
||||
workCode = HrmResourceServiceImpl.repeatDetermine(workCode);
|
||||
map.put("work_code", workCode);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(e.getMessage()));
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
map.put("creator", user.getUID());
|
||||
map.put("delete_type", 0);
|
||||
map.put("create_time", new Date());
|
||||
|
||||
String showOrder = Util.null2String(map.get("show_order"));
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Long maxShowOrder = MapperProxyFactory.getProxy(HrmResourceMapper.class).getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0L;
|
||||
}
|
||||
map.put("show_order", maxShowOrder + 1);
|
||||
}
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.ADD, map, false).sync();
|
||||
if (isThrowError(syncMap) && StringUtils.isNotBlank(Util.null2String(syncMap.get("id")))) {
|
||||
String ecResourceId = Util.null2String(syncMap.get("id"));
|
||||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId);
|
||||
map.put("uuid", recordInfo.getUuid());
|
||||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_HRMRESOURCE").params(map).build();
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 更新组织架构图
|
||||
new HrmResourceTriggerRunnable(infoParams.getId()).run();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
} else if ("update".equals(operateType)) {
|
||||
// 查询对应ID
|
||||
if (resourceId == null) {
|
||||
historyDetailPO.setOperateDetail("未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
map.put("update_time", new Date());
|
||||
map.put("id", resourceId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(resourceId).tableName("JCL_ORG_HRMRESOURCE").params(map).build());
|
||||
// 更新组织架构图
|
||||
new HrmResourceTriggerRunnable(resourceId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取表格文本内容
|
||||
|
|
@ -1498,7 +1277,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
} else {
|
||||
try {
|
||||
object = new BigDecimal(cellValue).toPlainString();
|
||||
}catch (NumberFormatException ignore){
|
||||
} catch (NumberFormatException ignore) {
|
||||
object = cellValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -1600,7 +1379,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
iterator.remove();
|
||||
}
|
||||
|
||||
if ("所属部门".equals(column) || "上级部门".equals(column)) {
|
||||
if ("所属部门".equals(column) || "上级部门".equals(column) || "部门".equals(column)) {
|
||||
departmentColumn = column;
|
||||
iterator.remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.engine.organization.entity.department.bo.DepartmentBO;
|
|||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.employee.vo.EmployeeTableVO;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.bo.JobBO;
|
||||
import com.engine.organization.entity.job.dto.JobListDTO;
|
||||
import com.engine.organization.entity.job.param.JobMergeParam;
|
||||
|
|
@ -40,7 +39,6 @@ import com.engine.organization.mapper.extend.ExtMapper;
|
|||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.service.JobService;
|
||||
|
|
@ -50,7 +48,6 @@ import com.engine.organization.thread.OrganizationSyncEc;
|
|||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.coderule.CodeRuleUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.page.Column;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.page.PageUtil;
|
||||
|
|
@ -129,9 +126,6 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private ResourceMapper getResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(ResourceMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
|
|
@ -165,12 +159,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
PageInfo<JobListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
|
||||
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
|
||||
new DetachUtil(user.getUID()).filterJobDTOList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterJobDTOList(allList);
|
||||
// 添加父级元素
|
||||
List<JobListDTO> jobListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs);
|
||||
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), jobListDTOS);
|
||||
|
|
@ -523,7 +515,16 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
@Override
|
||||
public Map<String, Object> getHrmListByJobId(Long jobId) {
|
||||
OrganizationWeaTable<EmployeeTableVO> table = new OrganizationWeaTable<>(user, EmployeeTableVO.class);
|
||||
table.setSqlwhere(" where job_title = '" + jobId + "' and status<4");
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> ids = new ArrayList<>();
|
||||
rs.executeQuery("select id from cus_fielddata where field100002 = ?", jobId);
|
||||
while (rs.next()) {
|
||||
ids.add(Util.null2String(rs.getString("id")));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
ids.add("-1");
|
||||
}
|
||||
table.setSqlwhere(" where id in (" + StringUtils.join(ids, ",") + ") and status<4");
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
|
|
@ -689,10 +690,8 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) {
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
|
|
@ -707,7 +706,6 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
|
|
@ -880,18 +878,15 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新岗位下的人员
|
||||
Long originalJobId = originalJob.getId();
|
||||
Long targetJobId = targetJob.getId();
|
||||
Long parentComp = targetJob.getParentComp();
|
||||
Long parentDept = targetJob.getParentDept();
|
||||
Long ecCompany = targetJob.getEcCompany();
|
||||
Long ecDepartment = targetJob.getEcDepartment();
|
||||
List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId);
|
||||
getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment);
|
||||
|
||||
// 更新Ec人员分部、部门、岗位
|
||||
for (HrmResourcePO hrmResourcePO : resourceList) {
|
||||
new RecordSet().executeUpdate("UPDATE HRMRESOURCE SET SUBCOMPANYID1 = ? , DEPARTMENTID = ? WHERE UUID =? ", ecCompany, ecDepartment, hrmResourcePO.getUuid());
|
||||
// 更新人员Map表信息
|
||||
new HrmResourceTriggerRunnable(hrmResourcePO.getId()).run();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(!originalJobId.equals(targetJobId)){
|
||||
rs.executeUpdate("update cus_fielddata set field100002 = ? where scope = 'hrmcustomfieldbyinfotype' and scopeid = -1 and field100002 = ?", targetJobId, originalJobId);
|
||||
}
|
||||
rs.executeQuery("select id from cus_fielddata where scope = 'hrmcustomfieldbyinfotype' and scopeid = -1 and field100002 = ?",targetJobId);
|
||||
while (rs.next()) {
|
||||
Long resourceId = Long.parseLong(rs.getString("id"));
|
||||
new HrmResourceTriggerRunnable(resourceId).run();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,192 +0,0 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
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.detach.param.ManagerDetachParam;
|
||||
import com.engine.organization.entity.detach.po.ManagerDetachPO;
|
||||
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
|
||||
import com.engine.organization.mapper.detach.ManagerDetachMapper;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.service.ManagerDetachService;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.weaver.file.ConfigOperator;
|
||||
import com.weaver.general.BaseBean;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ManagerDetachServiceImpl extends Service implements ManagerDetachService {
|
||||
|
||||
|
||||
private static final String RIGHT_NAME = "MangerDeatch:All";
|
||||
|
||||
public ManagerDetachMapper getMangeDetachMapper() {
|
||||
return MapperProxyFactory.getProxy(ManagerDetachMapper.class);
|
||||
}
|
||||
|
||||
public HrmResourceMapper getHrmResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
public EmployeeMapper getEmployeeMapper() {
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class);
|
||||
}
|
||||
|
||||
public SystemDataMapper getSystemDataMapper(){
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
||||
resultMap.put("hasRight", hasRight);
|
||||
if (!hasRight) {
|
||||
return resultMap;
|
||||
}
|
||||
String detach = new BaseBean().getPropValue("hrmOrganization", "detach");
|
||||
resultMap.put("isDetach",detach);
|
||||
OrganizationWeaTable<ManagerDetachVO> table = new OrganizationWeaTable<>(user, ManagerDetachVO.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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getForm(Integer id) {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionItem> selectItems = new ArrayList<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
||||
SearchConditionOption moduleOption = new SearchConditionOption("0", "组织管理",true);
|
||||
selectOptions.add(moduleOption);
|
||||
|
||||
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, "管理员", "1", "ecManager", "");
|
||||
ecManager.setRules("required|string");
|
||||
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "可维护机构", "194", "ecRolelevel", "");
|
||||
ecRolelevel.setRules("required|string");
|
||||
SearchConditionItem module = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "可管理模块", "module");
|
||||
module.setViewAttr(1);
|
||||
module.setDetailtype(2);
|
||||
module.setHasBorder(true);
|
||||
if (id != null) {
|
||||
ManagerDetachPO detachById = getMangeDetachMapper().getDetachById(id);
|
||||
BrowserBean manager = ecManager.getBrowserConditionParam();
|
||||
manager.setReplaceDatas(getEmployeeMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcManager())).build().getIds()));
|
||||
ecManager.setBrowserConditionParam(manager);
|
||||
BrowserBean roleLevel = ecRolelevel.getBrowserConditionParam();
|
||||
roleLevel.setReplaceDatas(getSystemDataMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcRolelevel())).build().getIds()));
|
||||
ecRolelevel.setBrowserConditionParam(roleLevel);
|
||||
}
|
||||
selectItems.add(ecManager);
|
||||
selectItems.add(ecRolelevel);
|
||||
selectItems.add(module);
|
||||
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
||||
apiDatas.put("condition", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
return getMangeDetachMapper().deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(ManagerDetachParam param) {
|
||||
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||
.managerType(0)
|
||||
.ecManager(param.getEcManager())
|
||||
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
||||
.ecRolelevel(param.getEcRolelevel())
|
||||
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
|
||||
.manageModule("组织管理")
|
||||
.creator((long)user.getUID())
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
|
||||
return getMangeDetachMapper().insertIgnoreNull(managerDetachPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDetach(ManagerDetachParam param) {
|
||||
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||
.id(param.getId())
|
||||
.ecManager(param.getEcManager())
|
||||
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
||||
.ecRolelevel(param.getEcRolelevel())
|
||||
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
|
||||
.build();
|
||||
return getMangeDetachMapper().updateDetach(managerDetachPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String doDetach(String isDetach) {
|
||||
ConfigOperator ConfigOperator = new ConfigOperator();
|
||||
ConfigOperator.setProp("hrmOrganization.properties", "detach", isDetach);
|
||||
return new BaseBean().getPropValue("hrmOrganization", "detach");
|
||||
}
|
||||
|
||||
private String buildSqlWhere(Map<String, Object> params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where delete_type = 0";
|
||||
String lastName = (String) params.get("ecManager");
|
||||
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
|
||||
String ecManager = StringUtils.join(resourceIds,",");
|
||||
if (StringUtils.isNotBlank(lastName)) {
|
||||
sqlWhere += " AND ec_manager in ("+ecManager+") ";
|
||||
}
|
||||
String ecRolelevel = (String) params.get("ecRolelevel");
|
||||
if (StringUtils.isNotBlank(ecRolelevel)) {
|
||||
sqlWhere += " AND " + dbType.concat("ec_rolelevel") + dbType.like(ecRolelevel);
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前人员所辖分部JCL_ID
|
||||
* @param uId
|
||||
* @return
|
||||
*/
|
||||
public static List<Long> getJclRoleLevels(Integer uId) {
|
||||
List<Long> ecRoleLevels = new ArrayList<>();
|
||||
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
|
||||
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
|
||||
for (ManagerDetachPO managerDetachPO : detachListById) {
|
||||
List<Long> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
ecRoleLevels.addAll(ids);
|
||||
}
|
||||
}
|
||||
return ecRoleLevels;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,17 +3,19 @@ package com.engine.organization.service.impl;
|
|||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.scheme.po.GradePO;
|
||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.service.OrgChartService;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -52,16 +54,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
String sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) order by ftype , id ";
|
||||
|
||||
// 分部分权过滤
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
String jclRoleLevels = detachUtil.getJclRoleLevels();
|
||||
if (StringUtils.isNotBlank(jclRoleLevels)) {
|
||||
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) order by ftype , id";
|
||||
} else {
|
||||
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype = 0 order by ftype , id";
|
||||
}
|
||||
}
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String, Object>> companylist = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
|
|
@ -165,16 +157,8 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
if ("0".equals(id)) {
|
||||
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
|
||||
} else {
|
||||
sql += " and fparentid = " + id + " and ftype !=1";
|
||||
}
|
||||
} else {
|
||||
sql += " and fparentid = " + id;
|
||||
}
|
||||
sql += " and fparentid = " + id;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
|
|
@ -258,7 +242,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
// 获取根节点
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst, t.fecid, t.fisvitual from jcl_org_map t " + whereSql + whereItemSql);
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fleaderjobid, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst, t.fecid, t.fisvitual from jcl_org_map t " + whereSql + whereItemSql);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
String id = null;
|
||||
if (rs.next()) {
|
||||
|
|
@ -270,9 +254,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("parentId", null);
|
||||
item.put("fleadername", rs.getString("fleadername"));
|
||||
item.put("fleaderimg", rs.getString("fleaderimg"));
|
||||
item.put("fleaderjob", rs.getString("fleaderjob"));
|
||||
item.put("fplan", rs.getString("fplan"));
|
||||
item.put("fonjob", rs.getString("fonjob"));
|
||||
// 转换岗位
|
||||
//item.put("fleaderjob", convertJobNameById(rs.getString("fleaderjobid")));
|
||||
item.put("fleaderjob",rs.getString("fleaderjob"));
|
||||
item.put("fplan", StringUtils.isNotEmpty(rs.getString("fplan")) ? rs.getString("fplan") : "0");
|
||||
item.put("fonjob", StringUtils.isNotEmpty(rs.getString("fonjob")) ? rs.getString("fonjob") : "0");
|
||||
item.put("hasChildren", hasChildren(rs.getString("id"), false));
|
||||
item.put("expand", "1");
|
||||
item.put("fnumber", rs.getString("fnumber"));
|
||||
|
|
@ -304,7 +290,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
whereSql += " and fparentid in (" + ids + ") ";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t " + whereSql);
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fleaderjobid, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t " + whereSql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
|
|
@ -314,9 +300,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("parentId", rs.getString("fparentid"));
|
||||
item.put("fleadername", rs.getString("fleadername"));
|
||||
item.put("fleaderimg", rs.getString("fleaderimg"));
|
||||
item.put("fleaderjob", rs.getString("fleaderjob"));
|
||||
item.put("fplan", rs.getString("fplan"));
|
||||
item.put("fonjob", rs.getString("fonjob"));
|
||||
// 转换岗位
|
||||
//item.put("fleaderjob", convertJobNameById(rs.getString("fleaderjobid")));
|
||||
item.put("fleaderjob",rs.getString("fleaderjob"));
|
||||
item.put("fplan", StringUtils.isNotEmpty(rs.getString("fplan")) ? rs.getString("fplan") : "0");
|
||||
item.put("fonjob", StringUtils.isNotEmpty(rs.getString("fonjob")) ? rs.getString("fonjob") : "0");
|
||||
item.put("fnumber", rs.getString("fnumber"));
|
||||
item.put("hasChildren", hasChildren(rs.getString("id"), false));
|
||||
item.put("fleader", rs.getString("fleader"));
|
||||
|
|
@ -327,21 +315,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
currentList.add(item);
|
||||
}
|
||||
|
||||
//for (Map<String, Object> stringObjectMap : currentList) {
|
||||
// if ("4".equals(stringObjectMap.get("ftype"))) { // 员工信息
|
||||
// rs.executeQuery("select id, mobile, home_address from jcl_org_hrmresource where id = ? ", stringObjectMap.get("fobjid"));
|
||||
// if (rs.next()) {
|
||||
// stringObjectMap.put("mobile", rs.getString("mobile"));
|
||||
// stringObjectMap.put("address", rs.getString("home_address"));
|
||||
// }
|
||||
// rs.executeQuery("select dept_name from jcl_org_hrmresource hrm left join jcl_org_dept d on hrm.department_id = d.id where hrm.id =? ", stringObjectMap.get("fobjid"));
|
||||
// if (rs.next()) {
|
||||
// stringObjectMap.put("department", rs.getString("dept_name"));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("api_status", true);
|
||||
result.put("data", currentList);
|
||||
|
|
@ -379,17 +352,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
|
||||
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
if ("0".equals(id)) {
|
||||
sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
|
||||
} else {
|
||||
sql += " and t.fparentid = " + id + " and t.ftype !=1";
|
||||
}
|
||||
} else {
|
||||
sql += " and t.fparentid = " + id;
|
||||
}
|
||||
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fleaderjobid, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql;
|
||||
sql += " and t.fparentid = " + id;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
|
|
@ -401,9 +366,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("fobjparentId", rs.getString("fobjparentid"));
|
||||
item.put("fleadername", rs.getString("fleadername"));
|
||||
item.put("fleaderimg", rs.getString("fleaderimg"));
|
||||
item.put("fleaderjob", rs.getString("fleaderjob"));
|
||||
item.put("fplan", rs.getString("fplan"));
|
||||
item.put("fonjob", rs.getString("fonjob"));
|
||||
// 转换岗位
|
||||
//item.put("fleaderjob", convertJobNameById(rs.getString("fleaderjobid")));
|
||||
item.put("fleaderjob",rs.getString("fleaderjob"));
|
||||
item.put("fplan", StringUtils.isNotEmpty(rs.getString("fplan")) ? rs.getString("fplan") : "0");
|
||||
item.put("fonjob", StringUtils.isNotEmpty(rs.getString("fonjob")) ? rs.getString("fonjob") : "0");
|
||||
item.put("fnumber", rs.getString("fnumber"));
|
||||
item.put("expand", expand ? "1" : "0");
|
||||
item.put("fobjid", rs.getString("fobjid"));
|
||||
|
|
@ -503,4 +470,21 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String convertJobNameById(String jobId) {
|
||||
String jobName = "";
|
||||
if (StringUtils.isNotBlank(jobId)) {
|
||||
try {
|
||||
Long id = Long.parseLong(jobId);
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(id);
|
||||
if (null != jobById) {
|
||||
jobName = jobById.getJobName();
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
new BaseBean().writeLog("组织架构图,岗位转换异常", e);
|
||||
}
|
||||
}
|
||||
return jobName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.personnelcard.User;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
|
|
@ -61,6 +59,7 @@ public class CompanyTriggerRunnable implements Runnable {
|
|||
jclMap.setUuid(newCompany.getUuid());
|
||||
jclMap.setFNumber(newCompany.getCompNo());
|
||||
jclMap.setFName(newCompany.getCompName());
|
||||
jclMap.setFLeader(newCompany.getCompPrincipal());
|
||||
jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
|
||||
jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
|
||||
jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid()));
|
||||
|
|
@ -68,26 +67,22 @@ public class CompanyTriggerRunnable implements Runnable {
|
|||
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
HrmResource hrmResourceById = getCompTriggerMapper().getHrmResourceById(jclMap.getFLeader());
|
||||
|
||||
Integer ecResourceId = newCompany.getCompPrincipal();
|
||||
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
|
||||
if (null != hrmResourcePO) {
|
||||
jclMap.setFLeader(hrmResourcePO.getId().intValue());
|
||||
jclMap.setFLeaderName(hrmResourcePO.getLastName());
|
||||
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
|
||||
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
|
||||
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
|
||||
String image = User.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
|
||||
jclMap.setFLeaderImg(image);
|
||||
if (null != hrmResourcePO.getJobTitle()) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
|
||||
if (null != jobById) {
|
||||
jclMap.setFLeaderJob(jobById.getJobName());
|
||||
}
|
||||
}
|
||||
|
||||
if (null != hrmResourceById) {
|
||||
jclMap.setFLeaderImg(hrmResourceById.getMessagerurl());
|
||||
jclMap.setFLeaderName(hrmResourceById.getLastname());
|
||||
jclMap.setFLeaderJobId(hrmResourceById.getJobtitle());
|
||||
}
|
||||
|
||||
jclMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclMap.getFLeaderJobId()));
|
||||
|
||||
CusFieldData cusFieldDataById = getCompTriggerMapper().getCusFieldDataById(jclMap.getFLeader());
|
||||
if (null != cusFieldDataById) {
|
||||
jclMap.setFLeaderSt(cusFieldDataById.getField100008());
|
||||
jclMap.setFLeaderLv(cusFieldDataById.getField100007());
|
||||
}
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.logview.bo.FieldBaseEquator;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.personnelcard.User;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.mapper.trigger.DepartmentTriggerMapper;
|
||||
|
|
@ -19,6 +16,7 @@ import com.engine.organization.util.db.MapperProxyFactory;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
|
|
@ -50,7 +48,7 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|||
this.newDepartment = newDepartment;
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
||||
public DepartmentTriggerRunnable(Boolean forbiddenTag, DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
||||
this.oldDepartment = oldDepartment;
|
||||
this.newDepartment = newDepartment;
|
||||
this.forbiddenTag = forbiddenTag;
|
||||
|
|
@ -61,7 +59,7 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|||
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
|
||||
public DepartmentTriggerRunnable(String moveTarget, DepartmentPO newDepartment) {
|
||||
this.oldDepartment = new DepartmentPO();
|
||||
this.newDepartment = newDepartment;
|
||||
this.moveTarget = moveTarget;
|
||||
|
|
@ -87,101 +85,98 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|||
}
|
||||
|
||||
// 判断
|
||||
if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) {
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
jclMap.setFType(2);
|
||||
int st = 100000000;
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
jclMap.setFType(2);
|
||||
int st = 100000000;
|
||||
|
||||
// 更新逻辑
|
||||
jclMap.setFObjId(newDepartment.getId().intValue());
|
||||
jclMap.setId(newDepartment.getId().intValue() + st);
|
||||
jclMap.setUuid(newDepartment.getUuid());
|
||||
jclMap.setFNumber(newDepartment.getDeptNo());
|
||||
jclMap.setFName(newDepartment.getDeptName());
|
||||
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
|
||||
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
|
||||
// 更新逻辑
|
||||
jclMap.setFObjId(newDepartment.getId().intValue());
|
||||
jclMap.setId(newDepartment.getId().intValue() + st);
|
||||
jclMap.setUuid(newDepartment.getUuid());
|
||||
jclMap.setFNumber(newDepartment.getDeptNo());
|
||||
jclMap.setFName(newDepartment.getDeptName());
|
||||
jclMap.setFLeader(null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue());
|
||||
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
|
||||
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
|
||||
|
||||
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
|
||||
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
|
||||
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue();
|
||||
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
|
||||
if (null != hrmResourcePO) {
|
||||
jclMap.setFLeader(hrmResourcePO.getId().intValue());
|
||||
jclMap.setFLeaderName(hrmResourcePO.getLastName());
|
||||
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
|
||||
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
|
||||
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
|
||||
String image = User.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
|
||||
jclMap.setFLeaderImg(image);
|
||||
if (null != hrmResourcePO.getJobTitle()) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
|
||||
if (null != jobById) {
|
||||
jclMap.setFLeaderJob(jobById.getJobName());
|
||||
}
|
||||
}
|
||||
}
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
HrmResource hrmResourceById = getCompTriggerMapper().getHrmResourceById(jclMap.getFLeader());
|
||||
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
if (null != hrmResourceById) {
|
||||
jclMap.setFLeaderImg(hrmResourceById.getMessagerurl());
|
||||
jclMap.setFLeaderName(hrmResourceById.getLastname());
|
||||
jclMap.setFLeaderJobId(hrmResourceById.getJobtitle());
|
||||
}
|
||||
|
||||
// 获取当前生效的本部门map记录
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
||||
StaffPO staffPO = new StaffPO();
|
||||
switch (jclMap.getFType()) {
|
||||
// 分部
|
||||
case 1:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
|
||||
break;
|
||||
// 部门
|
||||
case 2:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
|
||||
break;
|
||||
}
|
||||
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
||||
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
||||
if (null != moveTarget) {
|
||||
jclOrgMap = null;
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMap) {
|
||||
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
||||
jclMap.setFOnJob(jclOrgMap.getFOnJob());
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
}
|
||||
jclMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclMap.getFLeaderJobId()));
|
||||
|
||||
|
||||
CusFieldData cusFieldDataById = getCompTriggerMapper().getCusFieldDataById(jclMap.getFLeader());
|
||||
if (null != cusFieldDataById) {
|
||||
jclMap.setFLeaderSt(cusFieldDataById.getField100008());
|
||||
jclMap.setFLeaderLv(cusFieldDataById.getField100007());
|
||||
}
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
||||
// 获取当前生效的本部门map记录
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
||||
StaffPO staffPO = new StaffPO();
|
||||
switch (jclMap.getFType()) {
|
||||
// 分部
|
||||
case 1:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, jclMap.getFObjId().toString(), null, null);
|
||||
break;
|
||||
// 部门
|
||||
case 2:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, jclMap.getFObjId().toString(), null);
|
||||
break;
|
||||
}
|
||||
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
||||
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
||||
if (null != moveTarget) {
|
||||
jclOrgMap = null;
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMap) {
|
||||
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
||||
jclMap.setFOnJob(jclOrgMap.getFOnJob());
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(0);
|
||||
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
}
|
||||
jclMap.setFIsVitual(0);
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(0);
|
||||
}
|
||||
jclMap.setFIsVitual(0);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(jclMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(jclMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
|
||||
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
}
|
||||
if(null != jclOrgMapByObjID) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
// 部门启用,刷新上级数据
|
||||
if(forbiddenTag){
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
||||
}
|
||||
if(null != moveTarget){
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
|
||||
}
|
||||
if (null != oldFparentId) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
|
||||
}
|
||||
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
// 部门启用,刷新上级数据
|
||||
if (forbiddenTag) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
||||
}
|
||||
if (null != moveTarget) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
|
||||
}
|
||||
if (null != oldFparentId) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +189,7 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|||
StaffPO staffPO = new StaffPO();
|
||||
switch (parentJclOrgMap.getFType()) {
|
||||
case 1:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null);
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, Util.null2String(parentJclOrgMap.getFObjId()), null, null);
|
||||
break;
|
||||
// 部门
|
||||
case 2:
|
||||
|
|
@ -202,10 +197,10 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|||
break;
|
||||
}
|
||||
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
|
||||
if(null != jclOrgMapSum){
|
||||
if (null != jclOrgMapSum) {
|
||||
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
||||
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
||||
}else{
|
||||
} else {
|
||||
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
parentJclOrgMap.setFOnJob(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
|
|
@ -59,11 +58,6 @@ public class GroupTriggerRunnable implements Runnable {
|
|||
jclOrgMap.setFLeaderJobId(hrmResourceById.getJobtitle());
|
||||
}
|
||||
jclOrgMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclOrgMap.getFLeaderJobId()));
|
||||
HrmResourcePO resourceByEcId = getCompTriggerMapper().getResourceByEcId(jclOrgMap.getFLeader());
|
||||
if (null != resourceByEcId) {
|
||||
jclOrgMap.setFLeaderSt(resourceByEcId.getJobGrade());
|
||||
jclOrgMap.setFLeaderLv(resourceByEcId.getJobLevel());
|
||||
}
|
||||
jclOrgMap.setFParentId(-1);
|
||||
jclOrgMap.setFObjParentId(0);
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.personnelcard.User;
|
||||
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.mapper.trigger.HrmResourceTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
import java.sql.Date;
|
||||
|
|
@ -32,9 +30,7 @@ public class HrmResourceTriggerRunnable implements Runnable {
|
|||
private HrmResourceTriggerMapper getHrmResourceTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceTriggerMapper.class);
|
||||
}
|
||||
private HrmResourceMapper getHrmResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
private JclOrgMapper getJclOrgMapper() {
|
||||
return MapperProxyFactory.getProxy(JclOrgMapper.class);
|
||||
}
|
||||
|
|
@ -51,38 +47,36 @@ public class HrmResourceTriggerRunnable implements Runnable {
|
|||
Integer delete = null;
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
jclMap.setFType(4);
|
||||
// 当前日期 yyyy-MM-dd
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
|
||||
// 查询当前人员信息数据
|
||||
String ecResourceId = getHrmResourceMapper().getEcResourceId(userId.toString());
|
||||
// EC人员
|
||||
HrmResource ecHrmResource = getHrmResourceTriggerMapper().getHrmResource(Long.parseLong(ecResourceId));
|
||||
// 聚才林人员
|
||||
HrmResourcePO hrmResource = getCompTriggerMapper().getResourceByEcId(Integer.parseInt(ecResourceId));
|
||||
if (null != hrmResource && null!=ecHrmResource) {
|
||||
jclMap.setFObjId(hrmResource.getId().intValue());
|
||||
jclMap.setId(hrmResource.getId().intValue() + sk);
|
||||
jclMap.setFEcId(ecHrmResource.getId());
|
||||
jclMap.setFNumber(hrmResource.getWorkCode());
|
||||
jclMap.setFName(hrmResource.getLastName());
|
||||
jclMap.setUuid(hrmResource.getUuid());
|
||||
delete = hrmResource.getStatus() < 4 ? 0 : 1;
|
||||
// 展示为花名册上传的照片
|
||||
String image = User.builder().image(hrmResource.getResourceImageId()).build().getImage();
|
||||
jclMap.setFLeaderImg(image);
|
||||
jclMap.setFLeaderName(hrmResource.getLastName());
|
||||
jclMap.setFLeaderJobId(hrmResource.getJobTitle().intValue());
|
||||
if (null != hrmResource.getJobTitle()) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResource.getJobTitle());
|
||||
if (null != jobById) {
|
||||
jclMap.setFLeaderJob(jobById.getJobName());
|
||||
}
|
||||
jclMap.setFObjParentId(hrmResource.getJobTitle().intValue());
|
||||
HrmResource hrmResource = getHrmResourceTriggerMapper().getHrmResource(userId);
|
||||
if (null != hrmResource) {
|
||||
jclMap.setFObjId(hrmResource.getId());
|
||||
jclMap.setId(hrmResource.getId() + sk);
|
||||
jclMap.setFNumber(hrmResource.getWorkcode());
|
||||
jclMap.setFName(hrmResource.getLastname());
|
||||
delete = hrmResource.getStatus() <= 3 ? 0 : 1;
|
||||
jclMap.setFLeaderImg(hrmResource.getMessagerurl());
|
||||
// 更新组织架构图,组织架构负责人头像
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate("update jcl_org_map set fleaderimg = ? where fleader =? and fdateend > ?", hrmResource.getMessagerurl(), hrmResource.getId(), currentDate);
|
||||
jclMap.setFLeaderName(hrmResource.getLastname());
|
||||
jclMap.setFLeaderJobId(hrmResource.getJobtitle());
|
||||
String field100002 = getHrmResourceTriggerMapper().getField100002(jclMap.getFObjId());
|
||||
if (StringUtils.isNotBlank(field100002)) {
|
||||
jclMap.setFObjParentId(Integer.parseInt(field100002));
|
||||
jclMap.setFParentId(jclMap.getFObjParentId() + sj);
|
||||
}
|
||||
jclMap.setFLeaderSt(hrmResource.getJobGrade());
|
||||
jclMap.setFLeaderLv(hrmResource.getJobLevel());
|
||||
CusFieldData cusFieldDataById = getHrmResourceTriggerMapper().getCusFieldDataById(jclMap.getFObjId());
|
||||
if (null != cusFieldDataById) {
|
||||
jclMap.setFLeaderSt(cusFieldDataById.getField100008());
|
||||
jclMap.setFLeaderLv(cusFieldDataById.getField100007());
|
||||
}
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclMap.getFLeaderJobId()));
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
jclMap.setFIsVitual(0);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import com.engine.organization.mapper.job.JobMapper;
|
|||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.engine.organization.util.relation.ResourceSyncUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
|
@ -36,7 +35,7 @@ import java.util.stream.Collectors;
|
|||
public class OrganizationSyncEc {
|
||||
private final LogModuleNameEnum moduleName;
|
||||
private final OperateTypeEnum operateType;
|
||||
private Map<String, Object> params;
|
||||
private final Map<String, Object> params;
|
||||
private final User user;
|
||||
private JobPO oldJobPO;
|
||||
Map<String, Object> resultMap;
|
||||
|
|
@ -90,7 +89,6 @@ public class OrganizationSyncEc {
|
|||
refreshJob();
|
||||
break;
|
||||
case RESOURCE:
|
||||
refreshResource();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -155,29 +153,8 @@ public class OrganizationSyncEc {
|
|||
}
|
||||
}
|
||||
|
||||
private void refreshResource(){
|
||||
switch (operateType) {
|
||||
case ADD:
|
||||
addResource();
|
||||
break;
|
||||
case UPDATE:
|
||||
updateResource();
|
||||
break;
|
||||
case CANCELED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void addResource() {
|
||||
Map<String, Object> convertParams = ResourceSyncUtil.convertEcResourceParams(params);
|
||||
this.resultMap = ResourceSyncUtil.addResource(user, convertParams);
|
||||
}
|
||||
|
||||
private void updateResource() {
|
||||
Map<String, Object> convertParams = ResourceSyncUtil.convertEcResourceParams(params);
|
||||
this.resultMap = ResourceSyncUtil.editResourceBase(user, convertParams);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,169 @@
|
|||
package com.engine.organization.trigger.cusfielddata;
|
||||
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.postion.po.PostInfoPO;
|
||||
import com.engine.organization.entity.postion.po.PostPO;
|
||||
import com.engine.organization.entity.scheme.po.GradePO;
|
||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.entity.sequence.po.SequencePO;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.post.PostInfoMapper;
|
||||
import com.engine.organization.mapper.post.PostMapper;
|
||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.mapper.sequence.SequenceMapper;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.wbi.util.Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CusFieldDataTrigger {
|
||||
|
||||
|
||||
public static void run(Long id) {
|
||||
if (null == id) {
|
||||
// 查询人员表最新插入的ID
|
||||
id = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmResourceMaxId();
|
||||
if (null == id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean updateFlag = false;
|
||||
// 查询当前操作的数据
|
||||
CusFieldData sourceData = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmCusFieldDataByIdAndScopeId(id, -1L);
|
||||
String sourceField100001 = sourceData.getField100001();
|
||||
String sourceField100002 = sourceData.getField100002();
|
||||
String sourceField100003 = sourceData.getField100003();
|
||||
|
||||
// 查询需要更新的数据,没有则创建数据
|
||||
CusFieldData directionData = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmCusFieldDataByIdAndScopeId(id, 3L);
|
||||
if (null == directionData) {
|
||||
directionData = new CusFieldData();
|
||||
directionData.setScope("HrmCustomFieldByInfoType");
|
||||
directionData.setScopeId(3L);
|
||||
directionData.setId(id);
|
||||
MapperProxyFactory.getProxy(SystemDataMapper.class).insertCusFieldData(directionData);
|
||||
}
|
||||
|
||||
// field100002更新
|
||||
if (StringUtils.isNotBlank(sourceField100002)) {
|
||||
directionData.setField100002(sourceField100002);
|
||||
Long gwId = Long.parseLong(sourceField100002);
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(gwId);
|
||||
if (null != jobById) {
|
||||
RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
|
||||
Long ecGwId = StringUtils.isNotBlank(hrmJobTitleByName.getId()) ? Long.parseLong(hrmJobTitleByName.getId()) : null;
|
||||
Long ecBmId = jobById.getEcDepartment();
|
||||
Long ecGsId = jobById.getEcCompany();
|
||||
Map<String, Object> hrmResourceMap = new HashMap<>();
|
||||
// 岗位
|
||||
hrmResourceMap.put("jobtitle", ecGwId);
|
||||
// 部门
|
||||
hrmResourceMap.put("departmentid", ecBmId);
|
||||
// 公司
|
||||
hrmResourceMap.put("subcompanyid1", ecGsId);
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(id).tableName("hrmresource").params(hrmResourceMap).build());
|
||||
updateFlag = true;
|
||||
|
||||
// 职等职级为空,从岗位取值、更新
|
||||
if (StringUtils.isBlank(sourceField100001)) {
|
||||
if (StringUtils.isNotBlank(jobById.getLevelId())) {
|
||||
// 通过岗位关联,如有多个职等,选取第一个
|
||||
String[] levelArray = jobById.getLevelId().split(",");
|
||||
LevelPO levelByID = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByID(Long.parseLong(levelArray[0]));
|
||||
directionData.setField100008(levelByID.getLevelName());
|
||||
} else {
|
||||
directionData.setField100008(null);
|
||||
}
|
||||
// 职等职级方案
|
||||
if (StringUtils.isNotBlank(Util.null2String(jobById.getSchemeId()))) {
|
||||
SchemePO schemeByID = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByID(jobById.getSchemeId());
|
||||
directionData.setField100006(schemeByID.getSchemeName());
|
||||
} else {
|
||||
directionData.setField100006(null);
|
||||
}
|
||||
// 职级
|
||||
if (StringUtils.isNotBlank(jobById.getGradeId())) {
|
||||
GradePO gradeByLevelId = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByID(Long.parseLong(jobById.getGradeId()));
|
||||
directionData.setField100007(gradeByLevelId.getGradeName());
|
||||
} else {
|
||||
directionData.setField100007(null);
|
||||
}
|
||||
// 岗位序列
|
||||
if (StringUtils.isNotBlank(Util.null2String(jobById.getSequenceId()))) {
|
||||
SequencePO sequenceBySchemeId = MapperProxyFactory.getProxy(SequenceMapper.class).getSequenceByID(jobById.getSequenceId());
|
||||
directionData.setField100005(sequenceBySchemeId.getSequenceName());
|
||||
} else {
|
||||
directionData.setField100005(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
directionData.setField100002(null);
|
||||
directionData.setField100008(null);
|
||||
directionData.setField100006(null);
|
||||
directionData.setField100007(null);
|
||||
directionData.setField100005(null);
|
||||
}
|
||||
|
||||
// field100001更新,职等职级
|
||||
if (null != sourceField100001 && sourceField100001.split("A").length == 3) {
|
||||
directionData.setField100001(sourceField100001);
|
||||
String[] field100001Array = sourceField100001.split("A");
|
||||
// 职等
|
||||
long zdId = Long.parseLong(field100001Array[2]);
|
||||
long zjId = Long.parseLong(field100001Array[1]);
|
||||
long xlId = Long.parseLong(field100001Array[0].split("_")[1]);
|
||||
|
||||
LevelPO levelByID = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByID(zdId);
|
||||
directionData.setField100008(levelByID.getLevelName());
|
||||
// 职等职级方案
|
||||
SchemePO schemeByID = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByID(levelByID.getSchemeId());
|
||||
directionData.setField100006(schemeByID.getSchemeName());
|
||||
// 职级
|
||||
GradePO gradeByLevelId = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByID(zjId);
|
||||
directionData.setField100007(gradeByLevelId.getGradeName());
|
||||
// 岗位序列
|
||||
SequencePO sequenceBySchemeId = MapperProxyFactory.getProxy(SequenceMapper.class).getSequenceByID(xlId);
|
||||
directionData.setField100005(sequenceBySchemeId.getSequenceName());
|
||||
updateFlag = true;
|
||||
}
|
||||
|
||||
|
||||
if (null != sourceField100003 && sourceField100003.split("_").length == 2) {
|
||||
directionData.setField100003(sourceField100003);
|
||||
String[] field100003Array = sourceField100003.split("_");
|
||||
long zwId = Long.parseLong(field100003Array[1]);
|
||||
// 职务
|
||||
PostInfoPO postInfoByID = MapperProxyFactory.getProxy(PostInfoMapper.class).getPostInfoByID(zwId);
|
||||
directionData.setField100010(postInfoByID.getPostInfoName());
|
||||
// 职务分类
|
||||
PostPO postByID = MapperProxyFactory.getProxy(PostMapper.class).getPostByID(postInfoByID.getPostId());
|
||||
directionData.setField100009(postByID.getPostName());
|
||||
updateFlag = true;
|
||||
}
|
||||
|
||||
// 更新数据
|
||||
if (updateFlag) {
|
||||
MapperProxyFactory.getProxy(SystemDataMapper.class).updateCusFieldData(directionData);
|
||||
}
|
||||
// 刷新组织结构图
|
||||
new HrmResourceTriggerRunnable(id).run();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
package com.engine.organization.util.detach;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.dto.JobListDTO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
|
||||
import com.weaver.general.BaseBean;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class DetachUtil {
|
||||
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
|
||||
|
||||
private final List<Long> jclRoleLevels;
|
||||
|
||||
public DetachUtil(Integer uId) {
|
||||
if (1 == uId) {
|
||||
DETACH = false;
|
||||
}
|
||||
if (DETACH) {
|
||||
jclRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId);
|
||||
} else {
|
||||
jclRoleLevels = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterCompanyList(List<CompPO> companyList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(companyList)) {
|
||||
companyList.removeIf(item -> !jclRoleLevels.contains(item.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterDepartmentList(List<DepartmentPO> departmentList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(departmentList)) {
|
||||
departmentList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterJobDTOList(List<JobListDTO> jobList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||||
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterJobList(List<JobPO> jobList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||||
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
public String getJclRoleLevels() {
|
||||
return StringUtils.join(jclRoleLevels, ",");
|
||||
}
|
||||
|
||||
public boolean isDETACH() {
|
||||
return DETACH;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -15,6 +15,7 @@ import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
|||
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.trigger.cusfielddata.CusFieldDataTrigger;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.weaver.integration.ldap.sync.oa.OaSync;
|
||||
import com.weaver.integration.ldap.util.AuthenticUtil;
|
||||
|
|
@ -780,8 +781,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
flag = false;
|
||||
if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息
|
||||
flag = false;
|
||||
// TODO 更新聚才林相关字段
|
||||
// CusFieldDataTrigger.run((long) id);
|
||||
CusFieldDataTrigger.run((long) id);
|
||||
}
|
||||
|
||||
/*添加人员缓存,人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/
|
||||
|
|
@ -824,7 +824,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
new HrmDateCheck().calWorkInfo("" + id);
|
||||
// 刷新组织结构图
|
||||
new Thread(new HrmResourceTriggerRunnable((long) id)).start();
|
||||
new HrmResourceTriggerRunnable((long) id).run();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1394,8 +1394,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key)))
|
||||
flag = false;
|
||||
|
||||
//TODO 更新聚才林相关字段
|
||||
//CusFieldDataTrigger.run((long) keyMap.get(key));
|
||||
CusFieldDataTrigger.run((long) keyMap.get(key));
|
||||
|
||||
/*update HrmResource_Trigger */
|
||||
if (flag) {
|
||||
|
|
@ -1499,7 +1498,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
resultList.add(createLog(vo, "更新", "失败", "系统错误,请联系管理员"));
|
||||
}
|
||||
// 刷新组织结构图
|
||||
new Thread(new HrmResourceTriggerRunnable((long) keyMap.get(key))).start();
|
||||
new HrmResourceTriggerRunnable((long) keyMap.get(key)).run();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//数据异常
|
||||
|
|
|
|||
|
|
@ -1,228 +0,0 @@
|
|||
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.HrmRelationSaveParam;
|
||||
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 io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
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.POST;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新增表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSaveForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getSaveForm());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/saveBaseForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).saveBaseForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getBaseForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getBaseForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/updateForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).updateForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高级搜索条件
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSearchCondition")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getSearchCondition(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页顶部按钮
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getHasRight")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getHasRight());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getTabForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getTabForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/saveTabForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HrmRelationSaveParam params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).saveTabForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/updateTabForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HrmRelationSaveParam params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).updateTabForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
package com.engine.organization.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.ManagerDetachWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: 模块管理分权
|
||||
* @Date 2022/10/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ManagerDetachController {
|
||||
|
||||
public ManagerDetachWrapper getManagerDetachWrapper(User user) {
|
||||
return ServiceUtil.getService(ManagerDetachWrapper.class,user);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getTable")
|
||||
@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);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).listPage(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getTableBtn")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getTableBtn(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).getTableBtn());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getSearchCondition")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).getSearchCondition());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getForm(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("id") Integer id) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).getForm(id));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/deleteByIds")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).deleteByIds(param.getIds()));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveDetach(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).save(param));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/update")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateDetach(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).updateDetach(param));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/doDetach")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult doDetach(@Context HttpServletRequest request,@Context HttpServletResponse response,
|
||||
@QueryParam("idDetach") String isDetach) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).doDetach(isDetach));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.engine.organization.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.PersonnelCardWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.Util;
|
||||
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/10/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PersonnelCardController {
|
||||
public PersonnelCardWrapper getPersonnelCardWrapper(User user) {
|
||||
return ServiceUtil.getService(PersonnelCardWrapper.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getPersonnelCard")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getPersonnelCard(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String id = Util.null2String(map.get("id"));
|
||||
return ReturnResult.successed(getPersonnelCardWrapper(user).getPersonnelCard(StringUtils.isBlank(id) ? null : Long.parseLong(id)));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getIframeList")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getIframeList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getPersonnelCardWrapper(user).getIframeList());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.annotation.Log;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.service.HrmResourceService;
|
||||
import com.engine.organization.service.impl.HrmResourceServiceImpl;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class HrmResourceWrapper extends OrganizationWrapper {
|
||||
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);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSaveForm() {
|
||||
return getHrmResourceService(user).getSaveForm();
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "新增人员")
|
||||
public Long saveBaseForm(Map<String, Object> params) {
|
||||
Long resourceId = getHrmResourceService(user).saveBaseForm(params);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), params.get("last_name").toString(), JSON.toJSONString(params), "新增人员");
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public Map<String, Object> getBaseForm(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getBaseForm(params);
|
||||
}
|
||||
|
||||
public int updateForm(Map<String, Object> params) {
|
||||
int updateForm = getHrmResourceService(user).updateForm(params);
|
||||
return updateForm;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getSearchCondition(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getHasRight() {
|
||||
return getHrmResourceService(user).getHasRight();
|
||||
}
|
||||
|
||||
public Map<String, Object> getTabForm(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getTabForm(params);
|
||||
}
|
||||
|
||||
public long saveTabForm(HrmRelationSaveParam params) {
|
||||
return getHrmResourceService(user).saveTabForm(params);
|
||||
}
|
||||
|
||||
public long updateTabForm(HrmRelationSaveParam params) {
|
||||
return getHrmResourceService(user).updateTabForm(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.engine.organization.wrapper;
|
|||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.trigger.cusfielddata.CusFieldDataTrigger;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -54,6 +55,6 @@ public class JclOrgWrapper extends OrganizationWrapper {
|
|||
}
|
||||
|
||||
public void syncCusFieldData(String id) {
|
||||
// CusFieldDataTrigger.run(StringUtils.isNotBlank(id) ? Long.parseLong(id) : null);
|
||||
CusFieldDataTrigger.run(StringUtils.isNotBlank(id) ? Long.parseLong(id) : null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.annotation.Log;
|
||||
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
||||
import com.engine.organization.entity.detach.po.ManagerDetachPO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.detach.ManagerDetachMapper;
|
||||
import com.engine.organization.service.ManagerDetachService;
|
||||
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ManagerDetachWrapper extends OrganizationWrapper {
|
||||
|
||||
public ManagerDetachService getManagerDetachService(User user) {
|
||||
return ServiceUtil.getService(ManagerDetachServiceImpl.class,user);
|
||||
}
|
||||
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
return getManagerDetachService(user).listPage(params);
|
||||
}
|
||||
|
||||
public Map<String, List<MenuBtn>> getTableBtn() {
|
||||
return MenuBtn.getCommonBtnDatas();
|
||||
}
|
||||
|
||||
public Map<String, Object> getSearchCondition() {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
SearchConditionItem ecManager = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "管理员名称", "ecManager");
|
||||
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "可管理组织机构", "164", "ecRolelevel", "");
|
||||
conditionItems.add(ecManager);
|
||||
conditionItems.add(ecRolelevel);
|
||||
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||
apiDatas.put("conditions", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
public Map<String, Object> getForm(Integer id) {
|
||||
return getManagerDetachService(user).getForm(id);
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.DELETE,operateModule = LogModuleNameEnum.DETACH,operateDesc = "删除分权数据")
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
List<ManagerDetachPO> managerDetachPOS = MapperProxyFactory.getProxy(ManagerDetachMapper.class).selectByIds(ids);
|
||||
int deleteByIds = getManagerDetachService(user).deleteByIds(ids);
|
||||
for (ManagerDetachPO managerDetachPO : managerDetachPOS) {
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(ids), "删除等级方案");
|
||||
}
|
||||
return deleteByIds;
|
||||
}
|
||||
|
||||
|
||||
@Log(operateType = OperateTypeEnum.ADD,operateModule = LogModuleNameEnum.DETACH,operateDesc = "新增分权管理员")
|
||||
public int save(ManagerDetachParam param) {
|
||||
int save = getManagerDetachService(user).save(param);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), String.valueOf(param.getEcManager()), JSON.toJSONString(param), "新增分权管理员");
|
||||
return save;
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.DETACH, operateDesc = "分权数据更新")
|
||||
public int updateDetach(ManagerDetachParam param) {
|
||||
ManagerDetachPO managerDetachPO = MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId());
|
||||
int result = getManagerDetachService(user).updateDetach(param);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(param), managerDetachPO, MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String doDetach(String isDetach) {
|
||||
return getManagerDetachService(user).doDetach(isDetach);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.personnelcard.Iframe;
|
||||
import com.engine.organization.service.HrmPersonnelCardService;
|
||||
import com.engine.organization.service.impl.HrmPersonnelCardServiceImpl;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PersonnelCardWrapper extends OrganizationWrapper {
|
||||
private HrmPersonnelCardService getHrmPersonnelCardService(User user) {
|
||||
return ServiceUtil.getService(HrmPersonnelCardServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> getPersonnelCard(Long uId) {
|
||||
return getHrmPersonnelCardService(user).getPersonnelCard(uId);
|
||||
}
|
||||
|
||||
public List<Iframe> getIframeList() {
|
||||
return getHrmPersonnelCardService(user).getIframeList();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue