编制管理

pull/227/MERGE^2
dxfeng 3 years ago
parent 6415ee3eb7
commit 6c04ffd384

@ -20,7 +20,9 @@ public class StaffBO {
.id(param.getId())
.planId(param.getPlanId())
.compId(param.getCompId())
.ecCompany(param.getEcCompany())
.deptId(param.getDeptId())
.ecDepartment(param.getEcDepartment())
.jobId(param.getJobId())
.staffNum(param.getStaffNum())
.controlPolicy(param.getControlPolicy())

@ -28,10 +28,12 @@ public class StaffSearchParam {
*
*/
private Long compId;
private Long ecCompany;
/**
*
*/
private Long deptId;
private Long ecDepartment;
/**
*
*/

@ -30,10 +30,12 @@ public class StaffPO {
*
*/
private Long compId;
private Long ecCompany;
/**
*
*/
private Long deptId;
private Long ecDepartment;
/**
*
*/

@ -77,6 +77,12 @@
<if test=" departmentPO.ecDepartment != null ">
and t.ec_department = #{departmentPO.ecDepartment}
</if>
<if test=" departmentPO.parentComp != null ">
and t.parent_comp = #{departmentPO.parentComp}
</if>
<if test=" departmentPO.parentDept != null ">
and t.parent_dept = #{departmentPO.parentDept}
</if>
<if test=" departmentPO.deptPrincipal != null ">
and t.dept_principal = #{departmentPO.deptPrincipal}
</if>

@ -5,7 +5,8 @@
<result column="id" property="id"/>
<result column="plan_id" property="planId"/>
<result column="comp_id" property="compId"/>
<result column="dept_id" property="deptId"/>
<result column="ec_company" property="ecCompany"/>
<result column="ec_department" property="ecDepartment"/>
<result column="job_id" property="jobId"/>
<result column="staff_num" property="staffNum"/>
<result column="control_policy" property="controlPolicy"/>
@ -27,7 +28,9 @@
id
, t.plan_id
, t.comp_id
, t.ec_company
, t.dept_id
, t.ec_department
, t.job_id
, t.staff_num
, t.control_policy
@ -82,7 +85,9 @@
update_time=#{updateTime},
plan_id=#{planId},
comp_id=#{compId},
ec_company=#{ecCompany},
dept_id=#{deptId},
ec_department=#{ecDepartment},
job_id=#{jobId},
staff_num=#{staffNum},
control_policy=#{controlPolicy},
@ -120,6 +125,12 @@
<if test="deptId != null ">
dept_id,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="ecDepartment != null ">
ec_department,
</if>
<if test="jobId != null ">
job_id,
</if>
@ -168,6 +179,12 @@
<if test="deptId != null ">
#{deptId},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="ecDepartment != null ">
#{ecDepartment},
</if>
<if test="jobId != null ">
#{jobId},
</if>
@ -196,7 +213,7 @@
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_STAFF_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_staff
@ -222,6 +239,12 @@
<if test="deptId != null ">
dept_id,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="ecDepartment != null ">
ec_department,
</if>
<if test="jobId != null ">
job_id,
</if>
@ -270,6 +293,12 @@
<if test="deptId != null ">
#{deptId},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="ecDepartment != null ">
#{ecDepartment},
</if>
<if test="jobId != null ">
#{jobId},
</if>

@ -687,6 +687,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
&& StringUtil.isEmpty(departmentPO.getDeptNameShort())
&& null == departmentPO.getEcCompany()
&& null == departmentPO.getEcDepartment()
&& null == departmentPO.getParentComp()
&& null == departmentPO.getParentDept()
&& null == departmentPO.getDeptPrincipal()
&& null == departmentPO.getShowOrder()
&& null == departmentPO.getForbiddenTag());

@ -3,7 +3,6 @@ package com.engine.organization.service.impl;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.BrowserInitUtil;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
@ -16,6 +15,7 @@ import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.service.StaffPlanService;
import com.engine.organization.util.*;
import com.engine.organization.util.browser.OrganizationBrowserUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
@ -24,7 +24,6 @@ import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.definedfield.HrmFieldManager;
import java.util.*;
@ -213,29 +212,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
String tmpFieldValue = staffPlanPO.getEcCompany();
if (StringUtils.isNotBlank(tmpFieldValue)) {
HrmFieldManager hrmFieldManager = new HrmFieldManager();
String fieldshowname = null;
try {
fieldshowname = hrmFieldManager.getFieldvalue(user, null, 0, 3, 164, tmpFieldValue, 0);
} catch (Exception e) {
throw new RuntimeException(e);
}
String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
String[] fieldshownames = Util.splitString(fieldshowname, ",");
List<Map<String, Object>> replaceDatas = new ArrayList<>();
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
if (fieldvalues.length != fieldshownames.length) {
break;
}
if (Util.null2String(fieldshownames[i]).length() == 0) {
continue;
}
Map<String, Object> replaceData = new HashMap<>();
replaceData.put("id", fieldvalues[i]);
replaceData.put("name", fieldshownames[i]);
replaceDatas.add(replaceData);
}
BrowserInitUtil.setConditionItemDefaultValue(ecCompanyIdtItem, replaceDatas, 2);
OrganizationBrowserUtil.assignBrowser(user, tmpFieldValue, 164, ecCompanyIdtItem);
}
dimensionItem.setValue(staffPlanPO.getControlDimension());

@ -10,6 +10,8 @@ import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.browser.po.CustomBrowserBean;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.staff.bo.StaffBO;
import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.entity.staff.po.StaffPO;
@ -24,8 +26,10 @@ import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.mapper.staff.StaffsMapper;
import com.engine.organization.service.StaffService;
import com.engine.organization.util.*;
import com.engine.organization.util.browser.OrganizationBrowserUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
@ -89,6 +93,15 @@ public class StaffServiceImpl extends Service implements StaffService {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, "编制数不可小于0请更正");
// 赋值
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(staffPO.getEcCompany() + "");
if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId());
}
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(staffPO.getEcDepartment() + "");
if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId());
}
checkRequired(staffPO);
return getStaffMapper().insertIgnoreNull(staffPO);
}
@ -98,6 +111,15 @@ public class StaffServiceImpl extends Service implements StaffService {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
StaffPO staffByID = getStaffMapper().getStaffByID(param.getId());
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
// 赋值
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(staffPO.getEcCompany() + "");
if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId());
}
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(staffPO.getEcDepartment() + "");
if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId());
}
checkRequired(staffPO);
Integer changeNum = param.getChangeNum();
if (null == changeNum) {
@ -132,16 +154,13 @@ public class StaffServiceImpl extends Service implements StaffService {
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
//// 方案
//SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "方案11", "161", "planId", "staffPlanBrowser");
//planIdItem.setHide(true);
//planIdItem.setDisplay("none");
// 分部
SearchConditionItem compIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "161", "compId", "compBrowser");
SearchConditionItem compIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "164", "ecCompany", "");
// 部门
SearchConditionItem deptIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "161", "deptId", "deptBrowser");
SearchConditionItem deptIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "4", "ecDepartment", "");
// 岗位
SearchConditionItem jobIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "161", "jobId", "jobBrowser");
SearchConditionItem jobIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "666", "jobId", "");
// 编制数
SearchConditionItem staffNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 2, "编制数", "staffNum");
// 在编
@ -188,14 +207,11 @@ public class StaffServiceImpl extends Service implements StaffService {
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "方案", "161", "planId", "staffPlanBrowser");
planIdItem.setRules("required|string");
// 分部
SearchConditionItem compIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "161", "compId", "compBrowser");
//compIdItem.setRules("required|string");
SearchConditionItem ecCompanyItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "164", "ecCompany", "compBrowser");
// 部门
SearchConditionItem deptIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "161", "deptId", "deptBrowser");
//deptIdItem.setRules("required|string");
SearchConditionItem ecDepartmentItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "4", "ecDepartment", "deptBrowser");
// 岗位
SearchConditionItem jobIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "666", "jobId", "");
//jobIdItem.setRules("required|string");
BrowserBean browserBean = jobIdItem.getBrowserConditionParam();
String s = JSONObject.toJSONString(browserBean);
CustomBrowserBean customBrowserBean = JSONObject.parseObject(s, CustomBrowserBean.class);
@ -231,18 +247,12 @@ public class StaffServiceImpl extends Service implements StaffService {
planIdItemBean.setReplaceDatas(planIdMaps);
planIdItem.setBrowserConditionParam(planIdItemBean);
if (null != staffPO.getCompId()) {
BrowserBean compIdItemBean = compIdItem.getBrowserConditionParam();
List<Map<String, Object>> compIdMaps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPO.getCompId().toString()).build().getIds());
compIdItemBean.setReplaceDatas(compIdMaps);
compIdItem.setBrowserConditionParam(compIdItemBean);
if (null != staffPO.getEcCompany()) {
OrganizationBrowserUtil.assignBrowser(user, staffPO.getEcCompany().toString(), 164, ecCompanyItem);
}
if (null != staffPO.getDeptId()) {
BrowserBean deptIdItemBean = deptIdItem.getBrowserConditionParam();
List<Map<String, Object>> deptIdMaps = getDepartmentMapper().listDeptsByIds(DeleteParam.builder().ids(staffPO.getDeptId().toString()).build().getIds());
deptIdItemBean.setReplaceDatas(deptIdMaps);
deptIdItem.setBrowserConditionParam(deptIdItemBean);
if (null != staffPO.getEcDepartment()) {
OrganizationBrowserUtil.assignBrowser(user, staffPO.getEcDepartment().toString(), 4, ecDepartmentItem);
}
if (null != staffPO.getJobId()) {
@ -257,8 +267,8 @@ public class StaffServiceImpl extends Service implements StaffService {
descriptionItem.setValue(staffPO.getDescription());
}
selectItems.add(planIdItem);
selectItems.add(compIdItem);
selectItems.add(deptIdItem);
selectItems.add(ecCompanyItem);
selectItems.add(ecDepartmentItem);
selectItems.add(jobIdItem);
selectItems.add(staffNumItem);
selectItems.add(controlPolicyItem);
@ -322,6 +332,14 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != deptId) {
sqlWhere += " AND t.dept_id = '" + deptId + "'";
}
Long ecCompany = param.getEcCompany();
if (null != ecCompany) {
sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
}
Long ecDepartment = param.getEcDepartment();
if (null != ecDepartment) {
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
}
Long jobId = param.getJobId();
if (null != jobId) {
sqlWhere += " AND t.job_id = '" + jobId + "'";

@ -0,0 +1,54 @@
package com.engine.organization.util.browser;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.util.BrowserInitUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmFieldManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/09/06
* @version: 1.0
*/
public class OrganizationBrowserUtil {
/**
*
*
* @param user
* @param tmpFieldValue
* @param browserType
* @param searchConditionItem
*/
public static void assignBrowser(User user, String tmpFieldValue, int browserType, SearchConditionItem searchConditionItem) {
HrmFieldManager hrmFieldManager = new HrmFieldManager();
String fieldShowName = null;
try {
fieldShowName = hrmFieldManager.getFieldvalue(user, null, 0, 3, browserType, tmpFieldValue, 0);
} catch (Exception e) {
throw new RuntimeException(e);
}
String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
String[] fieldshownames = Util.splitString(fieldShowName, ",");
List<Map<String, Object>> replaceDatas = new ArrayList<>();
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
if (fieldvalues.length != fieldshownames.length) {
break;
}
if (Util.null2String(fieldshownames[i]).length() == 0) {
continue;
}
Map<String, Object> replaceData = new HashMap<>();
replaceData.put("id", fieldvalues[i]);
replaceData.put("name", fieldshownames[i]);
replaceDatas.add(replaceData);
}
BrowserInitUtil.setConditionItemDefaultValue(searchConditionItem, replaceDatas, 2);
}
}
Loading…
Cancel
Save