Merge branches 'develop' and '大王椰组织调整工作流提醒' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into 大王椰组织调整工作流提醒

# Conflicts:
#	src/com/engine/organization/util/response/ReturnResult.java
大王椰组织调整工作流提醒
Chengliang 8 months ago
commit 30da1ecc45

@ -22,6 +22,7 @@ public class CompanyTreePO {
private boolean isLeaf;
private String key;
private boolean disabled;
private String type;
public boolean getIsLeaf() {
return isLeaf;
@ -38,4 +39,11 @@ public class CompanyTreePO {
public String getValue() {
return id;
}
public String getType() {
if(id.startsWith("d")){
return "2";
}
return "1";
}
}

@ -24,6 +24,8 @@ public class ManagerDetachParam {
private Integer ecManager;
private Integer roleId;
private Integer jclManager;
private String ecRolelevel;

@ -22,6 +22,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@OrganizationTable(pageId = "0bf9b7bc-c8b0-4225-bf28-4cd015d96e98",
fields = "t.id," +
"t.manager_type," +
"t.ec_manager," +
"t.ec_rolelevel," +
"t.manage_module," +
@ -45,8 +46,11 @@ public class ManagerDetachVO {
@OrganizationTableColumn(column = "id", display = false)
private Long id;
@OrganizationTableColumn(labelId = 513540, text = "管理员类型", width = "20%", column = "manager_type")
private Integer managerType;
@OrganizationTableColumn(labelId = 547405, text = "管理员", width = "20%", column = "ec_manager", transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getManagerName")
@OrganizationTableColumn(labelId = 547405, text = "管理员", width = "20%", column = "ec_manager", transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getManagerName",otherPara = "column:manager_type")
private Integer ecManager;
@OrganizationTableColumn(labelId = 547407, text = "可管理组织机构", width = "40%", column = "ec_rolelevel", transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getRoleLevel")

@ -411,6 +411,10 @@ public class ExtendInfoBO {
searchConditionItem = new SearchConditionItem(ConditionType.BROWSER, fieldlabel, new String[]{fieldname}, browserbean);
} else {
searchConditionItem = conditionFactory.createCondition(ConditionType.BROWSER, fieldlabel, fieldname, detailtype);
//隐藏虚拟组织
if(searchConditionItem != null ) {
searchConditionItem.getBrowserConditionParam().setHideVirtualOrg(true);
}
}
// 岗位浏览按钮
if ("666".equals(detailtype)) {

@ -5,6 +5,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Objects;
/**
* @author:dxfeng
* @createTime: 2023/01/05
@ -19,4 +21,21 @@ public class SearchTemplateParam {
//private boolean selected;
private String showname;
private String fields;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SearchTemplateParam that = (SearchTemplateParam) o;
return key.equals(that.key);
}
@Override
public int hashCode() {
return Objects.hash(key);
}
}

@ -64,4 +64,6 @@ public class JclOrgCustomTemplatePO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer overall;
}

@ -26,4 +26,5 @@ public class SearchTemplatePO {
private Integer creator;
private Date createTime;
private Date updateTime;
private Integer overall;
}

@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@OrganizationTable(pageId = "0cdfd5bb-dc09-11ec-b69e-00ffcbed7508",
fields = "t.id,t.is_used,s.control_dimension,t.plan_id,t.comp_id,t.dept_id,t.job_id,t.staff_num,t.permanent_num,t.freeze_num,t.lack_status,t.staff_desc",
fields = "t.id,t.is_used,s.control_dimension,t.plan_id,t.comp_id,t.dept_id,t.job_id,t.staff_num,t.permanent_num,t.freeze_num,t.lack_status,t.staff_desc,t.description",
fromSql = "FROM jcl_org_staff t inner join jcl_org_staffplan s on t.plan_id = s.id",
orderby = "id desc",
primarykey = "id",
@ -91,4 +91,11 @@ public class StaffTableVO {
@OrganizationTableColumn(labelId = 547349, text = "编制描述", width = "10%", column = "staff_desc")
private String staffDesc;
/**
*
*/
@OrganizationTableColumn(labelId = 547142, text = "描述说明", width = "10%", column = "description")
private String description;
}

@ -122,7 +122,7 @@
<select id="getIdByNameAndPid" resultType="java.lang.Integer">
select id
from hrmdepartment
where departmentName = #{departmentName}
where departmentmark = #{departmentName}
and subCompanyId1 = #{subCompanyId1}
and supDepId = #{supDepId}
</select>

@ -24,7 +24,9 @@ public interface ManagerDetachMapper {
ManagerDetachPO getDetachById(@Param("id") Integer id);
List<ManagerDetachPO> getDetachListById(@Param("ecManager") Integer ecManager);
List<ManagerDetachPO> getDetachListById(@Param("ecManager") Integer ecManager,@Param("managerType") Integer managerType);
List<ManagerDetachPO> selectDetachListByManager(@Param("ids") Collection<Integer> ids);
ManagerDetachPO selectManagerDetachByUid(@Param("uid") Integer uId);
}

@ -216,6 +216,19 @@
from jcl_org_detach t
WHERE delete_type = 0
and ec_manager = #{ecManager}
and manager_type = #{managerType}
</select>
<select id="selectDetachListByManager" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_detach t
WHERE delete_type = 0
and manager_type = 1
and ec_manager in
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectManagerDetachByUid" resultMap="BaseResultMap">

@ -133,6 +133,7 @@
FROM cus_formfield t1,
cus_formdict t2
WHERE t1.fieldid = t2.id
AND t1.isuse = 1
AND t1.scope = 'HrmCustomFieldByInfoType'
AND t1.scopeid = #{scopeId}
UNION ALL

@ -141,7 +141,8 @@ public interface JobMapper {
* @param parentJob
* @return
*/
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Integer parentCompany, @Param("parentDepartment") Integer parentDepartment, @Param("parentJob") Long parentJob);
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Integer parentCompany, @Param("parentDepartment") Integer parentDepartment, @Param("parentJob") Long parentJob,
@Param("jobactivitymark") String jobactivitymark,@Param("jobgroupremark") String jobgroupremark);
int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Integer parentCompany, @Param("ecCompany") Integer ecCompany);

@ -483,13 +483,13 @@
</select>
<select id="getIdByNameAndPid" resultType="java.lang.Long">
select
t.id
from
jcl_org_job t
select t.id from jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where
delete_type = 0
left join hrmjobactivities j on h.jobactivityid = j.id
left join hrmjobgroups f on j.jobgroupid = f.id
where delete_type = 0
and j.jobactivitymark = #{jobactivitymark}
and f.jobgroupremark = #{jobgroupremark}
and h.JOBTITLENAME = #{jobName}
and ec_company = #{parentCompany}
<include refid="nullparentDept"/>

@ -55,6 +55,8 @@ public interface HrmResourceMapper {
*/
List<SearchTemplateParam> getCustomTemplatesByUser(@Param("userId") Integer userId);
List<SearchTemplateParam> getCustomOverAll();
SearchTemplatePO getSearchTemplateById(@Param("id") String id);
SearchTemplatePO getSearchTemplateByName(@Param("userId") Integer userId, @Param("name") String name);
@ -65,6 +67,10 @@ public interface HrmResourceMapper {
SearchTemplatePO getUsedCustomTemplateByUser(@Param("userId") Integer userId);
SearchTemplatePO getUsedSerarchTemplateByUser(@Param("userId") Integer userId);
SearchTemplatePO getOverallCustomTemplate();
Integer insertSearchTemplate(SearchTemplatePO templatePO);
Integer deleteSearchTemplate(@Param("id") Integer Id, @Param("userId") Integer userId);
@ -73,6 +79,8 @@ public interface HrmResourceMapper {
Integer deleteCustomTemplate(@Param("id") Integer Id, @Param("userId") Integer userId);
Integer updateCustomTemplateUsed(@Param("userId") Integer userId);
String queryLabelName(@Param("fieldName") String fieldName, @Param("scopeId") String scopeId, @Param("language") Integer language);

@ -14,6 +14,9 @@
<result column="name" property="showname"/>
<!-- <result column="selected" property="selected"/>-->
</resultMap>
<update id="updateCustomTemplateUsed">
update JCL_ORG_SEARCH_TEMPLATE set isused = null where creator = #{userId}
</update>
<select id="selectFilterDatas" resultType="com.engine.organization.entity.hrmresource.po.ResourcePO">
@ -147,7 +150,14 @@
select id,
name
from jcl_org_custom_template
where creator = #{userId}
where creator = #{userId} and overall is null
</select>
<select id="getCustomOverAll" resultMap="SearchTemplateMap">
select id,
name
from jcl_org_custom_template
where overall = 1
</select>
<insert id="insertSearchTemplate" parameterType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO"
@ -176,6 +186,9 @@
<if test="workFields != null">
work_fields,
</if>
<if test="isused != null">
isused,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
@ -199,6 +212,9 @@
<if test="workFields != null">
#{workFields},
</if>
<if test="isused != null">
#{isused},
</if>
</trim>
</insert>
@ -445,9 +461,19 @@
select *
from jcl_org_custom_template
where ISUSED = 1
and overall is null
and creator = #{userId}
</select>
<select id="getOverallCustomTemplate"
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
select *
from jcl_org_custom_template
where overall = 1
</select>
<select id="selectByDepartmentId" resultType="com.engine.organization.entity.hrmresource.po.ResourceChartPO">
select id,workcode,lastname,sex,departmentid,subcompanyid1,jobtitle,status,mobile
from hrmresource where departmentid = #{departmentId} and status &lt; 4 order by id
@ -462,5 +488,12 @@
</foreach>
order by id
</select>
<select id="getUsedSerarchTemplateByUser"
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
select *
from jcl_org_search_template
where ISUSED = 1
and creator = #{userId}
</select>
</mapper>

@ -34,8 +34,10 @@ public interface JclOrgCustomTemplateMapper {
int deleteByIds(@Param("ids") Collection<Long> ids);
int updateUsed(@Param("isused")String isused,@Param("id") String id,@Param("creator") String creator);
int updateUsed(@Param("overall")Integer overall,@Param("isused")String isused,@Param("id") String id,@Param("creator") String creator);
JclOrgCustomTemplatePO queryIsusedTemp(@Param("isused")String isused,@Param("creator") String creator);
JclOrgCustomTemplatePO queryOverAll();
}

@ -14,12 +14,13 @@
<result property="creator" column="creator" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="DATE"/>
<result property="updateTime" column="update_time" jdbcType="DATE"/>
<result property="overall" column="overall"/>
</resultMap>
<sql id="Base_Column_List">
id,name,basic_fields,
personal_fields,work_fields,isused,
creator,create_time,update_time
creator,create_time,update_time,overall
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@ -132,8 +133,9 @@
<update id="updateUsed" parameterType="java.lang.String">
update JCL_ORG_CUSTOM_TEMPLATE set isused = #{isused}
<where>
overall is null
<if test="id !=null">
id = #{id}
and id = #{id}
</if>
<if test="creator !=null">
and creator = #{creator}
@ -144,9 +146,17 @@
<select id="queryIsusedTemp" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from JCL_ORG_CUSTOM_TEMPLATE t where t.isused = #{isused} and t.creator = #{creator}
from JCL_ORG_CUSTOM_TEMPLATE t where t.isused = #{isused} and t.creator = #{creator} and overall is null
</select>
<select id="queryOverAll" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from JCL_ORG_CUSTOM_TEMPLATE t where overall = 1
</select>
<select id="listAllIdByCreator" resultType="java.lang.Long">
select
id

@ -101,4 +101,13 @@ public interface ChartService {
* @return: java.util.Map<java.lang.Integer,com.engine.organization.entity.chart.HrmLabelVO>
*/
Map<Integer, HrmLabelVO> selectLabel();
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/8/1 4:30 PM
* @param: []
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> versionDelete(Integer versionId);
}

@ -133,7 +133,7 @@ public interface HrmResourceService {
* @param params
* @return
*/
Integer saveCustomTemplate(SearchTemplateParam params);
Map<String, Object> saveCustomTemplate(SearchTemplateParam params);
/**
*
@ -179,4 +179,12 @@ public interface HrmResourceService {
Map<String, Object> chartResourceList(Integer departmentId,String versionId,String dimension,String statusValue);
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/7/23 3:02 PM
* @param: [params]
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> customOverall(Map<String, Object> params);
}

@ -89,6 +89,7 @@ public class ChartServiceImpl extends Service implements ChartService {
// 根结点
String root = Util.null2String(params.get("root"));
root = StringUtils.isBlank(root) ? "0" : root;
boolean isDepartment = root.startsWith("d");
// 维度
String dimension = Util.null2String(params.get("fclass"));
@ -140,6 +141,10 @@ public class ChartServiceImpl extends Service implements ChartService {
// 向下查询数据
if (null != topChartPO) {
// 如果根结点是部门顶层层级设置为1
if(topChartPO.getFtype().equals("2")){
topChartPO.setDepartmentDepth(1);
}
findChildData(topChartPO, dataList, Integer.parseInt(depth), id, hideDepartment);
}
@ -461,14 +466,31 @@ public class ChartServiceImpl extends Service implements ChartService {
" versionid = " + versionId + " and companyvirtualid = " + dimension;
}
} else {
String numSql = ",a.job_num,a.staff_num";
if (!isRealDimension) {
numSql = "";
}
if (root.startsWith("d")) {
root = root.replace("d", "");
if (hasVirtualFields) {
if (showVirtual) {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and subcompanyid = " + root;
return "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual" + numSql + " from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and " + DEPARTMENT_ID + " = '" + root + "' and versionid = " + versionId;
} else {
return "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual" + numSql + " from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and " + DEPARTMENT_ID + " = '" + root + "' and versionid = " + versionId;
}
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')";
return "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type" + numSql + " from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and " + DEPARTMENT_ID + " = '" + root + "' and versionid = " + versionId;
}
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and subcompanyid = " + root;
if (hasVirtualFields) {
if (showVirtual) {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual" + numSql + " from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and " + SUB_COMPANY_ID + " = " + root;
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual" + numSql + " from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and " + SUB_COMPANY_ID + " = " + root + " and (isvirtual is null or isvirtual != '1')";
}
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type" + numSql + " from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and " + SUB_COMPANY_ID + " = " + root;
}
}
}
}
@ -524,6 +546,19 @@ public class ChartServiceImpl extends Service implements ChartService {
public Map<String, Object> getDepartmentTree(Map<String, Object> params) {
Map<String, Object> result = new HashMap<>(2);
List<CompanyTreePO> departmentTree = getDepartmentTreeList(params);
result.put("departmentTree", departmentTree);
result.put("api_status", true);
return result;
}
/**
*
*
* @param params
* @return
*/
public static List<CompanyTreePO> getDepartmentTreeList(Map<String, Object> params) {
RecordSet rs = new RecordSet();
List<CompanyTreePO> departmentTree = new ArrayList<>();
String subCompany = Util.null2String(params.get("subcompany"));
@ -535,11 +570,9 @@ public class ChartServiceImpl extends Service implements ChartService {
String sql = getDepartmentTreeSql(versionId, dimension, subCompany);
rs.executeQuery(sql);
while (rs.next()) {
departmentTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).disabled(!rs.getString("id").startsWith("d")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(versionId, dimension, rs.getString("id"))).build());
departmentTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).disabled(false).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(versionId, dimension, rs.getString("id"))).build());
}
result.put("departmentTree", departmentTree);
result.put("api_status", true);
return result;
return departmentTree;
}
@Override
@ -701,6 +734,32 @@ public class ChartServiceImpl extends Service implements ChartService {
return labelData;
}
@Override
public Map<String, Object> versionDelete(Integer versionId) {
Map<String, Object> data = new HashMap<>();
RecordSet rs = new RecordSet();
//1.删除版本表
rs.executeUpdate("delete from jcl_org_chartversion where id = ?",versionId);
//2.删除历史分部表
rs.executeUpdate("delete from jcl_chart_subcompany where versionid = ?",versionId);
//3.删除历史部门表
rs.executeUpdate("delete from jcl_chart_department where versionid = ?",versionId);
//4.删除历史聚才林岗位表
rs.executeUpdate("delete from jcl_chart_job where versionid = ?",versionId);
//5.删除历史人员表
rs.executeUpdate("delete from jcl_chart_resource where versionid = ?",versionId);
data.put("versionId",versionId);
return data;
}
/**
*
* @param stp
@ -1338,6 +1397,18 @@ public class ChartServiceImpl extends Service implements ChartService {
// 查询其他维度集团信息
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE + " where id = '" + dimension + "'";
}
} else {
if(root.startsWith("d")) {
root = root.replace("d", "");
if (hasVirtualFields) {
if (showVirtual) {
return "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (a.canceled is null or a.canceled != '1') and a.id = '" + root + "'";
} else {
return "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.id = '" + root + "'";
}
} else {
return "select a.id,a.departmentname as name,'2' as type,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=2 where (canceled is null or canceled != '1') and a.id = '" + root + "'";
}
}else {
if (hasVirtualFields) {
if (showVirtual) {
@ -1351,6 +1422,7 @@ public class ChartServiceImpl extends Service implements ChartService {
}
}
}
}
/**
* ,SQL
@ -1654,10 +1726,10 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param subCompany Id
* @return SQL
*/
private String getDepartmentTreeSql(String versionId, String dimension, String subCompany) {
private static String getDepartmentTreeSql(String versionId, String dimension, String subCompany) {
// 是否展示当前数据
boolean isSearchCurrent = StringUtils.isBlank(versionId) || "0".equals(versionId);
boolean isCurrentDimension = StringUtils.isNotBlank(dimension) && !"0".equals(dimension);
boolean isNotCurrentDimension = StringUtils.isNotBlank(dimension) && !"0".equals(dimension);
boolean isDepartment = subCompany.startsWith("d");
String sql;
DBType dbType = DBType.get(new RecordSet().getDBType());
@ -1665,36 +1737,37 @@ public class ChartServiceImpl extends Service implements ChartService {
subCompany = subCompany.replace("d", "");
if (isSearchCurrent) {
sql = "select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, " + dbType.concat("d", "supdepid") + " as pId from hrmdepartment where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepid", "0") + " = " + subCompany;
if (isCurrentDimension) {
sql += " order by showorder,id ";
if (isNotCurrentDimension) {
sql = "select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, " + dbType.concat("d", "supdepid") + " as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepid", "0") + " = " + subCompany;
}
sql += " order by showorder,id ";
} else {
sql = "select " + dbType.concat("d", "departmentid") + "as id, departmentid as value, departmentname as title, " + dbType.concat("d", "supdepartmentid") + " as pId from jcl_chart_department where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepartmentid", "0") + " = " + subCompany;
if (isCurrentDimension) {
if (isNotCurrentDimension) {
sql = "select " + dbType.concat("d", "departmentvirtualid") + "as id, departmentvirtualid as value, departmentname as title, " + dbType.concat("d", "supdepid") + " as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepid", "0") + " = " + subCompany;
}
// 添加时间轴条件
sql += " and versionid = " + versionId;
}
} else {
// TODO 分权
if (isSearchCurrent) {
sql = "select " + dbType.concat("", "id") + " as id, id as value, subcompanyname as title, supsubcomid as pId, showorder from hrmsubcompany where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcomid", "0") + " = " + subCompany +
" union select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, subcompanyid1 as pId, showorder from hrmdepartment where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and " + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
if (isCurrentDimension) {
sql += " order by showorder,id ";
if (isNotCurrentDimension) {
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcomid", "0") + " = " + subCompany + " and companyid = '" + dimension + "' " +
" union select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
}
sql += " order by showorder,id ";
} else {
sql = "select " + dbType.concat("", "subcompanyid") + " as id, subcompanyid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcompanyid", "0") + " = " + subCompany +
" union select " + dbType.concat("d", "subcompanyid") + "as id, subcompanyid as value, departmentname as title, subcompanyid as pId from jcl_chart_department where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid =0) and " + dbType.ifNull("subcompanyid", "0") + " = " + subCompany;
if (isCurrentDimension) {
sql = "select " + dbType.concat("", "subcompanyvirtualid") + " as id, subcompanyvirtualid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcompanyid", "0") + " = " + subCompany + " and companyid = '" + dimension + "' " +
" union select " + dbType.concat("d", "departmentvirtualid") + "as id, departmentvirtualid as value, departmentname as title, subcompanyid as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" + dbType.ifNull("subcompanyid", "0") + " = " + subCompany;
sql = "select " + dbType.concat("", "subcompanyid") + " as id, subcompanyid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcompanyid", "0") + " = " + subCompany + " and versionid = " + versionId +
" union select " + dbType.concat("d", "departmentid") + "as id, departmentid as value, departmentname as title, subcompanyid as pId from jcl_chart_department where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid =0) and " + dbType.ifNull("subcompanyid", "0") + " = " + subCompany + " and versionid = " + versionId ;
if (isNotCurrentDimension) {
sql = "select " + dbType.concat("", "subcompanyvirtualid") + " as id, subcompanyvirtualid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcompanyid", "0") + " = " + subCompany + " and companyid = '" + dimension + "' " + " and versionid = " + versionId +
" union select " + dbType.concat("d", "departmentvirtualid") + "as id, departmentvirtualid as value, departmentname as title, subcompanyid as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" + dbType.ifNull("subcompanyid", "0") + " = " + subCompany + " and versionid = " + versionId ;
}
// 添加时间轴条件
sql += " and versionid = " + versionId;
//// 添加时间轴条件
//sql += " and versionid = " + versionId;
}
}
return sql;
@ -1716,7 +1789,7 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param subCompany ID
* @return
*/
private boolean judgeTreeLeaf(String versionId, String dimension, String subCompany) {
private static boolean judgeTreeLeaf(String versionId, String dimension, String subCompany) {
RecordSet recordSet = new RecordSet();
String sql = getDepartmentTreeSql(versionId, dimension, subCompany);
recordSet.executeQuery(sql);

@ -14,12 +14,14 @@ import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.department.bo.DepartmentBO;
import com.engine.organization.entity.department.dto.DepartmentListDTO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.hrmresource.po.JclOrgCustomTemplatePO;
import com.engine.organization.entity.hrmresource.po.SearchTemplatePO;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.vo.StaffTableVO;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.resource.HrmResourceMapper;
import com.engine.organization.mapper.resource.JclOrgCustomTemplateMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper;
@ -141,18 +143,31 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
HrmResourceServiceImpl hrmResourceService = ServiceUtil.getService(HrmResourceServiceImpl.class,user);
List<SearchConditionGroup> allConditions = hrmResourceService.getAllConditions();
List<String> columnList;
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryIsusedTemp("1", String.valueOf(user.getUID()));
// 查询当前台账定制列
SearchTemplatePO usedCustomTemplate = MapperProxyFactory.getProxy(HrmResourceMapper.class).getUsedCustomTemplateByUser(user.getUID());
if (null == usedCustomTemplate) {
// 默认列定制
String selectKeys = "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid";
columnList = Arrays.asList(selectKeys.split(","));
//2.是否存在通用模板
if (null == jclOrgCustomTemplatePO) {
jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryOverAll();
}
String columns = "";
if (jclOrgCustomTemplatePO != null) {
if (org.apache.commons.lang3.StringUtils.isNotBlank(jclOrgCustomTemplatePO.getBasicFields())) {
columns = jclOrgCustomTemplatePO.getBasicFields();
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(jclOrgCustomTemplatePO.getPersonalFields())) {
columns = columns + "," + jclOrgCustomTemplatePO.getPersonalFields();
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(jclOrgCustomTemplatePO.getWorkFields())) {
columns = columns + "," + jclOrgCustomTemplatePO.getWorkFields();
}
} else {
columnList = hrmResourceService.getSelectKeys(usedCustomTemplate);
//初次使用,无模板初始值
columns = "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_subcompanyid1,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid,-1_hrm_sporder";
}
List<String> columnList = Arrays.asList(columns.split(","));
BigDecimal decimal = new BigDecimal(100 / columnList.size());
@ -168,7 +183,8 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
weaTableColumn.setText(MapperProxyFactory.getProxy(HrmResourceMapper.class).queryLabelName(fieldName, scopeId, user.getLanguage()));
weaTableColumn.setColumn(hrmResourceService.buildTableSql(columnName).replace(".", "_"));
weaTableColumn.setDisplay(columnList.contains(columnName) ? WeaBoolAttr.TRUE : WeaBoolAttr.FALSE);
weaTableColumn.setTransmethod("com.engine.organization.transmethod.HrmResourceTransMethod.getFieldTrueValue");
// 导出专用转换去除html标签
weaTableColumn.setTransmethod("com.engine.organization.transmethod.HrmResourceTransMethod.getFieldTrueValueExp");
weaTableColumn.setOtherpara(columnName);
weaTableColumn.setWidth(decimal.setScale(2, RoundingMode.HALF_UP).doubleValue() + "%");
if (weaTableColumn.getDisplay().getBoolVal()) {

@ -75,7 +75,7 @@ public class FunctionOutStaffServiceImpl {
private Integer frozenStaffNums(StaffOutParam param) {
StaffPO staffPO = select(param);
List<Integer> numberF = Arrays.asList(staffPO.getFreezeNum(),param.getNum());
List<Integer> numberF = Arrays.asList(staffPO.getFreezeNum(),param.getNum(),staffPO.getPermanentNum());
//1.增加冻结数 num为负数时为减少冻结数
Integer sum = numberF.stream()
.mapToInt(Integer::intValue)

@ -34,6 +34,7 @@ import com.engine.organization.entity.search.QuickSearchDetail;
import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.HrmGroupEnum;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.condition.QuickSearchMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
@ -149,6 +150,12 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
table.setSqlwhere(sqlWhere);
List<WeaTableColumn> weaTableColumnList = new ArrayList<>();
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryIsusedTemp("1", String.valueOf(user.getUID()));
//2.是否存在通用模板
if (null == jclOrgCustomTemplatePO) {
jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryOverAll();
}
String columns = "";
List<String> fields = new ArrayList<>();
List<SearchConditionGroup> allConditions = getAllConditions();
@ -266,6 +273,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
templatePO.setCreator(user.getUID());
templatePO.setCreateTime(new Date());
templatePO.setUpdateTime(new Date());
templatePO.setIsused("1");
// 将之前的模板isused置为null
getHrmResourceMapper().updateCustomTemplateUsed(user.getUID());
getHrmResourceMapper().insertSearchTemplate(templatePO);
return templatePO.getId();
}
@ -314,39 +324,53 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
int userUID = user.getUID();
// 根据ID查询所存储的模板
List<SearchTemplateParam> templates;
boolean addDefault = true;
if ("custom".equals(type)) {
templates = getHrmResourceMapper().getCustomTemplatesByUser(userUID);
returnMap.put("id", id);
// SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedCustomTemplateByUser(user.getUID());
// if (null != usedCustomTemplate) {
// returnMap.put("templateId", usedCustomTemplate.getId().toString());
// } else {
// returnMap.put("templateId", "-1");
SearchTemplatePO overallCustomTemplate = getHrmResourceMapper().getOverallCustomTemplate();
if (null != overallCustomTemplate) {
if("-1".equals(id)) {
id = overallCustomTemplate.getId().toString();
}
templates.add(SearchTemplateParam.builder().key(overallCustomTemplate.getId().toString()).showname(overallCustomTemplate.getName()).build());
//}
addDefault = false;
}
returnMap.put("id", id);
} else {
templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
}
if (addDefault) {
templates.add(0, SearchTemplateParam.builder().key("-1").showname("默认模板").build());
returnMap.put("templates", templates);
}
LinkedHashSet<Object> objects = new LinkedHashSet<>(templates);
returnMap.put("templates", objects);
return returnMap;
}
@Override
public Integer saveCustomTemplate(SearchTemplateParam params) {
public Map<String, Object> saveCustomTemplate(SearchTemplateParam params) {
// 重复名称校验
Map<String, Object> data = new HashMap<>();
SearchTemplatePO searchTemplateByName = getHrmResourceMapper().getCustomTemplateByName(user.getUID(), params.getShowname());
OrganizationAssert.isFalse("默认模板".equals(params.getShowname()) || null != searchTemplateByName, SystemEnv.getHtmlLabelName(547439, user.getLanguage()));
SearchTemplatePO templatePO = buildSearchTemplateByFields(params.getFields());
if (null == templatePO) {
return -1;
}
OrganizationAssert.notNull(templatePO,"模板存储失败");
templatePO.setName(params.getShowname());
templatePO.setCreator(user.getUID());
templatePO.setIsused("0");
templatePO.setCreateTime(new Date());
templatePO.setUpdateTime(new Date());
templatePO.setOverall(0);
getHrmResourceMapper().insertCustomTemplate(templatePO);
return templatePO.getId();
Map<String, Object> param = new HashMap<>();
param.put("type","custom");
param.put("id",templatePO.getId());
data.put("result",getSearchTemplate(param));
return data;
}
@Override
@ -417,20 +441,21 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
}
transferOptions.add(SearchTemplateParam.builder().key(Integer.toString(idx.getAndIncrement())).showname(allCondition.getTitle()).build());
}
if ("-1".equals(templateId)) {
// 查询当前使用的模板,没有使用的,则展示默认模板
SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedCustomTemplateByUser(user.getUID());
if (null == usedCustomTemplate) {
if ("-1".equals(templateId)) {
String selectKeys = "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid";
transferKeys = Arrays.asList(selectKeys.split(","));
} else {
transferKeys = getSelectKeys(usedCustomTemplate);
templateId = usedCustomTemplate.getId().toString();
SearchTemplatePO overallCustomTemplate = getHrmResourceMapper().getOverallCustomTemplate();
if (null != overallCustomTemplate) {
transferKeys = getSelectKeys(overallCustomTemplate);
}
} else {
SearchTemplatePO searchTemplateById = getHrmResourceMapper().getCustomTemplateById(templateId);
transferKeys = getSelectKeys(searchTemplateById);
}
transferOptions.add(0, SearchTemplateParam.builder().key("").showname("").build());
resultMap.put("transferDatas", transferDatas);
resultMap.put("transferKeys", transferKeys);
@ -447,18 +472,22 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
SearchTemplatePO templatePO = buildSearchTemplateByFields(columns);
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = new JclOrgCustomTemplatePO();
if (StringUtils.isNotBlank(templateId)) {
if (templateId.equals("-1")) {
getJclOrgCustomTemplateMapper().updateUsed("0", null, String.valueOf(user.getUID()));
if ("-1".equals(templateId)) {
getJclOrgCustomTemplateMapper().updateUsed(0,"0", null, String.valueOf(user.getUID()));
} else {
jclOrgCustomTemplatePO = getJclOrgCustomTemplateMapper().selectByPrimaryKey(Long.parseLong(templateId));
if (jclOrgCustomTemplatePO != null) {
//取消已启用模板
getJclOrgCustomTemplateMapper().updateUsed(0, "0", null, String.valueOf(user.getUID()));
if (!user.isAdmin() && jclOrgCustomTemplatePO.getOverall() != null && "1".equals(jclOrgCustomTemplatePO.getOverall().toString())) {
throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547857, user.getLanguage()));
}
jclOrgCustomTemplatePO.setId(Integer.valueOf(templateId));
jclOrgCustomTemplatePO.setBasicFields(templatePO.getBasicFields());
jclOrgCustomTemplatePO.setPersonalFields(templatePO.getPersonalFields());
jclOrgCustomTemplatePO.setWorkFields(templatePO.getWorkFields());
jclOrgCustomTemplatePO.setIsused(1);
//取消已启用模板
getJclOrgCustomTemplateMapper().updateUsed("0", null, String.valueOf(user.getUID()));
//启用当前模板
getJclOrgCustomTemplateMapper().updateByPrimaryKeySelective(jclOrgCustomTemplatePO);
}
@ -524,6 +553,19 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
return dataMap;
}
@Override
public Map<String, Object> customOverall(Map<String, Object> params) {
RecordSet rs = new RecordSet();
Map<String, Object> data = new HashMap<>(2);
//1.将已有所有人的模板状态改变
rs.executeUpdate("update jcl_org_custom_template set overall = null where overall = 1");
//2.应用当前模板到所有人
String templateId = Util.null2String(params.get("templateId"));
boolean b = rs.executeUpdate("update jcl_org_custom_template set overall = 1,isused=1 where id = ?", templateId);
data.put("result", b);
return data;
}
private List<ResourceListColumns> getTableColumns() {
List<ResourceListColumns> list = new ArrayList<>();
int language = user.getLanguage();
@ -589,9 +631,52 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
btnDatas.put("topMenu", topMenuList);
btnDatas.put("rightMenu", rightMenuList);
btnDatas.put("hasRight", true);
btnDatas.put("loginId", user.getUID());
//获取当前用户使用的列定制模板Id
btnDatas.put("customTemplateId", getCustomTemplateId());
btnDatas.put("searchTemplateId", getSearchTemplateId());
return btnDatas;
}
/**
* 使Id
*
* @return
*/
private String getCustomTemplateId() {
String customTemplateId = "-1";
SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedCustomTemplateByUser(user.getUID());
if (null != usedCustomTemplate) {
customTemplateId = usedCustomTemplate.getId().toString();
} else {
//查询全局模板
SearchTemplatePO overallCustomTemplate = getHrmResourceMapper().getOverallCustomTemplate();
if (null != overallCustomTemplate) {
customTemplateId = overallCustomTemplate.getId().toString();
}
}
return customTemplateId;
}
/**
* 使Id
*
* @return
*/
private String getSearchTemplateId() {
String searchTemplateId = "-1";
SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedSerarchTemplateByUser(user.getUID());
if (null != usedCustomTemplate) {
searchTemplateId = usedCustomTemplate.getId().toString();
}
return searchTemplateId;
}
@Override
public Map<String, Object> getTabForm(Map<String, Object> params) {
Map<String, Object> apiDatas = new HashMap<>();
@ -636,11 +721,19 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
Map<String, Object> tabInfoMap = new HashMap<>();
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, false, true));
List<JclOrgCustomTemplatePO> jclOrgCustomTemplatePOS = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAllByCreator(user.getUID());
//获取当前使用的模板过滤掉
String customTemplateId = getCustomTemplateId();
jclOrgCustomTemplatePOS = jclOrgCustomTemplatePOS.stream()
.filter(item -> !customTemplateId.equals(String.valueOf(item.getId())))
.collect(Collectors.toList());
List<Integer> isUsed = new ArrayList<>();
AtomicInteger index = new AtomicInteger(0);
List<Map<String, Object>> collect = jclOrgCustomTemplatePOS.stream().map(item -> {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.getId());
resultMap.put("viewAttr", 1);
resultMap.put("editTable", false);
resultMap.put("name", item.getName());
resultMap.put("createTime", DateUtil.getDate(item.getCreateTime(), "yyyy-MM-dd"));

@ -741,7 +741,7 @@ public class JobServiceImpl extends Service implements JobService {
OrganizationAssert.isEmpty(list, SystemEnv.getHtmlLabelName(547137, user.getLanguage()));
} else {
OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), SystemEnv.getHtmlLabelName(547430,user.getLanguage()));
//OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), SystemEnv.getHtmlLabelName(547430,user.getLanguage()));
jobNo = autoCreateCompanyNo();
}
return jobNo;

@ -5,6 +5,8 @@ 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.common.service.HrmCommonService;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam;
@ -25,6 +27,9 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.cachecenter.bean.RolemembersComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.hrm.roles.RolesComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.*;
@ -78,32 +83,63 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
@Override
public Map<String, Object> getForm(Integer id) {
Map<String, Object> apiDatas = new HashMap<>();
RolesComInfo rolesComInfo = new RolesComInfo();
List<SearchConditionItem> selectItems = new ArrayList<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionOption> selectOption = new ArrayList<>();
SearchConditionOption pOption = new SearchConditionOption("0", SystemEnv.getHtmlLabelName(547205,user.getLanguage()));
SearchConditionOption rOption = new SearchConditionOption("1", SystemEnv.getHtmlLabelName(547388,user.getLanguage()));
selectOption.add(pOption);
selectOption.add(rOption);
List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption moduleOption = new SearchConditionOption("0", SystemEnv.getHtmlLabelName(547409,user.getLanguage()), true);
selectOptions.add(moduleOption);
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547405, "1", "ecManager", "");
SearchConditionItem roleId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547388, "267", "roleId", "");
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, 547405, "1", "ecManager", "");
ecManager.setRules("required|string");
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, 547407, "194", "ecRolelevel", "");
ecRolelevel.setRules("required|string");
SearchConditionItem module = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, 547408, "module");
module.setViewAttr(1);
module.setDetailtype(2);
module.setHasBorder(true);
SearchConditionItem managerType = OrganizationFormItemUtil.selectItem(user, selectOption, 2, 16, 6, false, 513540, "managerType");
managerType.setViewAttr(3);
managerType.setRules("required|string");
selectItems.add(managerType);
if (id != null) {
ManagerDetachPO detachById = getMangeDetachMapper().getDetachById(id);
managerType.setValue(String.valueOf(detachById.getManagerType()));
managerType.setViewAttr(1);
if (detachById.getManagerType() == 0){
BrowserBean manager = ecManager.getBrowserConditionParam();
manager.setReplaceDatas(getEmployeeMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcManager())).build().getIds()));
ecManager.setBrowserConditionParam(manager);
selectItems.add(ecManager);
}else {
BrowserBean role = roleId.getBrowserConditionParam();
List<Map<String, Object>> rep = new ArrayList<>();
Integer rolesId = detachById.getEcManager();
String rolesname = rolesComInfo.getRolesRemark(String.valueOf(rolesId));
rep.add(new HashMap<String,Object>(2){{put("name",rolesname);}});
rep.add(new HashMap<String,Object>(2){{put("id",rolesId);}});
role.setReplaceDatas(rep);
roleId.setBrowserConditionParam(role);
selectItems.add(roleId);
}
BrowserBean roleLevel = ecRolelevel.getBrowserConditionParam();
roleLevel.setReplaceDatas(getSystemDataMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcRolelevel())).build().getIds()));
ecRolelevel.setBrowserConditionParam(roleLevel);
}
}else {
selectItems.add(ecManager);
selectItems.add(roleId);
}
selectItems.add(ecRolelevel);
selectItems.add(module);
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
apiDatas.put("condition", addGroups);
return apiDatas;
@ -116,10 +152,10 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
@Override
public int save(ManagerDetachParam param) {
Integer ecManager = param.getEcManager();
Integer ecManager = "0".equals(String.valueOf(param.getManagerType())) ? param.getEcManager() : param.getRoleId();
String noRepeatRoleLevel = param.getEcRolelevel();
// 判断有无重复数据
List<ManagerDetachPO> detachListById = getMangeDetachMapper().getDetachListById(ecManager);
List<ManagerDetachPO> detachListById = getMangeDetachMapper().getDetachListById(ecManager,param.getManagerType());
if (CollectionUtils.isNotEmpty(detachListById)) {
Set<String> noRepeatRoleLevels = getNoRepeatRoleLevels(detachListById, param.getId());
noRepeatRoleLevels.addAll(Arrays.asList(noRepeatRoleLevel.split(",")));
@ -128,7 +164,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
getMangeDetachMapper().deleteByIds(collect);
}
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
.managerType(0)
.managerType(param.getManagerType())
.ecManager(ecManager)
.jclManager(ecManager)
.ecRolelevel(noRepeatRoleLevel)
@ -145,10 +181,10 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
@Override
public int updateDetach(ManagerDetachParam param) {
Integer ecManager = param.getEcManager();
Integer ecManager = "0".equals(String.valueOf(param.getManagerType())) ? param.getEcManager() : param.getRoleId();
String noRepeatRoleLevel = param.getEcRolelevel();
// 判断有无重复数据
List<ManagerDetachPO> detachListById = getMangeDetachMapper().getDetachListById(ecManager);
List<ManagerDetachPO> detachListById = getMangeDetachMapper().getDetachListById(ecManager,param.getManagerType());
if (CollectionUtils.isNotEmpty(detachListById)) {
Set<String> noRepeatRoleLevels = getNoRepeatRoleLevels(detachListById,param.getId());
noRepeatRoleLevels.addAll(Arrays.asList(noRepeatRoleLevel.split(",")));
@ -212,14 +248,24 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
public static List<Integer> getJclRoleLevels(Integer uId) {
List<Integer> ecRoleLevels = new ArrayList<>();
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
//人员
List<ManagerDetachPO> detachListById = new ArrayList<>(mangeDetachMapper.getDetachListById(uId,0));
//角色
HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
List<String> roleIds = new ArrayList<>(Arrays.asList(hrmCommonService.getRoleIds(uId).split(",")));
List<Integer> integerList = roleIds.stream()
.map(Integer::parseInt)
.collect(Collectors.toList());
detachListById.addAll(MapperProxyFactory.getProxy(ManagerDetachMapper.class).selectDetachListByManager(integerList));
for (ManagerDetachPO managerDetachPO : detachListById) {
List<Integer> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Integer::parseInt).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
ecRoleLevels.addAll(ids);
}
}
return ecRoleLevels;
return ecRoleLevels.stream()
.distinct() // 去除重复元素
.collect(Collectors.toList());
}

@ -58,54 +58,29 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("companyname", rs.getString("companyname"));
fclasslist.add(item);
}
List<CompanyTreePO> companyTree = new ArrayList<>();
String sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'";
// 一级分部数据分权处理
String dimension = Util.null2String(request2Map.get("fclass"));
//版本id
String id = Util.null2String(request2Map.get("id"));
boolean isRealDimension = StringUtils.isBlank(dimension) || "0".equals(dimension);
boolean isRealTime = StringUtils.isBlank(id) || "0".equals(id);
if (isRealTime && user.getUID() != 1 && isRealDimension) {
DetachUtil detachUtil = new DetachUtil(user);
if(detachUtil.isDETACH()) {
String ids = detachUtil.getJclRoleLevels();
sql = sql + " and id in (" + ids + ")";
}
}
rs.executeQuery(sql);
while (rs.next()) {
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?", rs.getString("id"))).build());
}
result.put("api_status", true);
result.put("fclasslist", fclasslist);
result.put("companyTree", companyTree);
Map<String, Object> subCompanyTree = getSubCompanyTree(request2Map);
result.putAll(subCompanyTree);
return result;
}
@Override
public Map<String, Object> getSubCompanyTree(Map<String, Object> params) {
Map<String, Object> result = new HashMap<>(2);
RecordSet rs = new RecordSet();
List<CompanyTreePO> companyTree = new ArrayList<>();
String subcompany = Util.null2String(params.get("subcompany"));
if (StringUtils.isBlank(subcompany)) {
subcompany = "0";
List<CompanyTreePO> departmentTree = ChartServiceImpl.getDepartmentTreeList(params);
result.put("companyTree", departmentTree);
return result;
}
String fclass = Util.null2String(params.get("fclass"));
String id = Util.null2String(params.get("id"));
private String getSubCompanyTreeSql(String id, String fclass, String subcompany) {
// 是否展示当前数据
boolean isSearchCurrent = StringUtils.isBlank(id) || "0".equals(id);
String sql;
String judgeTreeLeafSql;
if (isSearchCurrent) {
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? ";
boolean isRealDimension = StringUtils.isBlank(fclass) || "0".equals(fclass);
boolean isRealTime = StringUtils.isBlank(id) || "0".equals(id);
judgeTreeLeafSql = sql;
if (isRealTime && user.getUID() != 1 && isRealDimension) {
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
@ -125,14 +100,8 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
// 添加时间轴条件
sql += " and versionid = " + id;
judgeTreeLeafSql = sql;
}
rs.executeQuery(sql, subcompany);
while (rs.next()) {
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(judgeTreeLeafSql, rs.getString("id"))).build());
}
result.put("companyTree", companyTree);
return result;
return sql;
}
private String companyDateWhereSql(Map<String, Object> request2Map) {
@ -705,16 +674,19 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
return fieldname;
}
/**
*
*
* @param sql SQL
* @param treeId ID
* @param versionId
* @param dimension
* @param subCompany
* @return
*/
private boolean judgeTreeLeaf(String sql, String treeId) {
private boolean judgeTreeLeaf(String versionId, String dimension, String subCompany) {
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, treeId);
String sql = getSubCompanyTreeSql(versionId, dimension, subCompany);
recordSet.executeQuery(sql, subCompany);
return !recordSet.next();
}

