Compare commits

...

16 Commits

Author SHA1 Message Date
Chengliang 106cc111f3 部门管理页面台账 名称与简称不符 3 weeks ago
wangjie 3a8fa123ee #上海港湾编制新增【用工性质】维度 3 weeks ago
Chengliang 26dc405ba0 Merge branch 'feature/geoharbour' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour 2 months ago
Chengliang fd51b718fc 上海港湾多语言优化 2 months ago
wangjie e474007b05 #上海港湾编制需求 去掉岗位 6 months ago
Chengliang 4da963b031 多语言完善 10 months ago
Chengliang b55d2cabfa 多语言修改 10 months ago
dxfeng 3c7dc642a0 Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour 10 months ago
dxfeng 5495164437 Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour 10 months ago
dxfeng 412af567f8 Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour 11 months ago
dxfeng cd87843b3f Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour 11 months ago
dxfeng 49955f6d91 Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour
 Conflicts:
	src/com/engine/organization/entity/staff/vo/StaffTableVO.java
11 months ago
dxfeng c0a5d802f4 Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour 11 months ago
wangjie be31595cb0 #上海港湾编制需求 11 months ago
Chengliang a816b4eeee 上海港湾二开抽屉页面去除岗位维度 岗位取值建模职位名称 1 year ago
Mlin 2918d6392b 港湾架构改造 1 year ago

