@ -135,7 +135,7 @@ 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 , 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 ( ) ) {
throw new OrganizationRunTimeException ( SystemEnv . getHtmlLabelName ( 547450 , user . getLanguage ( ) ) ) ;
}
@ -149,7 +149,7 @@ public class StaffServiceImpl extends Service implements StaffService {
@Override
public int updateStaff ( StaffParams param ) {
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 ) {
throw new OrganizationRunTimeException ( SystemEnv . getHtmlLabelName ( 547451 , user . getLanguage ( ) ) ) ;
}
@ -179,6 +179,10 @@ public class StaffServiceImpl extends Service implements StaffService {
}
// 更新主表
int updateStaff = getStaffMapper ( ) . updateStaff ( staffPO ) ;
// 初始化编制在编数
initStaffInfo ( staffPO ) ;
return updateStaff ;
}
@ -218,6 +222,11 @@ public class StaffServiceImpl extends Service implements StaffService {
selectOptions . add ( fullOption ) ;
selectOptions . add ( overOption ) ;
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" ) ;
// 说明
@ -225,7 +234,8 @@ public class StaffServiceImpl extends Service implements StaffService {
conditionItems . add ( compIdItem ) ;
conditionItems . add ( deptIdItem ) ;
conditionItems . add ( jobIdItem ) ;
// conditionItems.add(jobIdItem);
conditionItems . add ( workRelationItem ) ;
conditionItems . add ( staffNumItem ) ;
conditionItems . add ( permanentNumItem ) ;
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 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" , "" ) ;
BrowserBean browserBean = jobIdItem . getBrowserConditionParam ( ) ;
@ -310,6 +329,7 @@ public class StaffServiceImpl extends Service implements StaffService {
staffNumItem . setValue ( staffPO . getStaffNum ( ) ) ;
controlPolicyItem . setValue ( Util . null2String ( staffPO . getControlPolicy ( ) ) ) ;
workRelationItem . setValue ( Util . null2String ( staffPO . getWorkRelation ( ) ) ) ;
descriptionItem . setValue ( staffPO . getDescription ( ) ) ;
}
selectItems . add ( planIdItem ) ;
@ -322,7 +342,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if ( StringUtil . isEmpty ( id ) | | "3" . equals ( staffPlanPO . getControlDimension ( ) ) ) {
selectItems . add ( jobIdItem ) ;
}
selectItems . add ( workRelationItem ) ;
selectItems . add ( staffNumItem ) ;
selectItems . add ( controlPolicyItem ) ;
selectItems . add ( descriptionItem ) ;
@ -422,6 +442,10 @@ public class StaffServiceImpl extends Service implements StaffService {
if ( null ! = 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 ( ) ;
if ( StringUtils . isNotBlank ( staffDesc ) ) {
sqlWhere + = " AND t.staff_desc " + dbType . like ( staffDesc ) ;
@ -483,8 +507,16 @@ public class StaffServiceImpl extends Service implements StaffService {
public static void initStaffInfo ( StaffPO staffPO ) {
boolean hasDepartment = null ! = staffPO . getEcDepartment ( ) & & 0 ! = staffPO . getEcDepartment ( ) ;
boolean hasJob = null ! = staffPO . getJobId ( ) & & 0 ! = staffPO . getJobId ( ) ;
boolean hasWorkRelation = null ! = staffPO . getWorkRelation ( ) & & - 1 ! = staffPO . getWorkRelation ( ) ;
RecordSet rs = new RecordSet ( ) ;
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 ( ) ) {
ArrayList < String > subCompanyList = new ArrayList < > ( ) ;
subCompanyList . add ( staffPO . getEcCompany ( ) . toString ( ) ) ;
@ -510,6 +542,7 @@ public class StaffServiceImpl extends Service implements StaffService {
sql + = " and jobtitle = " + ecJobTitle ;
}
if ( "false" . equals ( new BaseBean ( ) . getPropValue ( "hrmOrganization" , "accountType" ) ) ) {
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 ;
}
}