@ -17,6 +17,7 @@ import com.engine.organization.util.*;
import com.engine.organization.util.browser.OrganizationBrowserUtil;
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.common.DateUtil;
import weaver.conn.RecordSet;
@ -284,6 +285,12 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
if (null != forbiddenTag) {
sqlWhere += " AND t.forbidden_tag = '" + forbiddenTag + "'";
}
// 分权
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
String ids = detachUtil.getJclRoleLevels();
sqlWhere += " AND t.ec_company in (" + ids + ")";
}
return sqlWhere;
}
}

@ -30,6 +30,7 @@ import com.engine.organization.util.*;
import com.engine.organization.util.browser.OrganizationBrowserUtil;
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.excel.ExcelUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -81,7 +82,7 @@ public class StaffServiceImpl extends Service implements StaffService {
String outPutPath = GCONST.getRootPath() + File.separator + "hrm" + File.separator + "import" + File.separator + "template" + File.separator + "staff.xls";
File excelPathFile = new File(outPutPath);
if (!excelPathFile.exists()) {
String columns = "方案编号,方案名称,分部,部门,岗位,编制数";
String columns = "方案编号,方案名称,分部,部门,职务类型,职务,岗位,编制数";
String[] split = columns.split(",");
List<Object> columnList = new ArrayList<>(Arrays.asList(split));
// 创建导入模板
@ -437,6 +438,12 @@ public class StaffServiceImpl extends Service implements StaffService {
sqlWhere += " AND t.plan_id in ( select id from jcl_org_staffplan where plan_name " + dbType.like(staffName) + ") ";
}
// 分权
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
String ids = detachUtil.getJclRoleLevels();
sqlWhere += " AND t.ec_company in (" + ids + ")";
}
return sqlWhere;
}