@ -0,0 +1,78 @@
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.time.util.DateUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%--
User: wangj
Design Ideas
入转调流程提交编制校验规则
1、根据流程创建时间查询生效的编制方案。
不存在:提示不存在当年已启用的编制方案 不允许提交
存在:
1.1、根据编制方案查询部门的编制信息。
查询到部门的具体编制信息:判断是否强控,超编限制流程提交。
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%
BaseBean bb = new BaseBean();
boolean flag = true;
String msg = "";
User user = HrmUserVarify.getUser(request,response);
Map<String,Object> res = new HashMap<>(100);
String requestid = Util.null2String(request.getParameter("requestid"));
String createdate = getWfRequestDate(requestid);
//1、根据流程创建时间查询生效的编制方案。
String planid = getStaffPlanId(createdate);
if("".equals(planid)){
flag = false;
msg = "不存在流程创建日期范围内已启用的编制方案,禁止提交!";
}
res.put("flag",flag);
res.put("msg",msg);
out.print(JSONObject.toJSONString(res));
%>
<%!
private String getWfRequestDate(String requestid){
String date = "";
if("".equals(requestid)){
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '"+requestid+"'";
rs.execute(sql);
while (rs.next()){
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
%>
<%!
private String getStaffPlanId(String createdate){
String planid = "";
String sql = "select id,ec_company,control_dimension from jcl_org_staffplan where forbidden_tag = 0 and control_dimension = 2 and time_end >= ? and time_start <= ?";
RecordSet rs = new RecordSet();
rs.executeQuery(sql,createdate,createdate);
while (rs.next()){
planid = Util.null2String(rs.getString("id"));
}
return planid;
}
%>

@ -0,0 +1,13 @@
package com.api.shgw.web;
import com.engine.shgw.web.OrgStaffAction;
import javax.ws.rs.Path;
/**
*
*/
@Path("/orgStaff")
public class OrgStaffApi extends OrgStaffAction {
}

@ -51,6 +51,7 @@ public class ChartPO {
private int onJobNum; private int onJobNum;
// 编制数 // 编制数
private int staffNum; private int staffNum;
private String jobName;
public String getId() { public String getId() {
if (StringUtils.isNotBlank(ftype)) { if (StringUtils.isNotBlank(ftype)) {

@ -1,6 +1,5 @@
package com.engine.organization.entity.chart; package com.engine.organization.entity.chart;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;

@ -34,9 +34,9 @@ public class DepartmentListDTO {
private Integer isUsed; private Integer isUsed;
/** /**
* *
*/ */
@TableTitle(labelId = 547141, title = "名称", dataIndex = "departmentMark", key = "departmentMark", width = "200") @TableTitle(labelId = 547181, title = "简称", dataIndex = "departmentMark", key = "departmentMark", width = "200")
private String departmentMark; private String departmentMark;
/** /**
@ -46,9 +46,9 @@ public class DepartmentListDTO {
private String departmentCode; private String departmentCode;
/** /**
* *
*/ */
@TableTitle(labelId = 547181, title = "简称", dataIndex = "departmentName", key = "departmentName") @TableTitle(labelId = 547141, title = "名称", dataIndex = "departmentName", key = "departmentName")
private String departmentName; private String departmentName;
/** /**

@ -42,7 +42,7 @@ import lombok.NoArgsConstructor;
public class ManagerDetachVO { public class ManagerDetachVO {
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键",column = "id", display = false)
private Long id; private Long id;

@ -32,7 +32,7 @@ import lombok.NoArgsConstructor;
) )
public class EmployeeTableVO { public class EmployeeTableVO {
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
@OrganizationTableColumn(labelId = 547329, text = "姓名", width = "25%", column = "lastname") @OrganizationTableColumn(labelId = 547329, text = "姓名", width = "25%", column = "lastname")

@ -3,6 +3,8 @@ package com.engine.organization.entity.hrmresource.bo;
import com.engine.organization.entity.hrmresource.po.ResourceChartPO; import com.engine.organization.entity.hrmresource.po.ResourceChartPO;
import com.engine.organization.entity.hrmresource.vo.ResourceChartVO; import com.engine.organization.entity.hrmresource.vo.ResourceChartVO;
import com.engine.organization.transmethod.HrmResourceTransMethod; import com.engine.organization.transmethod.HrmResourceTransMethod;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util; import weaver.general.Util;
import java.util.ArrayList; import java.util.ArrayList;
@ -19,13 +21,14 @@ public class ResourceChartBO {
List<ResourceChartVO> resourceChartVOS = new ArrayList<>(); List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
for (ResourceChartPO resourceChartPO : resourceChartPOS) { for (ResourceChartPO resourceChartPO : resourceChartPOS) {
ResourceChartVO resourceChartVO = new ResourceChartVO(); ResourceChartVO resourceChartVO = new ResourceChartVO();
resourceChartVO.setId(resourceChartPO.getId()); resourceChartVO.setId(resourceChartPO.getId());
resourceChartVO.setWorkCode(resourceChartPO.getWorkCode()); resourceChartVO.setWorkCode(resourceChartPO.getWorkCode());
resourceChartVO.setLastName(resourceChartPO.getLastName()); resourceChartVO.setLastName(resourceChartPO.getLastName());
resourceChartVO.setSex("1".equals(resourceChartPO.getSex()) ? "女" : "男"); resourceChartVO.setSex("1".equals(resourceChartPO.getSex()) ? "女" : "男");
resourceChartVO.setDepartmentName(HrmResourceTransMethod.getDepartmentName(Util.null2String(resourceChartPO.getDepartmentId()))); resourceChartVO.setDepartmentName(HrmResourceTransMethod.getDepartmentName(Util.null2String(resourceChartPO.getDepartmentId())));
resourceChartVO.setSubcompanyName(HrmResourceTransMethod.getCompanyName(Util.null2String(resourceChartPO.getSubcompanyid1()))); resourceChartVO.setSubcompanyName(HrmResourceTransMethod.getCompanyName(Util.null2String(resourceChartPO.getSubcompanyid1())));
resourceChartVO.setJobTitle(HrmResourceTransMethod.getJobName(Util.null2String(resourceChartPO.getJobTitle()))); resourceChartVO.setJobTitle(selectCustomName(resourceChartPO.getId()));
resourceChartVO.setStatus(resourceChartPO.getStatus()); resourceChartVO.setStatus(resourceChartPO.getStatus());
resourceChartVO.setMobile(resourceChartPO.getMobile()); resourceChartVO.setMobile(resourceChartPO.getMobile());
resourceChartVOS.add(resourceChartVO); resourceChartVOS.add(resourceChartVO);
@ -34,4 +37,25 @@ public class ResourceChartBO {
} }
/**
* uf_zwxxjmb
*/
private static String selectCustomName(long id){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String scopeid = bb.getPropValue("hrmOrganization", "scopeid");
String fieldid = bb.getPropValue("hrmOrganization", "fieldid");
String jobName = "";
rs.executeQuery("select c.zwmc as jobname from hrmresource a \n" +
"left join cus_fielddata b on a.id = b.id and b.scopeid = "+scopeid+"\n" +
"left join uf_zwxxjmb c on b."+fieldid+" = c.id\n" +
"where a.status < 4 and a.id = ?",id);
if (rs.next()){
jobName = rs.getString("jobname");
}
return jobName;
}
} }

@ -45,7 +45,7 @@ public class HrmResourceVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
/** /**

@ -44,7 +44,7 @@ public class ScHrmResourceVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
/** /**

@ -25,7 +25,7 @@ import lombok.NoArgsConstructor;
primarykey = "id" primarykey = "id"
) )
public class JclImportHistoryDetailVO { public class JclImportHistoryDetailVO {
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
@OrganizationTableColumn(text = "行", width = "15%", column = "row_nums") @OrganizationTableColumn(text = "行", width = "15%", column = "row_nums")
private String rowNums; private String rowNums;

@ -37,7 +37,7 @@ import lombok.NoArgsConstructor;
) )
public class CardAccessVO { public class CardAccessVO {
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
@OrganizationTableColumn(labelId = 547389, text = "栏目", width = "15%", column = "type_name",transmethod = "com.engine.organization.transmethod.CardAccessTrans.getMultiLanguage",multiLanguage = true) @OrganizationTableColumn(labelId = 547389, text = "栏目", width = "15%", column = "type_name",transmethod = "com.engine.organization.transmethod.CardAccessTrans.getMultiLanguage",multiLanguage = true)

@ -43,7 +43,7 @@ public class PostInfoTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
/** /**
* *

@ -43,7 +43,7 @@ public class GradeTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键", column = "id", display = false)
private Long id; private Long id;
/** /**
* *

@ -40,7 +40,7 @@ public class LevelTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键",column = "id", display = false)
private Long id; private Long id;
/** /**
* *

@ -40,7 +40,7 @@ public class SchemeTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键",column = "id", display = false)
private Long id; private Long id;
/** /**
* *

@ -47,7 +47,7 @@ public class SequenceTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键",column = "id", display = false)
private Long id; private Long id;
/** /**
* *

@ -26,6 +26,7 @@ public class StaffBO {
.ecDepartment(param.getEcDepartment()) .ecDepartment(param.getEcDepartment())
.jobId(param.getJobId()) .jobId(param.getJobId())
.staffNum(param.getStaffNum()) .staffNum(param.getStaffNum())
.workRelation(param.getWorkRelation())
.controlPolicy(param.getControlPolicy()) .controlPolicy(param.getControlPolicy())
.permanentNum(param.getPermanentNum() == null ? 0 : param.getPermanentNum()) .permanentNum(param.getPermanentNum() == null ? 0 : param.getPermanentNum())
.freezeNum(param.getFreezeNum() == null ? 0 : param.getFreezeNum()) .freezeNum(param.getFreezeNum() == null ? 0 : param.getFreezeNum())

@ -29,6 +29,8 @@ public class StaffOutParam {
private Integer job; private Integer job;
private Integer workRelation;
/** /**
* 1 2 3 * 1 2 3
*/ */

@ -34,6 +34,11 @@ public class StaffParams {
*/ */
private Integer deptId; private Integer deptId;
private Integer ecDepartment; private Integer ecDepartment;
/**
*
*/
private Integer workRelation;
/** /**
* *
*/ */

@ -58,6 +58,11 @@ public class StaffSerachParam {
* *
*/ */
private Integer lackStatus; private Integer lackStatus;
/**
*
*/
private Integer workRelation;
/** /**
* *
*/ */

@ -36,6 +36,11 @@ public class StaffPO {
*/ */
private Integer deptId; private Integer deptId;
private Integer ecDepartment; private Integer ecDepartment;
/**
*
*/
private Integer workRelation;
/** /**
* *
*/ */

@ -36,7 +36,7 @@ public class StaffPlanTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键",column = "id", display = false)
private Long id; private Long id;
/** /**
* *

@ -1,7 +1,9 @@
package com.engine.organization.entity.staff.vo; package com.engine.organization.entity.staff.vo;
import com.cloudstore.eccom.pc.table.WeaTableType; import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.organization.annotation.*; import com.engine.organization.annotation.OrganizationTable;
import com.engine.organization.annotation.OrganizationTableColumn;
import com.engine.organization.annotation.OrganizationTableOperate;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -18,7 +20,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@OrganizationTable(pageId = "0cdfd5bb-dc09-11ec-b69e-00ffcbed7508", @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.work_relation,t.permanent_num,t.freeze_num,t.lack_status,t.staff_desc",
fromSql = "FROM jcl_org_staff t inner join jcl_org_staffplan s on t.plan_id = s.id", fromSql = "FROM jcl_org_staff t inner join jcl_org_staffplan s on t.plan_id = s.id",
orderby = "id desc", orderby = "id desc",
primarykey = "id", primarykey = "id",
@ -33,7 +35,7 @@ public class StaffTableVO {
/** /**
* *
*/ */
//@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(labelId = 21027, text = "主键", column = "id", display = false)
private Long id; private Long id;
/** /**
* *
@ -60,11 +62,17 @@ public class StaffTableVO {
*/ */
@OrganizationTableColumn(labelId = 547331, text = "部门", width = "10%", column = "dept_id", transmethod = "com.engine.organization.transmethod.DepartmentTransMethod.getSpanById") @OrganizationTableColumn(labelId = 547331, text = "部门", width = "10%", column = "dept_id", transmethod = "com.engine.organization.transmethod.DepartmentTransMethod.getSpanById")
private String deptId; private String deptId;
// /**
// * 岗位
// */
// @OrganizationTableColumn(labelId = 547333, text = "岗位", width = "10%", column = "job_id", transmethod = "com.engine.organization.transmethod.JobTransMethod.getSpanById")
// private String jobId;
/** /**
* *
*/ */
@OrganizationTableColumn(labelId = 547333, text = "岗位", width = "10%", column = "job_id", transmethod = "com.engine.organization.transmethod.JobTransMethod.getSpanById") @OrganizationTableColumn(labelId = -85075, text = "用工关系", width = "10%", column = "work_relation", transmethod = "com.engine.organization.transmethod.WorkRelationTransMethod.getSpanById")
private String jobId; private Integer workRelation;
/** /**
* *
*/ */
@ -83,12 +91,12 @@ public class StaffTableVO {
/** /**
* *
*/ */
@OrganizationTableColumn(labelId = 547348, text = "缺编状态", width = "20%", column = "lack_status", transmethod = "com.engine.organization.transmethod.StaffTransMethod.getLackSpan",multiLanguage = true) @OrganizationTableColumn(labelId = 547348, text = "缺编状态", width = "20%", column = "lack_status", transmethod = "com.engine.organization.transmethod.StaffTransMethod.getLackSpan", multiLanguage = true)
private String lackStatus; private String lackStatus;
/** /**
* *
*/ */
@OrganizationTableColumn(labelId = 547349, text = "编制描述", width = "10%", column = "staff_desc") @OrganizationTableColumn(labelId = 547349, text = "编制描述", width = "10%", column = "staff_desc", display = false)
private String staffDesc; private String staffDesc;
} }

@ -41,7 +41,7 @@ public interface StaffMapper {
* @param: [planId, companyId, departmentId, jobId] * @param: [planId, companyId, departmentId, jobId]
* @return: com.engine.organization.entity.staff.po.StaffPO * @return: com.engine.organization.entity.staff.po.StaffPO
*/ */
List<StaffPO> customSelect(@Param("planId") Integer planId,@Param("companyId") Integer companyId, @Param("departmentId") Integer departmentId, @Param("jobId") Integer jobId); List<StaffPO> customSelect(@Param("planId") Integer planId,@Param("companyId") Integer companyId, @Param("departmentId") Integer departmentId, @Param("jobId") Integer jobId,@Param("workRelation") Integer workRelation);
/** /**
* *

@ -7,6 +7,7 @@
<result column="comp_id" property="compId"/> <result column="comp_id" property="compId"/>
<result column="ec_company" property="ecCompany"/> <result column="ec_company" property="ecCompany"/>
<result column="ec_department" property="ecDepartment"/> <result column="ec_department" property="ecDepartment"/>
<result column="work_relation" property="workRelation"/>
<result column="job_id" property="jobId"/> <result column="job_id" property="jobId"/>
<result column="staff_num" property="staffNum"/> <result column="staff_num" property="staffNum"/>
<result column="control_policy" property="controlPolicy"/> <result column="control_policy" property="controlPolicy"/>
@ -30,6 +31,7 @@
, t.comp_id , t.comp_id
, t.ec_company , t.ec_company
, t.dept_id , t.dept_id
, t.work_relation
, t.ec_department , t.ec_department
, t.job_id , t.job_id
, t.staff_num , t.staff_num
@ -85,6 +87,9 @@
<if test="jobId != null"> <if test="jobId != null">
and job_id = #{jobId} and job_id = #{jobId}
</if> </if>
<if test="workRelation != null">
and work_relation = #{workRelation}
</if>
</select> </select>
@ -108,6 +113,7 @@
comp_id=#{compId}, comp_id=#{compId},
ec_company=#{ecCompany}, ec_company=#{ecCompany},
dept_id=#{deptId}, dept_id=#{deptId},
work_relation=#{workRelation},
ec_department=#{ecDepartment}, ec_department=#{ecDepartment},
job_id=#{jobId}, job_id=#{jobId},
staff_num=#{staffNum}, staff_num=#{staffNum},
@ -149,6 +155,9 @@
<if test="ecCompany != null "> <if test="ecCompany != null ">
ec_company, ec_company,
</if> </if>
<if test="workRelation != null ">
work_relation,
</if>
<if test="ecDepartment != null "> <if test="ecDepartment != null ">
ec_department, ec_department,
</if> </if>
@ -203,6 +212,9 @@
<if test="ecCompany != null "> <if test="ecCompany != null ">
#{ecCompany}, #{ecCompany},
</if> </if>
<if test="workRelation != null ">
#{workRelation},
</if>
<if test="ecDepartment != null "> <if test="ecDepartment != null ">
#{ecDepartment}, #{ecDepartment},
</if> </if>
@ -272,6 +284,9 @@
<if test="staffNum != null "> <if test="staffNum != null ">
staff_num, staff_num,
</if> </if>
<if test="workRelation != null ">
work_relation,
</if>
<if test="controlPolicy != null "> <if test="controlPolicy != null ">
control_policy, control_policy,
</if> </if>

@ -304,19 +304,19 @@ public class ChartServiceImpl extends Service implements ChartService {
// 遍历岗位、查询对应岗位下的人员 // 遍历岗位、查询对应岗位下的人员
if (isRealTime) { if (isRealTime) {
if (isRealDimension) { if (isRealDimension) {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?"; sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,b.jobtitlename as jobname from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?";
} else { } else {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?"; sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,b.jobtitlename as jobname from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?";
} }
} else { } else {
sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and a.jobtitleid = ? and versionid = " + versionId; sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear,a.jobtitle as jobname from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and a.jobtitleid = ? and versionid = " + versionId;
} }
for (ChartPO jobTitlePO : jobTitleList) { for (ChartPO jobTitlePO : jobTitleList) {
resourceNum = 0; resourceNum = 0;
rs.executeQuery(sql, departmentId, jobTitlePO.getFobjid()); rs.executeQuery(sql, departmentId, jobTitlePO.getFobjid());
String parentId = departmentId + "_" + jobTitlePO.getFobjid(); String parentId = departmentId + "_" + jobTitlePO.getFobjid();
while (rs.next()) { while (rs.next()) {
ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), parentId, rs.getString("belongto"), rs.getString("companyworkyear")); ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), parentId, rs.getString("belongto"), rs.getString("companyworkyear"),rs.getString("jobname"));
resourceNum++; resourceNum++;
dataList.add(chartPO); dataList.add(chartPO);
} }
@ -327,18 +327,30 @@ public class ChartServiceImpl extends Service implements ChartService {
departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0"); departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0");
} else { } else {
// 直接查询岗位下的人员 // 直接查询岗位下的人员
BaseBean bb = new BaseBean();
String scopeid = bb.getPropValue("hrmOrganization", "scopeid");
String fieldid = bb.getPropValue("hrmOrganization", "fieldid");
if (isRealTime) { if (isRealTime) {
if (isRealDimension) { if (isRealDimension) {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? "; sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,c.zwmc as jobname \n" +
" from hrmresource a \n" +
" left join cus_fielddata b on a.id = b.id and b.scopeid = +"+scopeid+"\n" +
" left join uf_zwxxjmb c on b."+fieldid+" = c.id\n" +
" where a.status < 4 and a.departmentid = ?";
} else { } else {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? "; sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,d.zwmc as jobname \n" +
" from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid \n" +
" left join cus_fielddata c on a.id = c.id and c.scopeid = +"+scopeid+"\n" +
" left join uf_zwxxjmb d on c."+fieldid+" = d.id\n" +
" where a.status < 4 and b.departmentid = ?";
} }
} else { } else {
sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = " + versionId; sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = " + versionId;
} }
rs.executeQuery(sql, departmentId); rs.executeQuery(sql, departmentId);
while (rs.next()) { while (rs.next()) {
ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), rootId, rs.getString("belongto"), rs.getString("companyworkyear")); ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), rootId, rs.getString("belongto"), rs.getString("companyworkyear"),rs.getString("jobname"));
dataList.add(chartPO); dataList.add(chartPO);
departmentOnJob++; departmentOnJob++;
} }
@ -370,7 +382,7 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param companyWorkYear * @param companyWorkYear
* @return * @return
*/ */
private ChartPO getResourceChartPO(String id, String name, String parentId, String belongTo, String companyWorkYear) { private ChartPO getResourceChartPO(String id, String name, String parentId, String belongTo, String companyWorkYear,String jobName) {
ChartPO chartPO = new ChartPO(); ChartPO chartPO = new ChartPO();
chartPO.setFtype("4"); chartPO.setFtype("4");
chartPO.setFobjid(id); chartPO.setFobjid(id);
@ -382,6 +394,7 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setHasChildren("0"); chartPO.setHasChildren("0");
chartPO.setBelongto(Util.null2String(belongTo)); chartPO.setBelongto(Util.null2String(belongTo));
chartPO.setCompanyWorkYear(companyWorkYear); chartPO.setCompanyWorkYear(companyWorkYear);
chartPO.setJobName(jobName);
try { try {
chartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(chartPO.getId())); chartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(chartPO.getId()));
} catch (Exception e) { } catch (Exception e) {
@ -636,7 +649,7 @@ public class ChartServiceImpl extends Service implements ChartService {
Map<Integer, HrmLabelVO> labelData = new HashMap<>(); Map<Integer, HrmLabelVO> labelData = new HashMap<>();
//labelId集合 //labelId集合
List<Integer> labelIds = Arrays.asList(547190,547194,547196,547262,547282,547283,547284,547285,547286,547287,547292,547293,547294,547296,547298,547299,547300,547301,547302,547303,547304,547305,547307,547310,547313,547314,547315,547316,547317, List<Integer> labelIds = Arrays.asList(547190,547194,547196,547262,547282,547283,547284,547285,547286,547287,547292,547293,547294,547296,547298,547299,547300,547301,547302,547303,547304,547305,547307,547310,547313,547314,547315,547316,547317,
547318,547319,547320,547321,547322,547323,547324,547326,547327,547328,547329,547330,547331,547332,547333,547334,547345,547346,547447,547468,547473,547475,547476,547477,547478,547478,547264,547265,547463,547464,547465, 547318,547319,547320,547321,547322,547333,547323,547324,547326,547327,547328,547329,547330,547331,547332,547333,547334,547345,547346,547447,547448,547468,547473,547475,547476,547477,547478,547478,547264,547265,547463,547464,547465,
547480,547481,547482,547483,547484,547485,547486,547487,547488,547489,547490,547491,547492,547493,547494,547495,547505,547506,547507,547508,547509,547510,547512,547513,547514,547515,547516,547517,547518,547519,547520,547521,547522,547523,547524,547525, 547480,547481,547482,547483,547484,547485,547486,547487,547488,547489,547490,547491,547492,547493,547494,547495,547505,547506,547507,547508,547509,547510,547512,547513,547514,547515,547516,547517,547518,547519,547520,547521,547522,547523,547524,547525,
547526); 547526);
labelIds.forEach(item -> { labelIds.forEach(item -> {

@ -222,7 +222,7 @@ public class FunctionOutStaffServiceImpl {
} }
private StaffPO select(StaffOutParam param) { private StaffPO select(StaffOutParam param) {
List<StaffPO> staffPO = staffMapper().customSelect(param.getPlanId(), param.getCompany(), param.getDepartment(), param.getJob()); List<StaffPO> staffPO = staffMapper().customSelect(param.getPlanId(), param.getCompany(), param.getDepartment(), param.getJob(),param.getWorkRelation());
OrganizationAssert.notEmpty(staffPO,SystemEnv.getHtmlLabelName(547474,user.getLanguage())); OrganizationAssert.notEmpty(staffPO,SystemEnv.getHtmlLabelName(547474,user.getLanguage()));
return staffPO.get(0); return staffPO.get(0);
} }

@ -134,10 +134,10 @@ public class StaffServiceImpl extends Service implements StaffService {
public int saveStaff(StaffParams param) { public int saveStaff(StaffParams param) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID()); StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, SystemEnv.getHtmlLabelName(547449,user.getLanguage())); OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, SystemEnv.getHtmlLabelName(547449, user.getLanguage()));
List<StaffPO> verify = getStaffMapper().customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId()); List<StaffPO> verify = getStaffMapper().customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId(), param.getWorkRelation());
if (!verify.isEmpty()) { if (!verify.isEmpty()) {
throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547450,user.getLanguage())); throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547450, user.getLanguage()));
} }
checkRequired(staffPO); checkRequired(staffPO);
int ignoreNull = getStaffMapper().insertIgnoreNull(staffPO); int ignoreNull = getStaffMapper().insertIgnoreNull(staffPO);
@ -149,7 +149,7 @@ public class StaffServiceImpl extends Service implements StaffService {
@Override @Override
public int updateStaff(StaffParams param) { public int updateStaff(StaffParams param) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
List<StaffPO> verify = getStaffMapper().customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId()); List<StaffPO> verify = getStaffMapper().customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId(), param.getWorkRelation());
if (verify.size() > 1) { if (verify.size() > 1) {
throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547451, user.getLanguage())); throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547451, user.getLanguage()));
} }
@ -172,13 +172,17 @@ public class StaffServiceImpl extends Service implements StaffService {
// 更新编制表 // 更新编制表
staffPO.setStaffNum(staffPO.getStaffNum() + changeNum); staffPO.setStaffNum(staffPO.getStaffNum() + changeNum);
} }
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, SystemEnv.getHtmlLabelName(547452,user.getLanguage())); OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, SystemEnv.getHtmlLabelName(547452, user.getLanguage()));
StaffBO.buildStaffDesc(staffPO); StaffBO.buildStaffDesc(staffPO);
if (staffPO.getControlPolicy().equals(HARDCONTROLLER) && staffPO.getStaffNum() < (staffPO.getPermanentNum() + staffPO.getFreezeNum())){ if (staffPO.getControlPolicy().equals(HARDCONTROLLER) && staffPO.getStaffNum() < (staffPO.getPermanentNum() + staffPO.getFreezeNum())) {
throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547453,user.getLanguage())); throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547453, user.getLanguage()));
} }
// 更新主表 // 更新主表
int updateStaff = getStaffMapper().updateStaff(staffPO); int updateStaff = getStaffMapper().updateStaff(staffPO);
// 初始化编制在编数
initStaffInfo(staffPO);
return updateStaff; return updateStaff;
} }
@ -186,7 +190,7 @@ public class StaffServiceImpl extends Service implements StaffService {
@Override @Override
public int deleteByIds(Collection<Long> ids) { public int deleteByIds(Collection<Long> ids) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
OrganizationAssert.notEmpty(ids, SystemEnv.getHtmlLabelName(547138,user.getLanguage())); OrganizationAssert.notEmpty(ids, SystemEnv.getHtmlLabelName(547138, user.getLanguage()));
return getStaffMapper().deleteByIds(ids); return getStaffMapper().deleteByIds(ids);
} }
@ -211,13 +215,18 @@ public class StaffServiceImpl extends Service implements StaffService {
SearchConditionItem freezeNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 2, 547347, "freezeNum"); SearchConditionItem freezeNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 2, 547347, "freezeNum");
// 缺编状态 // 缺编状态
List<SearchConditionOption> selectOptions = new ArrayList<>(); List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption lackOption = new SearchConditionOption("1", SystemEnv.getHtmlLabelName(547351,user.getLanguage())); SearchConditionOption lackOption = new SearchConditionOption("1", SystemEnv.getHtmlLabelName(547351, user.getLanguage()));
SearchConditionOption fullOption = new SearchConditionOption("2", SystemEnv.getHtmlLabelName(547350,user.getLanguage())); SearchConditionOption fullOption = new SearchConditionOption("2", SystemEnv.getHtmlLabelName(547350, user.getLanguage()));
SearchConditionOption overOption = new SearchConditionOption("3", SystemEnv.getHtmlLabelName(547352,user.getLanguage())); SearchConditionOption overOption = new SearchConditionOption("3", SystemEnv.getHtmlLabelName(547352, user.getLanguage()));
selectOptions.add(lackOption); selectOptions.add(lackOption);
selectOptions.add(fullOption); selectOptions.add(fullOption);
selectOptions.add(overOption); selectOptions.add(overOption);
SearchConditionItem lackStatusItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, 547348, "lackStatus"); SearchConditionItem lackStatusItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, 547348, "lackStatus");
//自定义字段 用工关系
List<SearchConditionOption> workRelationSelectOptions = getWorkRelationSelectOptions();
SearchConditionItem workRelationItem = OrganizationFormItemUtil.selectItem(user, workRelationSelectOptions, 2, 16, 6, false, -85075, "workRelation");
// 编制描述 // 编制描述
SearchConditionItem staffDescItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, 547349, "staffDesc"); SearchConditionItem staffDescItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, 547349, "staffDesc");
// 说明 // 说明
@ -225,7 +234,8 @@ public class StaffServiceImpl extends Service implements StaffService {
conditionItems.add(compIdItem); conditionItems.add(compIdItem);
conditionItems.add(deptIdItem); conditionItems.add(deptIdItem);
conditionItems.add(jobIdItem); // conditionItems.add(jobIdItem);
conditionItems.add(workRelationItem);
conditionItems.add(staffNumItem); conditionItems.add(staffNumItem);
conditionItems.add(permanentNumItem); conditionItems.add(permanentNumItem);
conditionItems.add(freezeNumItem); conditionItems.add(freezeNumItem);
@ -253,6 +263,15 @@ public class StaffServiceImpl extends Service implements StaffService {
SearchConditionItem ecCompanyItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547332, "164", "ecCompany", "compBrowser"); SearchConditionItem ecCompanyItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547332, "164", "ecCompany", "compBrowser");
// 部门 // 部门
SearchConditionItem ecDepartmentItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547331, "4", "ecDepartment", "deptBrowser"); SearchConditionItem ecDepartmentItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547331, "4", "ecDepartment", "deptBrowser");
//自定义字段 用工关系
List<SearchConditionOption> workRelationSelectOptions = getWorkRelationSelectOptions();
SearchConditionItem workRelationItem = OrganizationFormItemUtil.selectItem(user, workRelationSelectOptions, 2, 16, 6, false, -85075, "workRelation");
workRelationItem.setViewAttr(2);
workRelationItem.setValue("");
workRelationItem.setRules("required|string");
// 岗位 // 岗位
SearchConditionItem jobIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547333, "666", "jobId", ""); SearchConditionItem jobIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, 547333, "666", "jobId", "");
BrowserBean browserBean = jobIdItem.getBrowserConditionParam(); BrowserBean browserBean = jobIdItem.getBrowserConditionParam();
@ -268,9 +287,9 @@ public class StaffServiceImpl extends Service implements StaffService {
staffNumItem.setMin("0"); staffNumItem.setMin("0");
// 控制策略 // 控制策略
List<SearchConditionOption> selectOptions = new ArrayList<>(); List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption option1 = new SearchConditionOption("1", SystemEnv.getHtmlLabelName(547454,user.getLanguage())); SearchConditionOption option1 = new SearchConditionOption("1", SystemEnv.getHtmlLabelName(547454, user.getLanguage()));
SearchConditionOption option2 = new SearchConditionOption("2", SystemEnv.getHtmlLabelName(547455,user.getLanguage())); SearchConditionOption option2 = new SearchConditionOption("2", SystemEnv.getHtmlLabelName(547455, user.getLanguage()));
SearchConditionOption option3 = new SearchConditionOption("3", SystemEnv.getHtmlLabelName(547456,user.getLanguage())); SearchConditionOption option3 = new SearchConditionOption("3", SystemEnv.getHtmlLabelName(547456, user.getLanguage()));
selectOptions.add(option1); selectOptions.add(option1);
selectOptions.add(option2); selectOptions.add(option2);
selectOptions.add(option3); selectOptions.add(option3);
@ -285,8 +304,8 @@ public class StaffServiceImpl extends Service implements StaffService {
String id = Util.null2String(params.get("id")); String id = Util.null2String(params.get("id"));
if (!StringUtil.isEmpty(id)) { if (!StringUtil.isEmpty(id)) {
StaffPO staffPO = getStaffMapper().getStaffByID(Integer.parseInt(id)); StaffPO staffPO = getStaffMapper().getStaffByID(Integer.parseInt(id));
OrganizationAssert.notNull(staffPO, SystemEnv.getHtmlLabelName(547154,user.getLanguage())); OrganizationAssert.notNull(staffPO, SystemEnv.getHtmlLabelName(547154, user.getLanguage()));
staffPlanPO = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId()); staffPlanPO = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId());
BrowserBean planIdItemBean = planIdItem.getBrowserConditionParam(); BrowserBean planIdItemBean = planIdItem.getBrowserConditionParam();
List<Map<String, Object>> planIdMaps = getStaffPlanMapper().listPlansByIds(DeleteParam.builder().ids(staffPO.getPlanId().toString()).build().getIds()); List<Map<String, Object>> planIdMaps = getStaffPlanMapper().listPlansByIds(DeleteParam.builder().ids(staffPO.getPlanId().toString()).build().getIds());
@ -310,6 +329,7 @@ public class StaffServiceImpl extends Service implements StaffService {
staffNumItem.setValue(staffPO.getStaffNum()); staffNumItem.setValue(staffPO.getStaffNum());
controlPolicyItem.setValue(Util.null2String(staffPO.getControlPolicy())); controlPolicyItem.setValue(Util.null2String(staffPO.getControlPolicy()));
workRelationItem.setValue(Util.null2String(staffPO.getWorkRelation()));
descriptionItem.setValue(staffPO.getDescription()); descriptionItem.setValue(staffPO.getDescription());
} }
selectItems.add(planIdItem); selectItems.add(planIdItem);
@ -322,7 +342,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if (StringUtil.isEmpty(id) || "3".equals(staffPlanPO.getControlDimension())) { if (StringUtil.isEmpty(id) || "3".equals(staffPlanPO.getControlDimension())) {
selectItems.add(jobIdItem); selectItems.add(jobIdItem);
} }
selectItems.add(workRelationItem);
selectItems.add(staffNumItem); selectItems.add(staffNumItem);
selectItems.add(controlPolicyItem); selectItems.add(controlPolicyItem);
selectItems.add(descriptionItem); selectItems.add(descriptionItem);
@ -333,7 +353,7 @@ public class StaffServiceImpl extends Service implements StaffService {
item.setRules(null); item.setRules(null);
}); });
SearchConditionItem changeNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 3, 547357, "changeNum"); SearchConditionItem changeNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 3, 547357, "changeNum");
changeNumItem.setHelpfulTip(SystemEnv.getHtmlLabelName(547359,user.getLanguage())); changeNumItem.setHelpfulTip(SystemEnv.getHtmlLabelName(547359, user.getLanguage()));
staffNumItem.setRules("required"); staffNumItem.setRules("required");
selectItems.add(changeNumItem); selectItems.add(changeNumItem);
SearchConditionItem changeDescriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, false, 2, 50, 547358, "changeDescription"); SearchConditionItem changeDescriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, false, 2, 50, 547358, "changeDescription");
@ -341,7 +361,7 @@ public class StaffServiceImpl extends Service implements StaffService {
} }
addGroups.add(new SearchConditionGroup(SystemEnv.getHtmlLabelName(547175,user.getLanguage()), true, selectItems)); addGroups.add(new SearchConditionGroup(SystemEnv.getHtmlLabelName(547175, user.getLanguage()), true, selectItems));
apiDatas.put("condition", addGroups); apiDatas.put("condition", addGroups);
return apiDatas; return apiDatas;
} }
@ -349,15 +369,15 @@ public class StaffServiceImpl extends Service implements StaffService {
@Override @Override
public Map<String, Object> getHasRight() { public Map<String, Object> getHasRight() {
Map<String, List<MenuBtn>> datas = MenuBtn.getCommonBtnDatas(user.getLanguage()); Map<String, List<MenuBtn>> datas = MenuBtn.getCommonBtnDatas(user.getLanguage());
datas.get("topMenu").add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName(SystemEnv.getHtmlLabelName(547242,user.getLanguage())).type("BTN_BatchImport").build()); datas.get("topMenu").add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName(SystemEnv.getHtmlLabelName(547242, user.getLanguage())).type("BTN_BatchImport").build());
datas.get("rightMenu").add(MenuBtn.builder().isBatch("1").isTop("0").menuFun("import").menuIcon("icon-coms-leading-in").menuName(SystemEnv.getHtmlLabelName(547242,user.getLanguage())).type("BTN_BatchImport").build()); datas.get("rightMenu").add(MenuBtn.builder().isBatch("1").isTop("0").menuFun("import").menuIcon("icon-coms-leading-in").menuName(SystemEnv.getHtmlLabelName(547242, user.getLanguage())).type("BTN_BatchImport").build());
Map<String, Object> map = new HashMap<>(datas); Map<String, Object> map = new HashMap<>(datas);
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> selectItems = new ArrayList<>(); List<SearchConditionItem> selectItems = new ArrayList<>();
// 方案 // 方案
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 4, 6, 2, false, 547459, "162", "planId", "staffPlanBrowser"); SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 4, 6, 2, false, 547459, "162", "planId", "staffPlanBrowser");
planIdItem.setRules("required|string"); planIdItem.setRules("required|string");
planIdItem.setHelpfulTip(SystemEnv.getHtmlLabelName(547343,user.getLanguage())); planIdItem.setHelpfulTip(SystemEnv.getHtmlLabelName(547343, user.getLanguage()));
planIdItem.setLabelcol(2); planIdItem.setLabelcol(2);
selectItems.add(planIdItem); selectItems.add(planIdItem);
@ -422,6 +442,10 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != lackStatus) { if (null != lackStatus) {
sqlWhere += " AND t.lack_status = '" + lackStatus + "'"; sqlWhere += " AND t.lack_status = '" + lackStatus + "'";
} }
Integer workRelation= param.getWorkRelation();
if (null != workRelation && !(-1 == workRelation)) {
sqlWhere += " AND t.work_relation = '" + workRelation + "'";
}
String staffDesc = param.getStaffDesc(); String staffDesc = param.getStaffDesc();
if (StringUtils.isNotBlank(staffDesc)) { if (StringUtils.isNotBlank(staffDesc)) {
sqlWhere += " AND t.staff_desc " + dbType.like(staffDesc); sqlWhere += " AND t.staff_desc " + dbType.like(staffDesc);
@ -448,11 +472,11 @@ public class StaffServiceImpl extends Service implements StaffService {
StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId()); StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId());
switch (staffPlanByID.getControlDimension()) { switch (staffPlanByID.getControlDimension()) {
case "1":// 分部 case "1":// 分部
OrganizationAssert.notNull(staffPO.getEcCompany(), SystemEnv.getHtmlLabelName(547461,user.getLanguage())); OrganizationAssert.notNull(staffPO.getEcCompany(), SystemEnv.getHtmlLabelName(547461, user.getLanguage()));
staffPO.setCompId(staffPO.getEcCompany()); staffPO.setCompId(staffPO.getEcCompany());
break; break;
case "2":// 部门 case "2":// 部门
OrganizationAssert.notNull(staffPO.getEcDepartment(), SystemEnv.getHtmlLabelName(547460,user.getLanguage())); OrganizationAssert.notNull(staffPO.getEcDepartment(), SystemEnv.getHtmlLabelName(547460, user.getLanguage()));
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(staffPO.getEcDepartment()); DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(staffPO.getEcDepartment());
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId()); staffPO.setDeptId(jclDepartmentId.getId());
@ -461,7 +485,7 @@ public class StaffServiceImpl extends Service implements StaffService {
} }
break; break;
case "3": // 岗位 case "3": // 岗位
OrganizationAssert.notNull(staffPO.getJobId(), SystemEnv.getHtmlLabelName(547462,user.getLanguage())); OrganizationAssert.notNull(staffPO.getJobId(), SystemEnv.getHtmlLabelName(547462, user.getLanguage()));
JobPO jobById = getJobMapper().getJobById(Long.valueOf(staffPO.getJobId())); JobPO jobById = getJobMapper().getJobById(Long.valueOf(staffPO.getJobId()));
if (null != jobById) { if (null != jobById) {
staffPO.setDeptId(jobById.getEcDepartment()); staffPO.setDeptId(jobById.getEcDepartment());
@ -483,8 +507,16 @@ public class StaffServiceImpl extends Service implements StaffService {
public static void initStaffInfo(StaffPO staffPO) { public static void initStaffInfo(StaffPO staffPO) {
boolean hasDepartment = null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment(); boolean hasDepartment = null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment();
boolean hasJob = null != staffPO.getJobId() && 0 != staffPO.getJobId(); boolean hasJob = null != staffPO.getJobId() && 0 != staffPO.getJobId();
boolean hasWorkRelation = null != staffPO.getWorkRelation() && -1 != staffPO.getWorkRelation();
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String sql = "select count(1) as num from hrmresource where STATUS < 4"; String sql = "select count(1) as num from hrmresource where STATUS < 4";
if (hasWorkRelation) {
int workRelation = staffPO.getWorkRelation();
sql = "select count(1) as num from hrmresource a left join cus_fielddata b on a.id = b.id where status < 4 and b.scope = 'HrmCustomFieldByInfoType' and b.scopeid = 3 ";
sql += " and field10 = " + workRelation;
}
if (null != staffPO.getEcCompany() && 0 != staffPO.getEcCompany()) { if (null != staffPO.getEcCompany() && 0 != staffPO.getEcCompany()) {
ArrayList<String> subCompanyList = new ArrayList<>(); ArrayList<String> subCompanyList = new ArrayList<>();
subCompanyList.add(staffPO.getEcCompany().toString()); subCompanyList.add(staffPO.getEcCompany().toString());
@ -510,7 +542,8 @@ public class StaffServiceImpl extends Service implements StaffService {
sql += " and jobtitle = " + ecJobTitle; sql += " and jobtitle = " + ecJobTitle;
} }
if ("false".equals(new BaseBean().getPropValue("hrmOrganization","accountType"))) {
if ("false".equals(new BaseBean().getPropValue("hrmOrganization", "accountType"))) {
sql += " and accounttype != 1"; sql += " and accounttype != 1";
} }
@ -523,4 +556,28 @@ public class StaffServiceImpl extends Service implements StaffService {
} }
/**
*
*
* @return
*/
private List<SearchConditionOption> getWorkRelationSelectOptions() {
RecordSet rs = new RecordSet();
List<SearchConditionOption> workRelationSelectOptions = new ArrayList<>();
SearchConditionOption option = new SearchConditionOption("-1", "不限");
workRelationSelectOptions.add(option);
//用工关系sql select selectvalue,selectname from cus_selectitem where fieldid = 33
String sql = "select selectvalue,selectname from cus_selectitem where fieldid = 10";
rs.execute(sql);
while (rs.next()) {
String selectvalue = Util.null2String(rs.getString("selectvalue"));
String selectname = Util.null2String(rs.getString("selectname"));
SearchConditionOption option1 = new SearchConditionOption(selectvalue, selectname);
workRelationSelectOptions.add(option1);
}
return workRelationSelectOptions;
}
} }

@ -0,0 +1,26 @@
package com.engine.organization.transmethod;
import weaver.conn.RecordSet;
import weaver.general.Util;
/**
* @description:
* @author:wangj
* @createTime: 2025/02/28
* @version: 1.0
*/
public class WorkRelationTransMethod {
public static String getSpanById(String Id) {
RecordSet rs = new RecordSet();
String names = "/";
if (!"".equals(Id)) {
String sql = "select selectvalue,selectname from cus_selectitem where fieldid = 10 and selectvalue = '" + Id + "'";
rs.execute(sql);
while (rs.next()) {
names = Util.null2String(rs.getString("selectname"));
}
}
return names;
}
}

@ -24,6 +24,7 @@ import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager; import weaver.file.ImageFileManager;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
@ -51,6 +52,7 @@ public class StaffInfoImportUtil {
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("jcl_org_staff").fieldName("dept_id").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("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()); importFieldsMap.put("编制数", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("staff_num").fieldNameDesc("编制数").isrequired(1).controlType(1).browserType("2").customValue("[\"input\",\"int\"]").build());
importFieldsMap.put("用工关系", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("work_relation").fieldNameDesc("用工关系").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
} }
@ -188,6 +190,12 @@ public class StaffInfoImportUtil {
map.put("ec_department", parentDepartmentId); map.put("ec_department", parentDepartmentId);
} }
// 用工关系
if ("work_relation".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) {
int workRelation = getWorkRelationValue(cellValue);
map.put("work_relation", workRelation);
}
// 岗位 // 岗位
if ("job_id".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) { if ("job_id".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) {
if (null == parentCompanyId) { if (null == parentCompanyId) {
@ -290,7 +298,7 @@ public class StaffInfoImportUtil {
if (null == staffPO.getControlPolicy()) { if (null == staffPO.getControlPolicy()) {
staffPO.setControlPolicy(1); staffPO.setControlPolicy(1);
} }
List<StaffPO> verify = MapperProxyFactory.getProxy(StaffMapper.class).customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId()); List<StaffPO> verify = MapperProxyFactory.getProxy(StaffMapper.class).customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId(), param.getWorkRelation());
if (!verify.isEmpty()) { if (!verify.isEmpty()) {
checkMsg = "同一编制方案下,同一维度的编制信息不可重复创建!"; checkMsg = "同一编制方案下,同一维度的编制信息不可重复创建!";
} }
@ -339,4 +347,16 @@ public class StaffInfoImportUtil {
lsGroup.add(groupItem); lsGroup.add(groupItem);
return lsGroup; return lsGroup;
} }
public static int getWorkRelationValue(String name){
RecordSet rs = new RecordSet();
int id = -1;
String sql = "select selectvalue,selectname from cus_selectitem where fieldid = 10 and selectname = '" + name + "'";
rs.execute(sql);
while (rs.next()) {
id = Util.getIntValue(rs.getString("selectvalue"));
}
return id;
}
} }

@ -0,0 +1,52 @@
package com.engine.shgw.Util;
import weaver.general.Util;
import weaver.soa.workflow.request.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* action
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class ActionUtils {
/**
* requestInfo
* */
public static Map getMainInfo(RequestInfo requestInfo){
Map map = new HashMap();
Property[] property = requestInfo.getMainTableInfo().getProperty();
for (int i = 0; i < property.length; i++) {
map.put(property[i].getName().toLowerCase(), Util.null2String(property[i].getValue()));
}
return map;
}
/**
* requestInfo
* */
public static List getDetailInfo(RequestInfo requestInfo, int num){
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(num);
//dtltable数组中的行数据集合
Row[] rows = detailTable.getRow();
List sublist = new ArrayList();
for (int i = 0; i < rows.length; i++) {
Row row = rows[i];
Map onerow = new HashMap();
sublist.add(onerow);
Cell[] cells = row.getCell();
for (int j = 0; j < cells.length; j++) {
Cell cell = cells[j];
onerow.put(cell.getName(), Util.null2String(cell.getValue()));
}
}
return sublist;
}
}

@ -0,0 +1,29 @@
package com.engine.shgw.Util;
import java.util.HashSet;
import java.util.Set;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/5/13
*/
public class CommUtils {
/**
* @Description:
* @Author: wangj
*/
public static String distinctStringWithDot(String str) {
String[] strArr = str.split(",");
Set set = new HashSet();
for (int i = 0; i < strArr.length; i++) {
if ("".equals(strArr[i])) {continue;}
set.add(strArr[i]);
}
strArr = (String[]) set.toArray(new String[0]);
return String.join(",", strArr);
}
}

@ -0,0 +1,142 @@
package com.engine.shgw.action;
import com.alibaba.fastjson.JSONObject;
import com.engine.shgw.Util.ActionUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Map;
/**
*
* +1
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class EmployeeTransferUpdateOrgStaffAction implements Action {
//调动后部门 数据库字段名
private String newbmKey;
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bb = new BaseBean();
try {
String tableName = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String createdate = getWfRequestDate(requestid);
//获取主表数据
Map mainInfo = ActionUtils.getMainInfo(requestInfo);
bb.writeLog("-EmployeeTransferUpdateOrgStaffAction-主表数据是:" + JSONObject.toJSONString(mainInfo));
//调动前部门 数据库字段名
// oldbmKey = Util.null2String(oldbmKey);
// //调动前公司 数据库字段名
// oldgsKey = Util.null2String(oldgsKey);
//调动后部门 数据库字段名
newbmKey = Util.null2String(newbmKey);
//调动后公司 数据库字段名
// newgsKey = Util.null2String(newgsKey);
if ("".equals(newbmKey)) {
requestInfo.getRequestManager().setMessagecontent("必传字段为空,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
//调动后部门
String xrzbm = Util.null2String(mainInfo.get(newbmKey));
if (!"".equals(xrzbm)) {
boolean flag = updateOrgStaffByDept(xrzbm,createdate);
if(flag){
requestInfo.getRequestManager().setMessagecontent("调动后部门编制超编,提交失败!");
return Action.FAILURE_AND_CONTINUE;
}
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessagecontent("接口异常:" + e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
private void updateOrgStaffBySubCom(String subcomid) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id);
}
}
/**
*
*
* @param deptid
*/
private boolean updateOrgStaffByDept(String deptid,String createdate) {
boolean flag = false;
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.freeze_num,a.lack_status,a.control_policy from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '"+createdate+"' and b.time_start <= '"+createdate+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
int freeze_num = Util.getIntValue(rs.getString("freeze_num"));
//2强控1弱控3不控
int control_policy = Util.getIntValue(rs.getString("control_policy"));
//强控 且 超编
if (control_policy == 2 && staff_num < (permanent_num + freeze_num + 1)) {
flag = true;
} else {
updateOrgStaff(id);
}
}
return flag;
}
/**
* +1
*
* @param id
*/
private void updateOrgStaff(String id) {
RecordSet rs = new RecordSet();
String sql = "update jcl_org_staff set freeze_num = freeze_num+1 where id = ?";
rs.executeUpdate(sql, id);
}
private String getWfRequestDate(String requestid){
String date = "";
if("".equals(requestid)){
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '"+requestid+"'";
rs.execute(sql);
while (rs.next()){
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
}

@ -0,0 +1,203 @@
package com.engine.shgw.action;
import com.alibaba.fastjson.JSONObject;
import com.engine.shgw.Util.ActionUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Map;
/**
* ()
* <p>
* +1 -1 -1
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class EmployeeTransferUpdateOrgStaffGdAction implements Action {
//调动前部门 数据库字段名
private String oldbmKey;
//调动后部门 数据库字段名
private String newbmKey;
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bb = new BaseBean();
try {
String tableName = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String createdate = getWfRequestDate(requestid);
//获取主表数据
Map mainInfo = ActionUtils.getMainInfo(requestInfo);
bb.writeLog("-EmployeeTransferUpdateOrgStaffGdAction-主表数据是:" + JSONObject.toJSONString(mainInfo));
//调动前部门 数据库字段名
oldbmKey = Util.null2String(oldbmKey);
//调动后部门 数据库字段名
newbmKey = Util.null2String(newbmKey);
if ("".equals(oldbmKey) || "".equals(newbmKey)) {
requestInfo.getRequestManager().setMessagecontent("必传字段为空,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
//调动前公司
// String yrzgs = Util.null2String(mainInfo.get(oldgsKey));
//调动前部门
String yrzbm = Util.null2String(mainInfo.get(oldbmKey));
//调动后公司
// String xrzgs = Util.null2String(mainInfo.get(newgsKey));
//调动后部门
String xrzbm = Util.null2String(mainInfo.get(newbmKey));
// if (!"".equals(xrzgs)) {
// updateOrgStaffBySubCom(xrzgs);
// }
if (!"".equals(xrzbm)) {
updateOrgStaffByDept(xrzbm,createdate);
}
// if (!"".equals(yrzgs)) {
// updateOrgStaffBySubComOld(xrzgs);
// }
if (!"".equals(yrzbm)) {
updateOrgStaffByDeptOld(yrzbm,createdate);
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessagecontent("接口异常:" + e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
private void updateOrgStaffBySubCom(String subcomid) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id, staff_num, permanent_num);
}
}
private void updateOrgStaffByDept(String deptid,String createdate) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '"+createdate+"' and b.time_start <= '"+createdate+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id, staff_num, permanent_num);
}
}
private void updateOrgStaffBySubComOld(String subcomid) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaffOld(id, staff_num, permanent_num);
}
}
private void updateOrgStaffByDeptOld(String deptid,String createdate) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '"+createdate+"' and b.time_start <= '"+createdate+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaffOld(id, staff_num, permanent_num);
}
}
/**
* -1 +1
*
* @param id
*/
private void updateOrgStaff(String id, int staff_num, int permanent_num) {
RecordSet rs = new RecordSet();
permanent_num = permanent_num + 1;
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set freeze_num = freeze_num-1,permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql, permanent_num, lack_status, id);
}
/**
* -1
*
* @param id
*/
private void updateOrgStaffOld(String id, int staff_num, int permanent_num) {
RecordSet rs = new RecordSet();
permanent_num = permanent_num - 1;
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql, permanent_num, lack_status, id);
}
private String getWfRequestDate(String requestid){
String date = "";
if("".equals(requestid)){
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '"+requestid+"'";
rs.execute(sql);
while (rs.next()){
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
}

@ -0,0 +1,133 @@
package com.engine.shgw.action;
import com.alibaba.fastjson.JSONObject;
import com.engine.shgw.Util.ActionUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Map;
/**
*
* +1
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class EmploymentUpdateOrgStaffAction implements Action {
//部门 数据库字段名
private String bmKey;
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bb = new BaseBean();
try {
String tableName = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String createdate = getWfRequestDate(requestid);
//获取主表数据
Map mainInfo = ActionUtils.getMainInfo(requestInfo);
bb.writeLog("-EmploymentUpdateOrgStaffAction-主表数据是:" + JSONObject.toJSONString(mainInfo));
//部门 数据库字段名
bmKey = Util.null2String(bmKey);
if("".equals(bmKey)){
requestInfo.getRequestManager().setMessagecontent("必传字段为空,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
//分部
// String fb = Util.null2String(mainInfo.get(gsKey));
//部门
String bm = Util.null2String(mainInfo.get(bmKey));
// if (!"".equals(fb)) {
// updateOrgStaffBySubCom(fb);
// }
if (!"".equals(bm)) {
boolean flag = updateOrgStaffByDept(bm,createdate);
if(flag){
requestInfo.getRequestManager().setMessagecontent("入职部门编制超编,提交失败!");
return Action.FAILURE_AND_CONTINUE;
}
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessagecontent("接口异常:" + e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
private void updateOrgStaffBySubCom(String subcomid) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
updateOrgStaff(id);
}
}
private boolean updateOrgStaffByDept(String deptid,String createdate) {
RecordSet rs = new RecordSet();
boolean flag = false;
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.freeze_num,a.control_policy,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '"+createdate+"' and b.time_start <= '"+createdate+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
int freeze_num = Util.getIntValue(rs.getString("freeze_num"));
//2强控1弱控3不控
int control_policy = Util.getIntValue(rs.getString("control_policy"));
//强控 且 超编
if (control_policy == 2 && staff_num < (permanent_num + freeze_num + 1)) {
flag = true;
} else {
updateOrgStaff(id);
}
}
return flag;
}
/**
* +1
* @param id
*/
private void updateOrgStaff(String id) {
RecordSet rs = new RecordSet();
String sql = "update jcl_org_staff set freeze_num = freeze_num+1 where id = ?";
rs.executeUpdate(sql, id);
}
private String getWfRequestDate(String requestid){
String date = "";
if("".equals(requestid)){
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '"+requestid+"'";
rs.execute(sql);
while (rs.next()){
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
}

@ -0,0 +1,134 @@
package com.engine.shgw.action;
import com.alibaba.fastjson.JSONObject;
import com.engine.shgw.Util.ActionUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Map;
/**
*
action
* -1 +1
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class EmploymentUpdateOrgStaffGdAction implements Action {
//部门 数据库字段名
private String bmKey;
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bb = new BaseBean();
try {
//获取主表数据
Map mainInfo = ActionUtils.getMainInfo(requestInfo);
String requestid = requestInfo.getRequestid();
String createdate = getWfRequestDate(requestid);
bb.writeLog("-EmploymentUpdateOrgStaffGdAction-主表数据是:" + JSONObject.toJSONString(mainInfo));
//部门 数据库字段名
bmKey = Util.null2String(bmKey);
// //公司 数据库字段名
// gsKey = Util.null2String(gsKey);
if("".equals(bmKey)){
requestInfo.getRequestManager().setMessagecontent("必传字段为空,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
//分部
// String fb = Util.null2String(mainInfo.get(gsKey));
//部门
String bm = Util.null2String(mainInfo.get(bmKey));
// if(!"".equals(fb)){
// updateOrgStaffBySubCom(fb);
// }
if(!"".equals(bm)){
updateOrgStaffByDept(bm,createdate);
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessagecontent("接口异常:" + e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
private void updateOrgStaffBySubCom(String subcomid) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id, staff_num, permanent_num);
}
}
private void updateOrgStaffByDept(String deptid,String createdate) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '"+createdate+"' and b.time_start <= '"+createdate+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id, staff_num, permanent_num);
}
}
/**
* -1 +1
*
* @param id
*/
private void updateOrgStaff(String id,int staff_num,int permanent_num) {
RecordSet rs = new RecordSet();
permanent_num = permanent_num + 1;
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set freeze_num = freeze_num-1,permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql,permanent_num,lack_status,id);
}
private String getWfRequestDate(String requestid){
String date = "";
if("".equals(requestid)){
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '"+requestid+"'";
rs.execute(sql);
while (rs.next()){
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
}

@ -0,0 +1,247 @@
package com.engine.shgw.action;
import com.alibaba.fastjson.JSONObject;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.staff.bo.StaffBO;
import com.engine.organization.entity.staff.param.StaffParams;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.shgw.Util.ActionUtils;
import com.time.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.Map;
/**
* action
* /
*
*
* @author wangj
* @version 1.00
* @Date 2024/5/16
*/
public class RecruitmentNeedsUpdateOrgAction implements Action {
//数量 数据库字段名
private String slKey;
//招聘类型 数据库字段名
private String hclxKey;
//部门 数据库字段名
private String bmKey;
private StaffMapper getStaffMapper() {
return MapperProxyFactory.getProxy(StaffMapper.class);
}
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bb = new BaseBean();
try {
//获取主表数据
Map mainInfo = ActionUtils.getMainInfo(requestInfo);
String requestid = requestInfo.getRequestid();
String createdate = getWfRequestDate(requestid);
bb.writeLog("-RecruitmentNeedsUpdateOrgAction-主表数据是:" + JSONObject.toJSONString(mainInfo));
//数量 数据库字段名
slKey = Util.null2String(slKey);
//招聘类型 数据库字段名
hclxKey = Util.null2String(hclxKey);
//部门 数据库字段名
bmKey = Util.null2String(bmKey);
if ("".equals(slKey) || "".equals(hclxKey) || "".equals(bmKey)) {
requestInfo.getRequestManager().setMessagecontent("必传字段为空,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
String bm = Util.null2String(mainInfo.get(bmKey));
int sl = Util.getIntValue(Util.null2String(mainInfo.get(slKey)), 0);
//0 新增 1 替换
String hclx = Util.null2String(mainInfo.get(hclxKey));
bb.writeLog("-RecruitmentNeedsUpdateOrgAction-hclx" + hclx);
//部门维度
if (!"".equals(bm)) {
updateOrgStaffByDept(bm, hclx, sl, createdate);
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessagecontent("接口异常:" + e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
private void updateOrgStaffBySubCom(String subcomid, String hclx, int sl) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
//新增
if ("0".equals(hclx)) {
staff_num = staff_num + sl;
} else {
staff_num = sl;
}
updateOrgStaff(id, staff_num, permanent_num);
}
}
/**
*
*
* @param id
* @param staff_num
* @param permanent_num
*/
private void updateOrgStaff(String id, int staff_num, int permanent_num) {
RecordSet rs = new RecordSet();
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set staff_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql, staff_num, lack_status, id);
}
private void updateOrgStaffByDept(String deptid, String hclx, int sl, String createdate) {
boolean flag = false;
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '" + createdate + "' and b.time_start <= '" + createdate + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
//新增
if ("0".equals(hclx)) {
staff_num = staff_num + sl;
} else {
staff_num = sl;
}
updateOrgStaff(id, staff_num, permanent_num);
flag = true;
}
if (!flag) {
//判断如果没有找到该部门的编制信息
sql = "select id,ec_company,control_dimension from jcl_org_staffplan where forbidden_tag = 0 and control_dimension = 2 and time_end >= ? and time_start <= ?";
rs.executeQuery(sql, createdate, createdate);
while (rs.next()) {
String planid = Util.null2String(rs.getString("id"));
StaffParams param = new StaffParams();
param.setPlanId(Util.getIntValue(planid));
param.setStaffNum(sl);
param.setDeptId(Util.getIntValue(deptid));
param.setEcDepartment(Util.getIntValue(deptid));
param.setControlPolicy(2);
StaffPO staffPO = StaffBO.convertParamToPO(param, (long)1);
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, "编制数不可小于0请更正");
int ignoreNull = getStaffMapper().insertIgnoreNull(staffPO);
// 初始化编制在编数
initStaffInfo(staffPO);
}
}
}
private String getWfRequestDate(String requestid) {
String date = "";
if ("".equals(requestid)) {
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '" + requestid + "'";
rs.execute(sql);
while (rs.next()) {
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
/**
*
*
* @param staffPO
*/
public static void initStaffInfo(StaffPO staffPO) {
boolean hasDepartment = null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment();
boolean hasJob = null != staffPO.getJobId() && 0 != staffPO.getJobId();
RecordSet rs = new RecordSet();
String sql = "select count(1) as num from hrmresource where STATUS < 4";
if (null != staffPO.getEcCompany() && 0 != staffPO.getEcCompany()) {
ArrayList<String> subCompanyList = new ArrayList<>();
subCompanyList.add(staffPO.getEcCompany().toString());
if (!hasJob && !hasDepartment) {
new SubCompanyComInfo().getSubCompanyLists(staffPO.getEcCompany().toString(), subCompanyList);
}
sql += " and subcompanyid1 in (" + StringUtils.join(subCompanyList, ",") + ")";
}
if (hasDepartment) {
ArrayList<String> departmentList = new ArrayList<>();
departmentList.add(staffPO.getEcDepartment().toString());
if (!hasJob) {
new DepartmentComInfo().getAllChildDeptByDepId(departmentList, staffPO.getEcDepartment().toString());
}
sql += " and departmentid in (" + StringUtils.join(departmentList, ",") + ")";
}
if (hasJob) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.valueOf(staffPO.getJobId()));
if (null == jobById) {
return;
}
Integer ecJobTitle = jobById.getEcJobTitle();
sql += " and jobtitle = " + ecJobTitle;
}
if ("false".equals(new BaseBean().getPropValue("hrmOrganization","accountType"))) {
sql += " and accounttype != 1";
}
rs.executeQuery(sql);
if (rs.next()) {
staffPO.setPermanentNum(-1 == rs.getInt("num") ? 0 : rs.getInt("num"));
StaffBO.buildStaffDesc(staffPO);
MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO);
}
}
}

@ -0,0 +1,183 @@
package com.engine.shgw.action;
import com.alibaba.fastjson.JSONObject;
import com.engine.shgw.Util.ActionUtils;
import com.engine.shgw.Util.CommUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Map;
/**
*
* <p>
*
* -1 -1
* -1 -1
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class ResignationUpdateOrgStaffAction implements Action {
//部门 数据库字段名
private String bmKey;
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bb = new BaseBean();
try {
String tableName = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String createdate = getWfRequestDate(requestid);
//获取主表数据
Map mainInfo = ActionUtils.getMainInfo(requestInfo);
bb.writeLog("-ResignationUpdateOrgStaffAction-主表数据是:" + JSONObject.toJSONString(mainInfo));
//部门 数据库字段名
bmKey = Util.null2String(bmKey);
// //公司 数据库字段名
// gsKey = Util.null2String(gsKey);
if("".equals(bmKey)){
requestInfo.getRequestManager().setMessagecontent("必传字段为空,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
//分部
// String fb = Util.null2String(mainInfo.get(gsKey));
//部门
String bm = Util.null2String(mainInfo.get(bmKey));
//分部维度
// if (!"".equals(fb)) {
// updateOrgStaffBySubCom(fb);
// }
//部门维度
if (!"".equals(bm)) {
updateOrgStaffByDept(bm,createdate);
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessagecontent("接口异常:" + e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
/**
* idid
*
* @param id
* @return
*/
private String getAllSupComIds(String id) {
String allsubcomids = id;
RecordSet rs = new RecordSet();
String sql = "select supsubcomid from hrmsubcompany where (canceled = 0 or canceled is null) and id = '" + id + "'";
rs.execute(sql);
while (rs.next()) {
String supsubcomid = Util.null2String(rs.getString("supsubcomid"));
if ("".equals(supsubcomid) || "0".equals(supsubcomid)) {
continue;
}
allsubcomids = allsubcomids + "," + supsubcomid;
supsubcomid = getAllSupComIds(supsubcomid);
allsubcomids = allsubcomids + "," + supsubcomid;
}
allsubcomids = CommUtils.distinctStringWithDot(allsubcomids);
return allsubcomids;
}
/**
* idid
*
* @param id
* @return
*/
private String getAllSupDeptIds(String id) {
String allsubdeptids = id;
RecordSet rs = new RecordSet();
String sql = "select supdepid from hrmdepartment where (canceled = 0 or canceled is null) and id = '" + id + "'";
rs.execute(sql);
while (rs.next()) {
String supdepid = Util.null2String(rs.getString("supdepid"));
if ("".equals(supdepid) || "0".equals(supdepid)) {
continue;
}
allsubdeptids = allsubdeptids + "," + supdepid;
supdepid = getAllSupDeptIds(supdepid);
allsubdeptids = allsubdeptids + "," + supdepid;
}
allsubdeptids = CommUtils.distinctStringWithDot(allsubdeptids);
return allsubdeptids;
}
private void updateOrgStaffBySubCom(String subcomid) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 1 and b.forbidden_tag = 0 and a.ec_company = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id, staff_num, permanent_num);
}
}
private void updateOrgStaffByDept(String deptid,String createdate) {
RecordSet rs = new RecordSet();
String sql = "select a.id,a.ec_company,a.ec_department,a.job_id,a.staff_num,a.permanent_num,a.lack_status from jcl_org_staff a left join jcl_org_staffplan b on a.plan_id = b.id where a.delete_type = 0 and b.control_dimension = 2 and b.forbidden_tag = 0 and a.ec_department = '" + deptid + "' and b.time_end >= '"+createdate+"' and b.time_start <= '"+createdate+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
int staff_num = Util.getIntValue(rs.getString("staff_num"));
int permanent_num = Util.getIntValue(rs.getString("permanent_num"));
updateOrgStaff(id, staff_num, permanent_num);
}
}
/**
*
*
* @param id
* @param staff_num
* @param permanent_num
*/
private void updateOrgStaff(String id, int staff_num, int permanent_num) {
RecordSet rs = new RecordSet();
permanent_num = permanent_num - 1;
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql, permanent_num, lack_status, id);
}
private String getWfRequestDate(String requestid){
String date = "";
if("".equals(requestid)){
date = DateUtil.getCurrentTime("yyyy-MM-dd");
return date;
}
RecordSet rs = new RecordSet();
String sql = "select createdate from workflow_requestbase where requestid = '"+requestid+"'";
rs.execute(sql);
while (rs.next()){
date = Util.null2String(rs.getString("createdate"));
}
return date;
}
}

@ -0,0 +1,218 @@
package com.engine.shgw.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.shgw.Util.CommUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class UpdateOrgStaffingCmd extends AbstractCommonCommand<Map<String, Object>> {
public UpdateOrgStaffingCmd(Map<String, Object> params) {
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> result = new HashMap<>(100);
boolean flag = true;
RecordSet rs = new RecordSet();
try {
String date = DateUtil.getCurrentTime("yyyy-MM-dd");
List<Map<String, String>> planlist = new ArrayList<>(100);
//获取启用状态的编制方案
String sql = "select id,ec_company,control_dimension from jcl_org_staffplan where forbidden_tag = 0 and time_end >= '"+date+"' and time_start <= '"+date+"'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
//适用分部 测试看没限制
String subcompany = Util.null2String(rs.getString("ec_company"));
//控制维度 1 分部/2 部门/3 岗位
String dimension = Util.null2String(rs.getString("control_dimension"));
Map<String, String> map = new HashMap<>(10);
map.put("id", id);
map.put("subcompany", subcompany);
map.put("dimension", dimension);
planlist.add(map);
}
for (Map map : planlist) {
String planid = Util.null2String(map.get("id"));
//控制维度 1 分部/2 部门/3 岗位
String dimension = Util.null2String(map.get("dimension"));
sql = "select id,ec_company,ec_department,job_id,staff_num,permanent_num,lack_status from jcl_org_staff where plan_id = " + planid + " and delete_type = 0";
rs.execute(sql);
while (rs.next()) {
//编制信息id
String id = Util.null2String(rs.getString("id"));
//分部id
String subcompanyid = Util.null2String(rs.getString("ec_company"));
//部门id
String deptid = Util.null2String(rs.getString("ec_department"));
//岗位id
String job_id = Util.null2String(rs.getString("job_id"));
//编制数
int staff_num = Util.getIntValue(rs.getString("staff_num"), 0);
//lack_status 缺编状态 1缺编2满编3超编
if ("1".equals(dimension)) {
//分部维度
updateOrgPermanentNumBySubCom(id, subcompanyid, staff_num);
} else if ("2".equals(dimension)) {
//部门维度
updateOrgPermanentNumByDept(id, deptid, staff_num);
} else if ("3".equals(dimension)) {
//岗位维度
}
}
}
}catch (Exception e){
flag = false;
result.put("msg",e.getMessage());
}
result.put("flag",flag);
return result;
}
/**
* @Description:
* @Author: wangj
*/
private void updateOrgPermanentNumByDept(String id, String deptid, int staff_num) {
RecordSet rs = new RecordSet();
//统计该部门以及所有下级部门的人员-用工性质
int permanent_num = 0;
permanent_num = getOrgPermanentNumByDept(deptid);
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql, permanent_num, lack_status, id);
}
/**
*
*
* @param deptid
* @return
*/
private int getOrgPermanentNumByDept(String deptid) {
int num = 0;
RecordSet rs = new RecordSet();
//获取部门以及所有下级部门id
String deptids = getAllSubDeptIds(deptid);
String sql = "select count(1) as sl from hrmresource where status < 4 and accounttype != 1 and departmentid in (" + deptids + ")";
rs.execute(sql);
while (rs.next()) {
num = Util.getIntValue(rs.getString("sl"));
}
return num;
}
private String getAllSubDeptIds(String deptid) {
String deptids = deptid;
RecordSet rs = new RecordSet();
String sql = "select id from hrmdepartment where (canceled = 0 or canceled is null) and supdepid = '" + deptid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
if ("".equals(id)) continue;
String subdeptids = getAllSubDeptIds(id);
deptids = deptids + "," + subdeptids;
}
deptids = CommUtils.distinctStringWithDot(deptids);
return deptids;
}
/**
*
*
* @param id
* @param subcomid
* @param staff_num
*/
private void updateOrgPermanentNumBySubCom(String id, String subcomid, int staff_num) {
RecordSet rs = new RecordSet();
//统计该分部以及所有下级分部的人员
int permanent_num = 0;
permanent_num = getOrgPermanentNumBySubCom(subcomid);
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if (permanent_num < staff_num) {
lack_status = 1;
} else if (permanent_num == staff_num) {
lack_status = 2;
} else if (permanent_num > staff_num) {
lack_status = 3;
}
String sql = "update jcl_org_staff set permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql, permanent_num, lack_status, id);
}
private int getOrgPermanentNumBySubCom(String subcomid) {
int num = 0;
RecordSet rs = new RecordSet();
//获取分部以及所有下级分部id
String subcomids = getAllSubComIds(subcomid);
String sql = "select count(1) as sl from hrmresource where status < 4 and accounttype != 1 and subcompanyid1 in (" + subcomids + ")";
rs.execute(sql);
while (rs.next()) {
num = Util.getIntValue(rs.getString("sl"));
}
return num;
}
private String getAllSubComIds(String subcomid) {
String subcomids = subcomid;
RecordSet rs = new RecordSet();
String sql = "select id from hrmsubcompany where (canceled = 0 or canceled is null) and supsubcomid = '" + subcomid + "'";
rs.execute(sql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
if ("".equals(id)) continue;
String subids = getAllSubComIds(id);
subcomids = subcomids + "," + subids;
}
subcomids = CommUtils.distinctStringWithDot(subcomids);
return subcomids;
}
}

