@ -6,6 +6,7 @@ import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionType ;
import com.api.hrm.bean.HrmFieldBean ;
import com.api.hrm.util.HrmFieldSearchConditionComInfo ;
import com.api.hrm.util.HrmTransMethod ;
import com.cloudstore.eccom.constant.WeaBoolAttr ;
import com.cloudstore.eccom.pc.table.WeaTableColumn ;
import com.cloudstore.eccom.result.WeaResultMsg ;
@ -63,10 +64,7 @@ import weaver.general.BaseBean;
import weaver.general.StringUtil ;
import weaver.general.TimeUtil ;
import weaver.general.Util ;
import weaver.hrm.company.DepartmentComInfo ;
import weaver.hrm.company.SubCompanyComInfo ;
import weaver.hrm.definedfield.HrmFieldManager ;
import weaver.hrm.privacy.PrivacyComInfo ;
import weaver.systeminfo.SystemEnv ;
import java.math.BigDecimal ;
@ -189,40 +187,25 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
}
List < SearchConditionItem > items = filterByDomkey ( all , columnList ) ;
List < String > privacyList = Arrays . asList ( "-1_hrm_mobile" , "-1_hrm_telephone" , "-1_hrm_mobilecall" , "-1_hrm_fax" , "-1_hrm_email" ) ;
for ( SearchConditionItem item : items ) {
String columnName = item . getDomkey ( ) [ 0 ] ;
WeaTableColumn weaTableColumn = new WeaTableColumn ( ) ;
if ( columnName . equals ( "-1_cus_" + propValue ) ) {
weaTableColumn . setOtherpara ( columnName ) ;
fields . add ( "t.id as " + buildTableSql ( columnName ) . replace ( "." , "_" ) ) ;
weaTableColumn . setTransmethod ( "com.engine.organization.transmethod.HrmResourceTransMethod.getOrgValue" ) ;
} else if ( privacyList . contains ( columnName ) ) {
fields . add ( buildTableSql ( columnName ) + " as " + buildTableSql ( columnName ) . replace ( "." , "_" ) ) ;
PrivacyComInfo pc = new PrivacyComInfo ( ) ;
Map < String , String > mapShowSets = pc . getMapShowSets ( ) ;
String [ ] parts = columnName . split ( "_" ) ;
String fieldName = parts [ parts . length - 1 ] ;
if ( mapShowSets ! = null & & mapShowSets . get ( "mobile" ) ! = null ) {
weaTableColumn . setOtherpara ( "column:id+" + user . getUID ( ) + "+" + fieldName + "" ) ;
weaTableColumn . setTransmethod ( "weaver.hrm.privacy.PrivacyComInfo.getSearchContent" ) ;
} else {
weaTableColumn . setOtherpara ( fieldName + ":" + user . getLanguage ( ) ) ;
weaTableColumn . setTransmethod ( "weaver.hrm.HrmTransMethod.getDefineContent" ) ;
}
} else {
weaTableColumn . setOtherpara ( columnName ) ;
} else {
fields . add ( buildTableSql ( columnName ) + " as " + buildTableSql ( columnName ) . replace ( "." , "_" ) ) ;
weaTableColumn . setTransmethod ( "com.engine.organization.transmethod.HrmResourceTransMethod.getFieldTrueValue" ) ;
}
String scopeId = columnName . split ( "_" ) [ 0 ] ;
String fieldName = columnName . substring ( columnName . lastIndexOf ( "_" ) + 1 ) ;
weaTableColumn . setText ( getHrmResourceMapper ( ) . queryLabelName ( fieldName , scopeId , user . getLanguage ( ) ) ) ;
weaTableColumn . setColumn ( buildTableSql ( columnName ) . replace ( "." , "_" ) ) ;
weaTableColumn . setOtherpara ( columnName ) ;
weaTableColumn . setDisplay ( columnList . contains ( columnName ) ? WeaBoolAttr . TRUE : WeaBoolAttr . FALSE ) ;
weaTableColumn . setWidth ( decimal . setScale ( 2 , RoundingMode . HALF_UP ) . doubleValue ( ) + "%" ) ;
weaTableColumnList . add ( weaTableColumn ) ;
@ -233,7 +216,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
weaTableColumn . setColumn ( "id" ) ;
weaTableColumn . setDisplay ( WeaBoolAttr . FALSE ) ;
weaTableColumnList . add ( weaTableColumn ) ;
fields . add ( "t.id" ) ;
table . setBackfields ( StringUtils . join ( fields , "," ) ) ;
@ -325,8 +307,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
List < String > selectKeys ;
if ( "custom" . equals ( type ) ) {
if ( "-1" . equals ( templateId ) ) {
//selectKeys = Arrays.asList("-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid".split(","));
selectKeys = Arrays . asList ( "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_subcompanyid1,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid,-1_hrm_sporder" . split ( "," ) ) ;
selectKeys = Arrays . asList ( "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid" . split ( "," ) ) ;
} else {
searchTemplateById = getHrmResourceMapper ( ) . getCustomTemplateById ( templateId ) ;
selectKeys = getSelectKeys ( searchTemplateById ) ;
@ -622,7 +603,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
}
Map < String , Object > apiDatas = new HashMap < > ( ) ;
List < SearchConditionGroup > addGroups = new ArrayList < > ( ) ;
List < SearchConditionGroup > allConditions = getAllConditions ( true ) ;
List < SearchConditionGroup > allConditions = getAllConditions ( ) ;
// 穿梭框ID, 展示所选字段信息
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo ( ) ;
if ( "-1" . equals ( templateId ) ) {
@ -662,7 +643,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
btnDatas . put ( "rightMenu" , rightMenuList ) ;
btnDatas . put ( "hasRight" , true ) ;
btnDatas . put ( "loginId" , user . getUID ( ) ) ;
btnDatas . put ( "cardType" , new BaseBean ( ) . getPropValue ( "hrmOrganization" , "cardType" ) ) ;
//获取当前用户使用的列定制模板Id
btnDatas . put ( "customTemplateId" , getCustomTemplateId ( ) ) ;
btnDatas . put ( "searchTemplateId" , getSearchTemplateId ( ) ) ;
@ -805,25 +785,13 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
createConditionItems ( hrmFieldSearchConditionComInfo , hrmFieldsByScopeId , conditionItems ) ;
Map < String , SearchConditionItem > allFieldsMap = conditionItems . stream ( ) . collect ( Collectors . toMap ( item - > item . getDomkey ( ) [ 0 ] , item - > item , ( k1 , k2 ) - > k1 ) ) ;
boolean isQuickSearch = "true" . equals ( Util . null2String ( params . get ( "isQuickSearch" ) ) ) ;
DepartmentComInfo deptInfo = new DepartmentComInfo ( ) ;
SubCompanyComInfo subInfo = new SubCompanyComInfo ( ) ;
DBType dbType = DBType . get ( new RecordSet ( ) . getDBType ( ) ) ;
StringBuilder sb = new StringBuilder ( " where 1=1 " ) ;
// 默认去除外部人员显示
sb . append ( " and t.seclevel >= 0 " ) ;
if ( params . containsKey ( "lastName" ) | | ! params . containsKey ( "-1_hrm_status" ) ) {
// sb.append(" and t.status = 1");
sb . append ( " and t.status < 4" ) ;
}
if ( params . containsKey ( "-1_hrm_subcompanyid1" ) ) {
String value = Util . null2String ( params . get ( "-1_hrm_subcompanyid1" ) ) ;
if ( StringUtils . isNotBlank ( value ) ) {
sb . append ( " and t.subcompanyid1 in(" ) . append ( value ) . append ( ")" ) ;
}
params . remove ( "-1_hrm_subcompanyid1" ) ;
}
for ( Map . Entry < String , Object > entry : params . entrySet ( ) ) {
String key = entry . getKey ( ) ;
String value = Util . null2String ( entry . getValue ( ) ) ;
@ -834,18 +802,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
sb . append ( " and t.lastname " ) . append ( dbType . like ( value ) ) ;
}
if ( "companyId" . equals ( key ) ) {
ArrayList < Integer > list = new ArrayList < > ( ) ;
list . add ( Integer . parseInt ( value ) ) ;
subInfo . getSubCompanyLists ( value , list ) ;
String allSub = StringUtils . join ( list , "," ) ;
sb . append ( " and t.subcompanyid1 in(" ) . append ( allSub ) . append ( ")" ) ;
sb . append ( " and t.subcompanyid1 ='" ) . append ( value ) . append ( "'" ) ;
}
if ( "departmentId" . equals ( key ) ) {
ArrayList < Integer > list = new ArrayList < > ( ) ;
list . add ( Integer . parseInt ( value ) ) ;
deptInfo . getAllChildDeptByDepId ( list , value ) ;
String allDept = StringUtils . join ( list , "," ) ;
sb . append ( " and t.departmentId in (" ) . append ( allDept ) . append ( ")" ) ;
sb . append ( " and t.departmentId ='" ) . append ( value ) . append ( "'" ) ;
}
if ( "jobTitle" . equals ( key ) ) {
JobPO jobById = getJobMapper ( ) . getJobById ( Long . parseLong ( value ) ) ;
@ -1034,15 +994,12 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
}
public List < SearchConditionGroup > getAllConditions ( ) {
return getAllConditions ( false ) ;
}
/ * *
* 获 取 所 有 搜 索 字 段 信 息 构 建 的 高 级 搜 索 表 单
*
* @return
* /
public List < SearchConditionGroup > getAllConditions ( boolean isSearch ) {
public List < SearchConditionGroup > getAllConditions ( ) {
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo ( ) ;
List < SearchConditionGroup > addGroups = new ArrayList < > ( ) ;
List < SearchConditionItem > basicConditionItems = new ArrayList < > ( ) ;
@ -1053,8 +1010,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
List < CusFormFieldPO > hrmFieldsByScopeId = getSystemDataMapper ( ) . getHrmFieldsByScopeId ( HrmGroupEnum . HRM_BASIC . getGroupType ( ) . toString ( ) ) ;
createConditionItems ( hrmFieldSearchConditionComInfo , hrmFieldsByScopeId , basicConditionItems ) ;
if ( CollectionUtils . isNotEmpty ( basicConditionItems ) ) {
SearchConditionItem searchConditionItem = buildSubCompanyCondition ( hrmFieldSearchConditionComInfo , isSearch ) ;
basicConditionItems . add ( 0 , searchConditionItem ) ;
addGroups . add ( new SearchConditionGroup ( SystemEnv . getHtmlLabelName ( 547175 , user . getLanguage ( ) ) , true , basicConditionItems ) ) ;
}
@ -1074,34 +1029,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
return addGroups ;
}
/ * *
* 花 名 册 构 建
*
* @param hrmFieldSearchConditionComInfo
* @param isSearch
* @return
* /
private SearchConditionItem buildSubCompanyCondition ( HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo , boolean isSearch ) {
HrmFieldBean hrmFieldBean = new HrmFieldBean ( ) ;
hrmFieldBean . setFieldid ( "" ) ;
hrmFieldBean . setFieldname ( "-1_hrm_subcompanyid1" ) ;
hrmFieldBean . setFieldlabel ( "-2458" ) ;
hrmFieldBean . setFieldhtmltype ( "3" ) ;
if ( isSearch ) {
hrmFieldBean . setType ( "170" ) ;
} else {
hrmFieldBean . setType ( "164" ) ;
}
hrmFieldBean . setIsQuickSearch ( false ) ;
hrmFieldBean . setIsScope ( false ) ;
hrmFieldBean . setDmlurl ( "" ) ;
hrmFieldBean . setIssystem ( "1" ) ;
hrmFieldBean . setIsFormField ( true ) ;
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo . getSearchConditionItem ( hrmFieldBean , user ) ;
return searchConditionItem ;
}
/ * *
* 构 建 查 询 条 件 Item
*
@ -1154,37 +1081,32 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
HrmFieldManager hfm = new HrmFieldManager ( "HrmCustomFieldByInfoType" , scopeid ) ;
List < SearchConditionItem > conditionItems = new ArrayList < > ( ) ;
for ( String field : fieldNames ) {
if ( "-1_hrm_subcompanyid1" . equals ( field ) ) {
SearchConditionItem searchConditionItem = buildSubCompanyCondition ( hrmFieldSearchConditionComInfo , true ) ;
conditionItems . add ( searchConditionItem ) ;
} else {
String fieldName = field . substring ( field . lastIndexOf ( "_" ) + 1 ) ;
JSONObject hrmFieldConf = hfm . getHrmFieldConf ( fieldName ) ;
if ( null = = hrmFieldConf ) {
continue ;
}
boolean baseField = hfm . isBaseField ( fieldName ) ;
HrmFieldBean hrmFieldBean = new HrmFieldBean ( ) ;
hrmFieldBean . setFieldid ( Util . null2String ( hrmFieldConf . getString ( "id" ) ) ) ;
hrmFieldBean . setFieldname ( scopeid + "_" + ( baseField ? "hrm" : "cus" ) + "_" + fieldName ) ;
hrmFieldBean . setFieldlabel ( hrmFieldConf . getString ( "fieldlabel" ) ) ;
hrmFieldBean . setFieldhtmltype ( hrmFieldConf . getString ( "fieldhtmltype" ) ) ;
hrmFieldBean . setType ( hrmFieldConf . getString ( "type" ) ) ;
hrmFieldBean . setDmlurl ( hrmFieldConf . getString ( "dmlurl" ) ) ;
hrmFieldBean . setIssystem ( baseField ? "1" : "0" ) ;
hrmFieldBean . setIsFormField ( true ) ;
hrmFieldBean . setIsQuickSearch ( false ) ;
hrmFieldBean . setIsScope ( false ) ;
if ( "jobactivity" . equals ( fieldName ) ) {
// 职务: 282
hrmFieldBean . setType ( "282" ) ;
}
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo . getSearchConditionItem ( hrmFieldBean , user ) ;
conditionItems . add ( searchConditionItem ) ;
// 如果为下拉框,添加一条空选项
if ( searchConditionItem . getConditionType ( ) . equals ( ConditionType . SELECT ) ) {
addEmptyForSelect ( searchConditionItem ) ;
}
String fieldName = field . substring ( field . lastIndexOf ( "_" ) + 1 ) ;
JSONObject hrmFieldConf = hfm . getHrmFieldConf ( fieldName ) ;
if ( null = = hrmFieldConf ) {
continue ;
}
boolean baseField = hfm . isBaseField ( fieldName ) ;
HrmFieldBean hrmFieldBean = new HrmFieldBean ( ) ;
hrmFieldBean . setFieldid ( Util . null2String ( hrmFieldConf . getString ( "id" ) ) ) ;
hrmFieldBean . setFieldname ( scopeid + "_" + ( baseField ? "hrm" : "cus" ) + "_" + fieldName ) ;
hrmFieldBean . setFieldlabel ( hrmFieldConf . getString ( "fieldlabel" ) ) ;
hrmFieldBean . setFieldhtmltype ( hrmFieldConf . getString ( "fieldhtmltype" ) ) ;
hrmFieldBean . setType ( hrmFieldConf . getString ( "type" ) ) ;
hrmFieldBean . setDmlurl ( hrmFieldConf . getString ( "dmlurl" ) ) ;
hrmFieldBean . setIssystem ( baseField ? "1" : "0" ) ;
hrmFieldBean . setIsFormField ( true ) ;
hrmFieldBean . setIsQuickSearch ( false ) ;
hrmFieldBean . setIsScope ( false ) ;
if ( "jobactivity" . equals ( fieldName ) ) {
// 职务: 282
hrmFieldBean . setType ( "282" ) ;
}
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo . getSearchConditionItem ( hrmFieldBean , user ) ;
conditionItems . add ( searchConditionItem ) ;
// 如果为下拉框,添加一条空选项
if ( searchConditionItem . getConditionType ( ) . equals ( ConditionType . SELECT ) ) {
addEmptyForSelect ( searchConditionItem ) ;
}
}
if ( CollectionUtils . isNotEmpty ( conditionItems ) ) {
@ -1313,7 +1235,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
case BROWSER : //浏览按钮
// 兼容多选浏览按钮
sb . append ( " and " ) . append ( dbType . concat ( tableSql ) ) . append ( dbType . like ( "," + value + "," ) ) ;
sb . append ( " and " ) . append ( dbType . concat ( tableSql ) ) . append ( dbType . like ( value ) ) ;
break ;
case INPUTNUMBER : // 数字