@ -16,6 +16,13 @@ import weaver.hrm.definedfield.HrmFieldManager;
*/
public class HrmResourceTransMethod {
/**
*
*
* @param id
* @param para
* @return
*/
public static String getFieldTrueValue(String id, String para) {
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", Integer.parseInt(para.split("_")[0]));
String fieldName = para.substring(para.lastIndexOf("_") + 1);
@ -32,6 +39,32 @@ public class HrmResourceTransMethod {
}
}
/**
*
*
* @param id
* @param para
* @return
*/
public static String getFieldTrueValueExp(String id, String para) {
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", Integer.parseInt(para.split("_")[0]));
String fieldName = para.substring(para.lastIndexOf("_") + 1);
JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
User user = new User();
user.setUid(1);
try {
if (hfm.isBaseField(fieldName) && "jobactivity".equals(fieldName)) {
hrmFieldConf.put("type", 282);
}
String fieldvalue = hfm.getFieldvalue(null, user, null, hrmFieldConf.getString("dmlurl"), hrmFieldConf.getInt("id"), hrmFieldConf.getInt("fieldhtmltype"), hrmFieldConf.getInt("type"), id, 0, fieldName);
// fieldvalue去除Html内容
fieldvalue = fieldvalue.replaceAll("<[^>]*>", "").replaceAll("&nbsp", "");
return fieldvalue;
} catch (Exception e) {
return "";
}
}
public static String getDepartmentName(String departmentId) {
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Integer.parseInt(departmentId));
}