@ -0,0 +1,200 @@
package com.engine.shgw.job;
import com.engine.shgw.Util.CommUtils;
import com.time.util.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* -
*
* @author wangj
* @version 1.00
* @Date 2024/5/13
*/
public class UpdateOrgStaffingJob extends BaseCronJob {
@Override
public void execute() {
RecordSet rs = new RecordSet();
List<Map<String,String>> planlist = new ArrayList<>(100);
String date = DateUtil.getCurrentTime("yyyy-MM-dd");
//获取启用状态的编制方案
String sql = "select id,ec_company,control_dimension from jcl_org_staffplan where forbidden_tag = 0 and time_end >= '"+date+"' and time_start <= '"+date+"'";
rs.execute(sql);
while (rs.next()){
String id = Util.null2String(rs.getString("id"));
//适用分部 测试看没限制
String subcompany = Util.null2String(rs.getString("ec_company"));
//控制维度 1 分部/2 部门/3 岗位
String dimension = Util.null2String(rs.getString("control_dimension"));
Map<String,String> map = new HashMap<>(10);
map.put("id",id);
map.put("subcompany",subcompany);
map.put("dimension",dimension);
planlist.add(map);
}
for (Map map : planlist){
String planid = Util.null2String(map.get("id"));
//控制维度 1 分部/2 部门/3 岗位
String dimension = Util.null2String(map.get("dimension"));
sql = "select id,ec_company,ec_department,job_id,staff_num,permanent_num,lack_status from jcl_org_staff where plan_id = "+planid+" and delete_type = 0";
rs.execute(sql);
while (rs.next()){
//编制信息id
String id = Util.null2String(rs.getString("id"));
//分部id
String subcompanyid = Util.null2String(rs.getString("ec_company"));
//部门id
String deptid = Util.null2String(rs.getString("ec_department"));
//岗位id
String job_id = Util.null2String(rs.getString("job_id"));
//编制数
int staff_num = Util.getIntValue(rs.getString("staff_num"),0);
//lack_status 缺编状态 1缺编2满编3超编
if("1".equals(dimension)){
//分部维度
updateOrgPermanentNumBySubCom(id,subcompanyid,staff_num);
}else if("2".equals(dimension)){
//部门维度
updateOrgPermanentNumByDept(id,deptid,staff_num);
}else if("3".equals(dimension)){
//岗位维度
}
}
}
}
/**
* @Description:
* @Author: wangj
*/
private void updateOrgPermanentNumByDept(String id,String deptid,int staff_num){
RecordSet rs = new RecordSet();
//统计该部门以及所有下级部门的人员-用工性质
int permanent_num = 0;
permanent_num = getOrgPermanentNumByDept(deptid);
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if(permanent_num < staff_num){
lack_status = 1;
}else if(permanent_num == staff_num){
lack_status = 2;
}else if(permanent_num > staff_num){
lack_status = 3;
}
String sql = "update jcl_org_staff set permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql,permanent_num,lack_status,id);
}
/**
*
* @param deptid
* @return
*/
private int getOrgPermanentNumByDept(String deptid){
int num = 0;
RecordSet rs = new RecordSet();
//获取部门以及所有下级部门id
String deptids = getAllSubDeptIds(deptid);
String sql = "select count(1) as sl from hrmresource where status < 4 and accounttype != 1 and departmentid in ("+deptids+")";
rs.execute(sql);
while (rs.next()){
num = Util.getIntValue(rs.getString("sl"));
}
return num;
}
private String getAllSubDeptIds(String deptid){
String deptids = deptid;
RecordSet rs = new RecordSet();
String sql = "select id from hrmdepartment where (canceled = 0 or canceled is null) and supdepid = '"+deptid+"'";
rs.execute(sql);
while (rs.next()){
String id = Util.null2String(rs.getString("id"));
if("".equals(id)) continue;
String subdeptids = getAllSubDeptIds(id);
deptids = deptids + "," +subdeptids;
}
deptids = CommUtils.distinctStringWithDot(deptids);
return deptids;
}
/**
*
* @param id
* @param subcomid
* @param staff_num
*/
private void updateOrgPermanentNumBySubCom(String id,String subcomid,int staff_num){
RecordSet rs = new RecordSet();
//统计该分部以及所有下级分部的人员
int permanent_num = 0;
permanent_num = getOrgPermanentNumBySubCom(subcomid);
//lack_status 缺编状态 1缺编2满编3超编
int lack_status = 1;
if(permanent_num < staff_num){
lack_status = 1;
}else if(permanent_num == staff_num){
lack_status = 2;
}else if(permanent_num > staff_num){
lack_status = 3;
}
String sql = "update jcl_org_staff set permanent_num = ?,lack_status = ? where id = ?";
rs.executeUpdate(sql,permanent_num,lack_status,id);
}
private int getOrgPermanentNumBySubCom(String subcomid){
int num = 0;
RecordSet rs = new RecordSet();
//获取分部以及所有下级分部id
String subcomids = getAllSubComIds(subcomid);
String sql = "select count(1) as sl from hrmresource where status < 4 and accounttype != 1 and subcompanyid1 in ("+subcomids+")";
rs.execute(sql);
while (rs.next()){
num = Util.getIntValue(rs.getString("sl"));
}
return num;
}
private String getAllSubComIds(String subcomid){
String subcomids = subcomid;
RecordSet rs = new RecordSet();
String sql = "select id from hrmsubcompany where (canceled = 0 or canceled is null) and supsubcomid = '"+subcomid+"'";
rs.execute(sql);
while (rs.next()){
String id = Util.null2String(rs.getString("id"));
if("".equals(id)) continue;
String subids = getAllSubComIds(id);
subcomids = subcomids + "," +subids;
}
subcomids = CommUtils.distinctStringWithDot(subcomids);
return subcomids;
}
}

@ -0,0 +1,9 @@
package com.engine.shgw.service;
import java.util.Map;
public interface OrgStaffService {
Map<String,Object> updateOrgStaffing(Map<String, Object> paramMap);
}

@ -0,0 +1,15 @@
package com.engine.shgw.service.impl;
import com.engine.core.impl.Service;
import com.engine.shgw.cmd.UpdateOrgStaffingCmd;
import com.engine.shgw.service.OrgStaffService;
import java.util.Map;
public class OrgStaffServiceImpl extends Service implements OrgStaffService {
@Override
public Map<String, Object> updateOrgStaffing(Map<String, Object> paramMap) {
return commandExecutor.execute(new UpdateOrgStaffingCmd(paramMap));
}
}

@ -0,0 +1,49 @@
package com.engine.shgw.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.shgw.service.OrgStaffService;
import com.engine.shgw.service.impl.OrgStaffServiceImpl;
import weaver.general.BaseBean;
import weaver.templetecheck.upconfirmcheck.CheckService;
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.HashMap;
import java.util.Map;
/**
* Action
*
* @author wangj
* @version 1.00
* @Date 2024/5/14
*/
public class OrgStaffAction {
public OrgStaffService getService(){
return ServiceUtil.getService(OrgStaffServiceImpl.class);
}
@GET
@Path("/updateOrgStaffing")
@Produces(MediaType.TEXT_PLAIN)
public String updateOrgStaffing(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
apidatas.putAll(getService().updateOrgStaffing(ParamUtil.request2Map(request)));
} catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
}
Loading…
Cancel
Save