@ -7,6 +7,7 @@ import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.hrm.roles.RolesComInfo;
import java.util.Arrays;
import java.util.List;
@ -21,7 +22,7 @@ import java.util.stream.Collectors;
**/
public class ManagerDetachTransMethod {
public static String getManagerName(String ecManager) {
public static String getManagerName(String ecManager,String managerType) {
if (org.apache.commons.lang.StringUtils.isBlank(ecManager)) {
return "";
}
@ -29,8 +30,16 @@ public class ManagerDetachTransMethod {
if (CollectionUtils.isEmpty(collect)) {
return "";
}
if ("0".equals(managerType)) {
List<String> employeeNameById = MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(collect);
return StringUtils.join(employeeNameById, ",");
}else {
//角色
RolesComInfo rolesComInfo = new RolesComInfo();
return rolesComInfo.getRolesRemark(ecManager);
}
}

@ -11,6 +11,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
@ -470,6 +471,62 @@ public class OrganizationDateUtil {
return localDate;
}
/**
*
* @param firstDate
* @return
*/
public static String getLastMonthDate(String firstDate) {
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nextMonthDateString = "";
try {
LocalDate date = LocalDate.parse(firstDate, formatter);
LocalDate nextMonthDate = date.plusMonths(1);
nextMonthDateString = nextMonthDate.format(formatter);
} catch (DateTimeParseException e) {
e.printStackTrace();
}
return nextMonthDateString;
}
/**
*
* @param firstDate
* @return
*/
public static String getLastYearDate(String firstDate) {
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nextYearDateString = "";
try {
LocalDate date = LocalDate.parse(firstDate, formatter);
LocalDate nextYearDate = date.plusYears(1);
nextYearDateString = nextYearDate.format(formatter);
} catch (DateTimeParseException e) {
e.printStackTrace();
}
return nextYearDateString;
}
/**
*
* @return
*/
public static String dateExample(LocalDate date) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
return date.format(formatter);
}
}

@ -162,6 +162,8 @@ public class OrganizationFormItemUtil {
browser.setViewAttr(viewAttr);
browser.setIsQuickSearch(isQuickSearch);
browser.setLabel(label);
//隐藏虚拟组织
browser.getBrowserConditionParam().setHideVirtualOrg(true);
if ("161".equals(type) || "162".equals(type)) {
fieldDbType = "browser." + fieldDbType;
BrowserBean browserBean = new BrowserBean();

@ -113,6 +113,7 @@ public class ReturnResult<T> implements Serializable {
* @param data
* @return
*/
@Deprecated
public static <T> ReturnResult<T> successed(T data) {
return new ReturnResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);

@ -24,9 +24,11 @@ import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.job.JobGroupsComInfo;
import weaver.systeminfo.SystemEnv;
import java.io.IOException;
@ -49,6 +51,8 @@ public class StaffInfoImportUtil {
importFieldsMap.put("方案名称", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("plan_name").fieldNameDesc("方案名称").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("分部", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("comp_id").fieldNameDesc("分部").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("部门", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("dept_id").fieldNameDesc("部门").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职务类型", ExtendInfoPO.builder().tableName("hrmjobgroups").fieldName("jobgroupname").fieldNameDesc("职务类型").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职务", ExtendInfoPO.builder().tableName("hrmjobactivities").fieldName("jobactivityname").fieldNameDesc("职务").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("岗位", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("job_id").fieldNameDesc("岗位").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("编制数", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("staff_num").fieldNameDesc("编制数").isrequired(1).controlType(1).browserType("2").customValue("[\"input\",\"int\"]").build());
@ -88,6 +92,9 @@ public class StaffInfoImportUtil {
Long parentJobId = null;
StaffPlanPO staffPlanPO = null;
String jobactivitymark = "";
String jobgroupremark = "";
historyDetailPO.setRowNums(String.valueOf(i + 1));
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
XSSFCell cell = row.getCell((short) cellIndex);
@ -188,6 +195,16 @@ public class StaffInfoImportUtil {
map.put("ec_department", parentDepartmentId);
}
//职务类型
if ("jobgroupname".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) {
jobgroupremark = cellValue;
}
//职务
if ("jobactivityname".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) {
jobactivitymark = cellValue;
}
// 岗位
if ("job_id".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) {
if (null == parentCompanyId) {
@ -205,7 +222,8 @@ public class StaffInfoImportUtil {
continue nextRow;
}
for (String s : split) {
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId
,jobactivitymark,jobgroupremark);
if (null == parentJobId) {
historyDetailPO.setOperateDetail(s + "岗位未找到对应数据");
historyDetailPO.setStatus("0");
@ -335,8 +353,14 @@ public class StaffInfoImportUtil {
item.put("value", value);
itemList.add(item);
}
Map<String, Object> other = new HashMap<>();
other.put("index", (lsPromptLabel.size() + 1));
other.put("value", "注意:岗位维度编制信息导入时引入职务类型和职务判断,导入时请先去除多语言,否则无法找到对应岗位");
itemList.add(other);
groupItem.put("items", itemList);
lsGroup.add(groupItem);
return lsGroup;
}
}

@ -286,8 +286,7 @@ public class HrmResourceController {
public ReturnResult saveCustomTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SearchTemplateParam params) {
try {
User user = HrmUserVarify.getUser(request, response);
Integer templateId = getHrmResourceWrapper(user).saveCustomTemplate(params);
return ReturnResult.successed(user,Util.null2String(templateId));
return ReturnResult.successed(user,getHrmResourceWrapper(user).saveCustomTemplate(params));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
@ -374,4 +373,18 @@ public class HrmResourceController {
}
}
@POST
@Path("/customOverall")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult customOverall(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(user,getHrmResourceWrapper(user).customOverall(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -12,10 +12,7 @@ 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.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
@ -100,6 +97,24 @@ public class OrgChartController {
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/versionDelete")
@Produces(MediaType.APPLICATION_JSON)
public String versionDelete(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("versionId") Integer versionId) {
Map<String, Object> apidatas = new HashMap<>(4);
try {
User user = HrmUserVarify.getUser(request, response);
apidatas = getOrgChartWrapper(user).versionDelete(versionId);
apidatas.put("api_status", true);
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/getSubCompanyTree")

@ -91,7 +91,7 @@ public class HrmResourceWrapper extends OrganizationWrapper {
return getHrmResourceService(user).getSearchTemplate(params);
}
public Integer saveCustomTemplate(SearchTemplateParam params) {
public Map<String, Object> saveCustomTemplate(SearchTemplateParam params) {
return getHrmResourceService(user).saveCustomTemplate(params);
}
@ -114,4 +114,8 @@ public class HrmResourceWrapper extends OrganizationWrapper {
public Integer saveColumnsCustomTemplate(Map<String,Object> params) {
return getHrmResourceService(user).saveColumnsCustomTemplate(params);
}
public Object customOverall(Map<String, Object> params) {
return getHrmResourceService(user).customOverall(params);
}
}

@ -94,4 +94,8 @@ public class OrgChartWrapper extends Service {
public Map<Integer, HrmLabelVO> selectLabel() {
return getChartService(user).selectLabel();
}
public Map<String, Object> versionDelete(Integer versionId) {
return getChartService(user).versionDelete(versionId);
}
}

@ -0,0 +1,70 @@
package weaver.interfaces.organization.cronjob;
import com.engine.organization.service.impl.ChartServiceImpl;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationDateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.ArrayList;
import java.util.List;
/**
* @Author liang.cheng
* @Date 2024/8/1 3:12 PM
* @Description:
* @Version 1.0
*/
public class OrgVersionDeleteCron extends BaseCronJob {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public void execute() {
RecordSet rs = new RecordSet();
List<Integer> idList = new ArrayList<>();
String createTime = "";
rs.executeQuery("select id,createtime from jcl_org_chartversion order by createtime asc");
if (rs.next()){
idList.add(Util.getIntValue(rs.getString("id")));
createTime = Util.null2String(rs.getString("createtime"));
}
OrganizationAssert.notEmpty(idList,"未查询到组织架构图历史版本");
//1.type=1 删除最早版本记录日期
//2.type=2 删除最早版本日期--往后一个月的数据
if("2".equals(type)){
String lastMonthDate = OrganizationDateUtil.getLastMonthDate(createTime);
rs.executeQuery("select id from jcl_org_chartversion where createtime >= ? and createtime <= ?",createTime,lastMonthDate);
while (rs.next()) {
idList.add(Util.getIntValue(rs.getString("id")));
}
}
//3.type=3 删除最早版本日期--往后一年的数据
if("3".equals(type)){
String lastYearDate = OrganizationDateUtil.getLastYearDate(createTime);
rs.executeQuery("select id from jcl_org_chartversion where createtime >= ? and createtime <= ?",createTime,lastYearDate);
while (rs.next()) {
idList.add(Util.getIntValue(rs.getString("id")));
}
}
//删除数据
ChartServiceImpl chartService = new ChartServiceImpl();
idList.forEach(chartService::versionDelete);
}
}

@ -0,0 +1,39 @@
package weaver.interfaces.organization.cronjob;
import com.engine.organization.service.impl.ChartServiceImpl;
import com.engine.organization.util.OrganizationDateUtil;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2024/8/2 9:39 AM
* @Description:
* @Version 1.0
*/
public class OrgVersionRecordCron extends BaseCronJob {
@Override
public void execute() {
ChartServiceImpl chartService = new ChartServiceImpl();
User user = new User();
user.setUid(1);
// 获取当前日期
LocalDate today = LocalDate.now();
String example = OrganizationDateUtil.dateExample(today);
String description = "版本自动记录"+example;
Map<String, Object> params = new HashMap<String, Object>(){
{
put("description",description);
}};
chartService.versionRecord(params,user);
}
}
Loading…
Cancel
Save