2022-07-07 10:14:25 +08:00
package com.engine.organization.service.impl ;
import cn.hutool.core.date.DateField ;
import cn.hutool.core.date.DateUtil ;
import com.engine.core.impl.Service ;
2023-06-27 09:12:41 +08:00
import com.engine.organization.entity.chart.CompanyTreePO ;
2023-06-29 17:37:05 +08:00
import com.engine.organization.entity.chart.TimeLinesBO ;
2022-12-16 14:25:30 +08:00
import com.engine.organization.entity.map.JclOrgMap ;
2022-10-21 09:28:33 +08:00
import com.engine.organization.entity.scheme.po.GradePO ;
import com.engine.organization.entity.scheme.po.LevelPO ;
2022-12-16 14:25:30 +08:00
import com.engine.organization.mapper.jclorgmap.JclOrgMapper ;
2022-10-21 09:28:33 +08:00
import com.engine.organization.mapper.scheme.GradeMapper ;
import com.engine.organization.mapper.scheme.LevelMapper ;
2022-07-07 10:14:25 +08:00
import com.engine.organization.service.OrgChartService ;
2022-08-17 19:29:46 +08:00
import com.engine.organization.util.HasRightUtil ;
2022-12-16 14:25:30 +08:00
import com.engine.organization.util.OrganizationDateUtil ;
2022-08-12 10:12:55 +08:00
import com.engine.organization.util.db.DBType ;
2022-10-21 09:28:33 +08:00
import com.engine.organization.util.db.MapperProxyFactory ;
2022-11-02 10:55:15 +08:00
import com.engine.organization.util.detach.DetachUtil ;
2022-07-07 10:14:25 +08:00
import org.apache.commons.lang3.StringUtils ;
2023-06-28 17:58:12 +08:00
import tebie.applib.api.O ;
2022-07-07 10:14:25 +08:00
import weaver.conn.RecordSet ;
2022-11-02 10:55:15 +08:00
import weaver.general.Util ;
2022-07-07 10:14:25 +08:00
import weaver.hrm.User ;
2023-06-28 17:58:12 +08:00
import java.time.LocalDate ;
import java.time.LocalDateTime ;
2022-07-07 10:14:25 +08:00
import java.util.* ;
2022-11-02 10:55:15 +08:00
import java.util.stream.Collectors ;
2022-07-07 10:14:25 +08:00
2023-06-28 17:58:12 +08:00
2022-07-07 10:14:25 +08:00
public class OrgChartServiceImpl extends Service implements OrgChartService {
2022-07-21 11:01:36 +08:00
private RecordSet grs = new RecordSet ( ) ;
2022-08-18 15:17:59 +08:00
private static final String COMPANY_RIGHT = " OrgChart:All " ;
private static final String USER_RIGHT = " OrgPerspective:All " ;
2022-12-20 15:36:39 +08:00
private final String level = getFieldName ( " 职等 " ) ;
private final String grade = getFieldName ( " 职级 " ) ;
2022-08-18 15:17:59 +08:00
2022-07-07 10:14:25 +08:00
@Override
public Map < String , Object > getOptionCondition ( Map < String , Object > request2Map , User user ) {
2022-08-18 14:27:16 +08:00
Map < String , Object > result = new HashMap < > ( ) ;
2022-07-07 10:14:25 +08:00
RecordSet rs = new RecordSet ( ) ;
Map < String , Object > defaultItem = new HashMap < > ( ) ;
2023-06-27 10:09:05 +08:00
rs . executeQuery ( " select companyname from hrmcompany " ) ;
rs . next ( ) ;
2023-06-26 17:00:12 +08:00
int fkey = 0 ;
2023-06-27 09:12:41 +08:00
defaultItem . put ( " key " , fkey + + ) ;
2022-07-07 10:14:25 +08:00
defaultItem . put ( " id " , " 0 " ) ;
2023-06-27 10:09:05 +08:00
defaultItem . put ( " companyname " , Util . null2String ( rs . getString ( " companyname " ) ) ) ;
rs . executeQuery ( " select id, companyname from HrmCompanyVirtual order by id " ) ;
List < Map < String , Object > > fclasslist = new ArrayList < > ( ) ;
2022-07-07 10:14:25 +08:00
fclasslist . add ( defaultItem ) ;
2022-08-12 10:12:55 +08:00
while ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
2023-06-27 09:12:41 +08:00
item . put ( " key " , fkey + + ) ;
2022-07-07 10:14:25 +08:00
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " companyname " , rs . getString ( " companyname " ) ) ;
fclasslist . add ( item ) ;
}
2022-11-16 13:39:56 +08:00
String sql = " select id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) " ;
2022-07-07 10:14:25 +08:00
2022-11-02 10:55:15 +08:00
// 分部分权过滤
2022-12-13 10:42:35 +08:00
DetachUtil detachUtil = new DetachUtil ( user ) ;
2022-11-02 10:55:15 +08:00
if ( detachUtil . isDETACH ( ) ) {
2022-11-03 16:51:56 +08:00
String jclRoleLevels = detachUtil . getJclRoleLevels ( ) ;
if ( StringUtils . isNotBlank ( jclRoleLevels ) ) {
2023-06-28 17:58:12 +08:00
sql = " select id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in( " + jclRoleLevels + " ))) " ;
2022-11-03 16:51:56 +08:00
} else {
2022-11-16 13:39:56 +08:00
sql = " select id, fnumber, fname, ftype from jcl_org_map where ftype = 0 " ;
2022-11-03 16:51:56 +08:00
}
2022-11-02 10:55:15 +08:00
}
2022-11-15 14:34:16 +08:00
rs . executeQuery ( sql + " and fdateend > " + DBType . get ( new RecordSet ( ) . getDBType ( ) ) . currentDate ( ) + " order by ftype , id,fdateend desc " ) ;
2022-11-09 18:50:39 +08:00
Set < OrgSelectItem > companySet = new HashSet < > ( ) ;
2023-06-26 17:00:12 +08:00
int ckey = 0 ;
2022-08-12 10:12:55 +08:00
while ( rs . next ( ) ) {
2022-11-09 18:50:39 +08:00
OrgSelectItem item = new OrgSelectItem ( ) ;
2023-06-26 17:00:12 +08:00
item . setKey ( ckey + + ) ;
2022-11-09 18:50:39 +08:00
item . setId ( rs . getString ( " id " ) ) ;
item . setFnumber ( rs . getString ( " fnumber " ) ) ;
item . setFname ( rs . getString ( " fname " ) ) ;
companySet . add ( item ) ;
2022-07-07 10:14:25 +08:00
}
2023-06-27 09:12:41 +08:00
List < CompanyTreePO > companyTree = new ArrayList < > ( ) ;
sql = " select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType . get ( new RecordSet ( ) . getDBType ( ) ) . ifNull ( " supsubcomid " , " 0 " ) + " = '0' " ;
rs . executeQuery ( sql ) ;
while ( rs . next ( ) ) {
companyTree . add ( CompanyTreePO . builder ( ) . id ( rs . getString ( " id " ) ) . pId ( rs . getString ( " pId " ) ) . value ( rs . getString ( " value " ) ) . title ( rs . getString ( " title " ) ) . build ( ) ) ;
}
2022-07-07 10:14:25 +08:00
result . put ( " api_status " , true ) ;
result . put ( " fclasslist " , fclasslist ) ;
2022-11-09 18:50:39 +08:00
result . put ( " companylist " , companySet ) ;
2023-06-27 09:12:41 +08:00
result . put ( " companyTree " , companyTree ) ;
return result ;
}
@Override
public Map < String , Object > getSubCompanyTree ( Map < String , Object > params ) {
Map < String , Object > result = new HashMap < > ( 2 ) ;
RecordSet rs = new RecordSet ( ) ;
List < CompanyTreePO > companyTree = new ArrayList < > ( ) ;
String subcompany = Util . null2String ( params . get ( " subcompany " ) ) ;
if ( StringUtils . isBlank ( subcompany ) ) {
subcompany = " 0 " ;
}
String fclass = Util . null2String ( params . get ( " fclass " ) ) ;
String sql = " select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType . get ( new RecordSet ( ) . getDBType ( ) ) . ifNull ( " supsubcomid " , " 0 " ) + " = ' " + subcompany + " ' " ;
if ( StringUtils . isNotBlank ( fclass ) & & ! " 0 " . equals ( fclass ) ) {
sql = " select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType . get ( new RecordSet ( ) . getDBType ( ) ) . ifNull ( " supsubcomid " , " 0 " ) + " = ' " + subcompany + " ' and companyid = ' " + fclass + " ' " ;
}
rs . executeQuery ( sql ) ;
while ( rs . next ( ) ) {
companyTree . add ( CompanyTreePO . builder ( ) . id ( rs . getString ( " id " ) ) . pId ( rs . getString ( " pId " ) ) . value ( rs . getString ( " value " ) ) . title ( rs . getString ( " title " ) ) . build ( ) ) ;
}
result . put ( " companyTree " , companyTree ) ;
2022-07-07 10:14:25 +08:00
return result ;
}
2022-07-21 11:56:54 +08:00
private String companyDateWhereSql ( Map < String , Object > request2Map ) {
2023-06-26 17:00:12 +08:00
String date = ( String ) request2Map . get ( " date " ) ;
2022-08-12 10:12:55 +08:00
if ( StringUtils . isBlank ( date ) ) {
date = DateUtil . format ( DateUtil . offset ( new Date ( ) , DateField . DAY_OF_MONTH , 1 ) , " yyyy-MM-dd " ) ;
2022-07-07 10:14:25 +08:00
}
2023-06-26 17:00:12 +08:00
String fclass = ( String ) request2Map . get ( " fclass " ) ;
String fisvitual = ( String ) request2Map . get ( " fisvitual " ) ;
2022-08-12 10:12:55 +08:00
if ( StringUtils . isBlank ( fisvitual ) ) {
2022-07-07 10:14:25 +08:00
fisvitual = " 0 " ;
}
String whereSql = " where 1 = 1 " ;
2022-08-12 10:12:55 +08:00
if ( DBType . isOracle ( ) ) {
whereSql + = " and ((fdatebegin <= to_date(' " + date + " ','yyyy-MM-DD') and fdateend >= to_date(' " + date + " ','yyyy-MM-DD')) or (fdatebegin <= to_date(' " + date + " ','yyyy-MM-DD') and fdateend is null )) " ;
2023-06-27 09:12:41 +08:00
} else {
2022-08-12 10:12:55 +08:00
whereSql + = " and ((fdatebegin <= ' " + date + " ' and fdateend >= ' " + date + " ') or (fdatebegin <= ' " + date + " ' and fdateend is null )) " ;
}
whereSql + = " and fclass = " + fclass + " " ;
2022-07-07 10:14:25 +08:00
2022-08-12 10:12:55 +08:00
if ( " 0 " . equals ( fisvitual ) ) {
2022-07-07 10:14:25 +08:00
whereSql + = " and fisvitual = 0 " ;
2022-08-12 10:12:55 +08:00
} else {
2022-07-07 10:14:25 +08:00
whereSql + = " and fisvitual in (0, 1) " ;
}
2022-07-21 11:01:36 +08:00
whereSql + = " and ftype in (0 , 1 ,2) " ;
2022-07-21 11:56:54 +08:00
return whereSql ;
}
@Override
public Map < String , Object > getCompanyData ( Map < String , Object > request2Map , User user ) {
2022-08-18 15:17:59 +08:00
Map < String , Object > result = new HashMap < > ( ) ;
boolean hasRight = HasRightUtil . hasRight ( user , COMPANY_RIGHT , true ) ;
result . put ( " hasRight " , hasRight ) ;
if ( ! hasRight ) {
return result ;
}
2022-07-21 11:56:54 +08:00
2023-06-26 17:00:12 +08:00
String root = ( String ) request2Map . get ( " root " ) ;
String level = ( String ) request2Map . get ( " level " ) ;
2022-08-12 10:12:55 +08:00
if ( StringUtils . isBlank ( level ) ) {
2022-07-21 11:56:54 +08:00
level = " 3 " ;
}
String whereSql = companyDateWhereSql ( request2Map ) ;
2022-07-21 11:01:36 +08:00
2022-07-07 10:14:25 +08:00
String whereItemSql = " " ;
2023-06-26 17:00:12 +08:00
if ( " 0 " . equals ( root ) ) {
2022-07-07 10:14:25 +08:00
whereItemSql + = " and ftype = 0 " ;
} else {
2022-08-12 10:12:55 +08:00
whereItemSql + = " and id = ' " + root + " ' " ;
2022-07-07 10:14:25 +08:00
}
// 获取根节点
RecordSet rs = new RecordSet ( ) ;
2023-05-16 16:42:28 +08:00
String sql = " select id, fname, ftype, fparentid, fnumber, fobjid, fisvitual from jcl_org_map " + whereSql + whereItemSql ;
rs . executeQuery ( sql ) ;
2022-07-07 10:14:25 +08:00
List < Map < String , Object > > list = new ArrayList < > ( ) ;
String id = null ;
2022-08-12 10:12:55 +08:00
if ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
id = rs . getString ( " id " ) ;
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " fname " , rs . getString ( " fname " ) ) ;
item . put ( " ftype " , rs . getString ( " ftype " ) ) ;
2022-07-21 11:08:08 +08:00
item . put ( " fnumber " , rs . getString ( " fnumber " ) ) ;
2022-11-02 10:55:15 +08:00
item . put ( " fobjid " , rs . getString ( " fobjid " ) ) ;
2022-07-07 10:14:25 +08:00
item . put ( " parentId " , null ) ;
2022-07-21 11:01:36 +08:00
item . put ( " expand " , " 1 " ) ;
2022-11-02 20:18:55 +08:00
item . put ( " fisvitual " , rs . getString ( " fisvitual " ) ) ;
2022-07-21 11:01:36 +08:00
item . put ( " hasChildren " , hasChildren ( rs . getString ( " id " ) , true ) ) ;
2022-07-07 10:14:25 +08:00
list . add ( item ) ;
}
2022-10-18 12:17:11 +08:00
int currentLevel = 1 ;
2022-11-02 10:55:15 +08:00
findCompanyItemByParantId ( id , currentLevel + 1 , level , rs , list , whereSql , currentLevel + 1 < = Integer . parseInt ( level ) ) ;
// 分部数据,构建层级关系
2022-11-08 15:21:29 +08:00
reBuildTreeList ( list , root ) ;
2022-07-07 10:14:25 +08:00
result . put ( " api_status " , true ) ;
result . put ( " data " , list ) ;
return result ;
}
2022-07-21 11:01:36 +08:00
private void findCompanyItemByParantId ( String id , int currentLevel , String level , RecordSet rs , List < Map < String , Object > > list , String whereSql , boolean expand ) {
2022-11-02 20:18:55 +08:00
String sql = " select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql ;
2022-12-13 10:42:35 +08:00
DetachUtil detachUtil = new DetachUtil ( user ) ;
2022-11-03 11:06:36 +08:00
if ( detachUtil . isDETACH ( ) ) {
if ( " 0 " . equals ( id ) ) {
sql + = " and ftype = 1 and fobjid in( " + detachUtil . getJclRoleLevels ( ) + " ) " ;
} else {
sql + = " and fparentid = " + id + " and ftype !=1 " ;
}
2022-11-02 10:55:15 +08:00
} else {
sql + = " and fparentid = " + id ;
}
rs . executeQuery ( sql ) ;
2022-07-07 10:14:25 +08:00
List < Map < String , Object > > currentList = new ArrayList < > ( ) ;
2022-08-12 10:12:55 +08:00
while ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " fname " , rs . getString ( " fname " ) ) ;
item . put ( " ftype " , rs . getString ( " ftype " ) ) ;
item . put ( " parentId " , rs . getString ( " fparentid " ) ) ;
2022-07-21 11:08:08 +08:00
item . put ( " fnumber " , rs . getString ( " fnumber " ) ) ;
2022-08-30 11:40:30 +08:00
item . put ( " fobjid " , rs . getString ( " fobjid " ) ) ;
item . put ( " fecid " , rs . getString ( " fecid " ) ) ;
2022-11-02 20:18:55 +08:00
item . put ( " fisvitual " , rs . getString ( " fisvitual " ) ) ;
2022-07-21 11:01:36 +08:00
item . put ( " expand " , expand ? " 1 " : " 0 " ) ;
item . put ( " hasChildren " , hasChildren ( rs . getString ( " id " ) , true ) ) ;
2022-07-07 10:14:25 +08:00
currentList . add ( item ) ;
}
list . addAll ( currentList ) ;
for ( Map < String , Object > stringObjectMap : currentList ) {
2022-08-12 10:12:55 +08:00
if ( currentLevel + 1 < = Integer . parseInt ( level ) ) {
2022-07-21 11:01:36 +08:00
findCompanyItemByParantId ( ( String ) stringObjectMap . get ( " id " ) , currentLevel + 1 , level , rs , list , whereSql , true ) ;
2022-08-12 10:12:55 +08:00
} else if ( currentLevel = = Integer . parseInt ( level ) ) {
2022-07-21 11:01:36 +08:00
findCompanyItemByParantId ( ( String ) stringObjectMap . get ( " id " ) , currentLevel + 1 , level , rs , list , whereSql , false ) ;
2022-07-07 10:14:25 +08:00
}
}
}
2022-07-21 11:56:54 +08:00
private String userWhereSql ( Map < String , Object > request2Map ) {
2023-06-26 17:00:12 +08:00
String date = ( String ) request2Map . get ( " date " ) ;
2022-08-12 10:12:55 +08:00
if ( StringUtils . isBlank ( date ) ) {
date = DateUtil . format ( DateUtil . offset ( new Date ( ) , DateField . DAY_OF_MONTH , 1 ) , " yyyy-MM-dd " ) ;
2022-07-07 10:14:25 +08:00
}
2023-06-26 17:00:12 +08:00
String fclass = ( String ) request2Map . get ( " fclass " ) ;
2022-07-21 11:56:54 +08:00
2023-06-26 17:00:12 +08:00
String fisvitual = ( String ) request2Map . get ( " fisvitual " ) ;
2022-08-12 10:12:55 +08:00
if ( StringUtils . isBlank ( fisvitual ) ) {
2022-07-07 10:14:25 +08:00
fisvitual = " 0 " ;
}
String whereSql = " where 1 = 1 " ;
2022-08-12 10:12:55 +08:00
if ( DBType . isOracle ( ) ) {
whereSql + = " and ((t.fdatebegin <= to_date(' " + date + " ','yyyy-MM-DD') and t.fdateend >= to_date(' " + date + " ','yyyy-MM-DD')) or (t.fdatebegin <= to_date(' " + date + " ','yyyy-MM-DD') and t.fdateend is null )) " ;
2023-06-27 09:12:41 +08:00
} else {
2022-08-12 10:12:55 +08:00
whereSql + = " and ((t.fdatebegin <= ' " + date + " ' and t.fdateend >= ' " + date + " ') or (t.fdatebegin <= ' " + date + " ' and t.fdateend is null )) " ;
}
whereSql + = " and t.fclass = " + fclass + " " ;
2022-07-07 10:14:25 +08:00
2022-08-12 10:12:55 +08:00
if ( " 0 " . equals ( fisvitual ) ) {
2022-07-07 10:14:25 +08:00
whereSql + = " and t.fisvitual = 0 " ;
2022-08-12 10:12:55 +08:00
} else {
2022-07-07 10:14:25 +08:00
whereSql + = " and t.fisvitual in (0, 1) " ;
}
2022-07-21 11:56:54 +08:00
return whereSql ;
}
@Override
public Map < String , Object > getUserData ( Map < String , Object > request2Map , User user ) {
2022-08-18 15:17:59 +08:00
Map < String , Object > result = new HashMap < > ( ) ;
2022-11-02 10:55:15 +08:00
boolean hasRight = HasRightUtil . hasRight ( user , USER_RIGHT , true ) ;
2022-08-18 15:17:59 +08:00
result . put ( " hasRight " , hasRight ) ;
if ( ! hasRight ) {
return result ;
}
2023-06-26 17:00:12 +08:00
String root = ( String ) request2Map . get ( " root " ) ;
String level = ( String ) request2Map . get ( " level " ) ;
2022-08-12 10:12:55 +08:00
if ( StringUtils . isBlank ( level ) ) {
2022-07-21 11:56:54 +08:00
level = " 3 " ;
}
String whereSql = userWhereSql ( request2Map ) ;
2022-07-07 10:14:25 +08:00
String whereItemSql = " " ;
2023-06-26 17:00:12 +08:00
if ( " 0 " . equals ( root ) ) {
2022-07-07 10:14:25 +08:00
whereItemSql + = " and t.ftype = 0 " ;
} else {
2022-08-12 10:12:55 +08:00
whereItemSql + = " and t.id = ' " + root + " ' " ;
2022-07-07 10:14:25 +08:00
}
// 获取根节点
RecordSet rs = new RecordSet ( ) ;
2022-11-02 20:18:55 +08:00
rs . executeQuery ( " select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst, t.fecid, t.fisvitual from jcl_org_map t " + whereSql + whereItemSql ) ;
2022-07-07 10:14:25 +08:00
List < Map < String , Object > > list = new ArrayList < > ( ) ;
String id = null ;
2022-08-12 10:12:55 +08:00
if ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
id = rs . getString ( " id " ) ;
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " fname " , rs . getString ( " fname " ) ) ;
item . put ( " ftype " , rs . getString ( " ftype " ) ) ;
item . put ( " parentId " , null ) ;
2022-11-09 18:50:39 +08:00
if ( " 0 " . equals ( id ) ) {
item . put ( " fleadername " , " " ) ;
item . put ( " fleaderimg " , " " ) ;
item . put ( " fleaderjob " , " " ) ;
item . put ( " fleader " , " " ) ;
} else {
item . put ( " fleadername " , rs . getString ( " fleadername " ) ) ;
item . put ( " fleaderimg " , rs . getString ( " fleaderimg " ) ) ;
item . put ( " fleaderjob " , rs . getString ( " fleaderjob " ) ) ;
item . put ( " fleader " , rs . getString ( " fleader " ) ) ;
}
2022-07-07 10:14:25 +08:00
item . put ( " fplan " , rs . getString ( " fplan " ) ) ;
item . put ( " fonjob " , rs . getString ( " fonjob " ) ) ;
2022-07-21 11:01:36 +08:00
item . put ( " hasChildren " , hasChildren ( rs . getString ( " id " ) , false ) ) ;
item . put ( " expand " , " 1 " ) ;
2022-07-21 11:08:08 +08:00
item . put ( " fnumber " , rs . getString ( " fnumber " ) ) ;
2022-11-02 10:55:15 +08:00
item . put ( " fobjid " , rs . getString ( " fobjid " ) ) ;
item . put ( " fleaderlv " , convertLevel ( rs . getString ( " fleaderlv " ) ) ) ;
item . put ( " fleaderst " , convertGrade ( rs . getString ( " fleaderst " ) ) ) ;
item . put ( " fecid " , rs . getString ( " fecid " ) ) ;
2022-11-02 20:18:55 +08:00
item . put ( " fisvitual " , rs . getString ( " fisvitual " ) ) ;
2022-07-07 10:14:25 +08:00
list . add ( item ) ;
}
int currentLevel = 1 ;
2022-11-02 10:55:15 +08:00
findUserItemByParantId ( id , currentLevel + 1 , level , rs , list , whereSql , currentLevel + 1 < = Integer . parseInt ( level ) ) ;
// 分部数据,构建层级关系
2022-11-08 15:21:29 +08:00
reBuildTreeList ( list , root ) ;
2022-07-07 10:14:25 +08:00
result . put ( " api_status " , true ) ;
result . put ( " data " , list ) ;
return result ;
}
2022-07-21 11:01:36 +08:00
@Override
public Map < String , Object > asyncUserData ( Map < String , Object > request2Map , User user ) {
String ids = ( String ) request2Map . get ( " ids " ) ;
2022-07-21 11:56:54 +08:00
String whereSql = userWhereSql ( request2Map ) ;
2022-07-21 11:01:36 +08:00
2022-08-12 10:12:55 +08:00
whereSql + = " and fparentid in ( " + ids + " ) " ;
2022-07-21 11:01:36 +08:00
RecordSet rs = new RecordSet ( ) ;
2022-11-02 20:18:55 +08:00
rs . executeQuery ( " select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t " + whereSql ) ;
2022-07-21 11:01:36 +08:00
List < Map < String , Object > > currentList = new ArrayList < > ( ) ;
2022-08-12 10:12:55 +08:00
while ( rs . next ( ) ) {
2022-07-21 11:01:36 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " fname " , rs . getString ( " fname " ) ) ;
item . put ( " ftype " , rs . getString ( " ftype " ) ) ;
item . put ( " parentId " , rs . getString ( " fparentid " ) ) ;
item . put ( " fplan " , rs . getString ( " fplan " ) ) ;
item . put ( " fonjob " , rs . getString ( " fonjob " ) ) ;
item . put ( " fnumber " , rs . getString ( " fnumber " ) ) ;
item . put ( " hasChildren " , hasChildren ( rs . getString ( " id " ) , false ) ) ;
2022-12-22 11:26:09 +08:00
if ( rs . getString ( " ftype " ) . equals ( " 2 " ) ) {
JclOrgMap jclOrgMap = getBmfzrInfo ( rs . getString ( " fleader " ) ) ;
item . put ( " fleader " , jclOrgMap . getFLeader ( ) = = null ? " " : String . valueOf ( jclOrgMap . getFLeader ( ) ) ) ;
item . put ( " fleaderimg " , jclOrgMap . getFLeaderImg ( ) ) ;
item . put ( " fleadername " , jclOrgMap . getFLeaderName ( ) = = null ? " " : jclOrgMap . getFLeaderName ( ) ) ;
item . put ( " fleaderjob " , jclOrgMap . getFLeaderJob ( ) ) ;
item . put ( " fleaderlv " , convertLevel ( rs . getString ( " fleaderlv " ) ) ) ;
item . put ( " fleaderst " , convertGrade ( rs . getString ( " fleaderst " ) ) ) ;
} else {
item . put ( " fleader " , rs . getString ( " fleader " ) ) ;
item . put ( " fleaderimg " , rs . getString ( " fleaderimg " ) ) ;
item . put ( " fleadername " , rs . getString ( " fleadername " ) ) ;
item . put ( " fleaderjob " , rs . getString ( " fleaderjob " ) ) ;
item . put ( " fleaderlv " , convertLevel ( rs . getString ( " fleaderlv " ) ) ) ;
item . put ( " fleaderst " , convertGrade ( rs . getString ( " fleaderst " ) ) ) ;
}
2022-11-02 10:55:15 +08:00
item . put ( " fobjid " , rs . getString ( " fobjid " ) ) ;
2022-11-02 20:18:55 +08:00
item . put ( " fisvitual " , rs . getString ( " fisvitual " ) ) ;
2022-07-21 11:01:36 +08:00
currentList . add ( item ) ;
}
Map < String , Object > result = new HashMap < > ( ) ;
result . put ( " api_status " , true ) ;
result . put ( " data " , currentList ) ;
return result ;
}
@Override
public Map < String , Object > asyncCompanyData ( Map < String , Object > request2Map , User user ) {
String ids = ( String ) request2Map . get ( " ids " ) ;
2022-07-21 11:56:54 +08:00
String whereSql = companyDateWhereSql ( request2Map ) ;
2022-07-21 11:01:36 +08:00
2022-08-12 10:12:55 +08:00
whereSql + = " and fparentid in ( " + ids + " ) " ;
2022-07-21 11:01:36 +08:00
RecordSet rs = new RecordSet ( ) ;
2022-11-02 20:18:55 +08:00
rs . executeQuery ( " select id, fname, ftype, fparentid, fnumber,fobjid,fisvitual from jcl_org_map " + whereSql ) ;
2022-07-21 11:01:36 +08:00
List < Map < String , Object > > currentList = new ArrayList < > ( ) ;
2022-08-12 10:12:55 +08:00
while ( rs . next ( ) ) {
2022-07-21 11:01:36 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " fname " , rs . getString ( " fname " ) ) ;
item . put ( " ftype " , rs . getString ( " ftype " ) ) ;
item . put ( " parentId " , rs . getString ( " fparentid " ) ) ;
2022-07-21 11:08:08 +08:00
item . put ( " fnumber " , rs . getString ( " fnumber " ) ) ;
2022-10-18 12:17:11 +08:00
item . put ( " fobjid " , rs . getString ( " fobjid " ) ) ;
2022-11-02 20:18:55 +08:00
item . put ( " fisvitual " , rs . getString ( " fisvitual " ) ) ;
2022-07-21 11:01:36 +08:00
item . put ( " hasChildren " , hasChildren ( rs . getString ( " id " ) , true ) ) ;
currentList . add ( item ) ;
}
Map < String , Object > result = new HashMap < > ( ) ;
result . put ( " api_status " , true ) ;
result . put ( " data " , currentList ) ;
return result ;
}
2022-12-21 14:53:56 +08:00
2022-12-21 10:58:49 +08:00
//处理多个部门负责人
2022-12-21 14:53:56 +08:00
private JclOrgMap getBmfzrInfo ( String bmfzr ) {
JclOrgMap jclOrgMap = new JclOrgMap ( ) ;
if ( StringUtils . isNotBlank ( bmfzr ) ) {
String [ ] split = bmfzr . split ( " , " ) ;
for ( String s : split ) {
2023-05-16 16:42:28 +08:00
jclOrgMap = MapperProxyFactory . getProxy ( JclOrgMapper . class ) . getResInfo ( level , grade , s ) ;
2022-12-21 14:53:56 +08:00
break ;
}
}
return jclOrgMap ;
2022-12-21 10:58:49 +08:00
}
2022-07-21 11:01:36 +08:00
private void findUserItemByParantId ( String id , int currentLevel , String level , RecordSet rs , List < Map < String , Object > > list , String whereSql , boolean expand ) {
2022-11-02 20:18:55 +08:00
String sql = " select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql ;
2022-12-13 10:42:35 +08:00
DetachUtil detachUtil = new DetachUtil ( user ) ;
2022-11-03 11:06:36 +08:00
if ( detachUtil . isDETACH ( ) ) {
if ( " 0 " . equals ( id ) ) {
sql + = " and t.ftype = 1 and t.fobjid in( " + detachUtil . getJclRoleLevels ( ) + " ) " ;
} else {
sql + = " and t.fparentid = " + id + " and t.ftype !=1 " ;
}
2022-11-02 10:55:15 +08:00
} else {
sql + = " and t.fparentid = " + id ;
}
rs . executeQuery ( sql ) ;
2022-07-07 10:14:25 +08:00
List < Map < String , Object > > currentList = new ArrayList < > ( ) ;
2022-08-12 10:12:55 +08:00
while ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
Map < String , Object > item = new HashMap < > ( ) ;
item . put ( " id " , rs . getString ( " id " ) ) ;
item . put ( " fname " , rs . getString ( " fname " ) ) ;
item . put ( " ftype " , rs . getString ( " ftype " ) ) ;
item . put ( " parentId " , rs . getString ( " fparentid " ) ) ;
2022-10-18 12:17:11 +08:00
item . put ( " fobjparentId " , rs . getString ( " fobjparentid " ) ) ;
2022-07-07 10:14:25 +08:00
item . put ( " fplan " , rs . getString ( " fplan " ) ) ;
item . put ( " fonjob " , rs . getString ( " fonjob " ) ) ;
item . put ( " fnumber " , rs . getString ( " fnumber " ) ) ;
2022-07-21 11:01:36 +08:00
item . put ( " expand " , expand ? " 1 " : " 0 " ) ;
2022-08-30 11:40:30 +08:00
item . put ( " fobjid " , rs . getString ( " fobjid " ) ) ;
item . put ( " fecid " , rs . getString ( " fecid " ) ) ;
2022-12-22 11:26:09 +08:00
if ( rs . getString ( " ftype " ) . equals ( " 2 " ) ) {
JclOrgMap jclOrgMap = getBmfzrInfo ( rs . getString ( " fleader " ) ) ;
item . put ( " fleader " , jclOrgMap . getFLeader ( ) = = null ? " " : String . valueOf ( jclOrgMap . getFLeader ( ) ) ) ;
item . put ( " fleaderimg " , jclOrgMap . getFLeaderImg ( ) ) ;
item . put ( " fleadername " , jclOrgMap . getFLeaderName ( ) = = null ? " " : jclOrgMap . getFLeaderName ( ) ) ;
item . put ( " fleaderjob " , jclOrgMap . getFLeaderJob ( ) ) ;
item . put ( " fleaderlv " , convertLevel ( rs . getString ( " fleaderlv " ) ) ) ;
item . put ( " fleaderst " , convertGrade ( rs . getString ( " fleaderst " ) ) ) ;
} else {
item . put ( " fleader " , rs . getString ( " fleader " ) ) ;
item . put ( " fleaderimg " , rs . getString ( " fleaderimg " ) ) ;
item . put ( " fleadername " , rs . getString ( " fleadername " ) ) ;
item . put ( " fleaderjob " , rs . getString ( " fleaderjob " ) ) ;
item . put ( " fleaderlv " , convertLevel ( rs . getString ( " fleaderlv " ) ) ) ;
item . put ( " fleaderst " , convertGrade ( rs . getString ( " fleaderst " ) ) ) ;
}
2022-11-02 20:18:55 +08:00
item . put ( " fisvitual " , rs . getString ( " fisvitual " ) ) ;
2022-07-21 11:01:36 +08:00
item . put ( " hasChildren " , hasChildren ( rs . getString ( " id " ) , false ) ) ;
2022-07-07 10:14:25 +08:00
currentList . add ( item ) ;
}
for ( Map < String , Object > stringObjectMap : currentList ) {
2022-08-12 10:12:55 +08:00
if ( " 4 " . equals ( stringObjectMap . get ( " ftype " ) ) ) { // 员工信息
2022-07-07 10:14:25 +08:00
rs . executeQuery ( " select id, mobile, homeaddress from hrmresource where id = ? " , stringObjectMap . get ( " fnumber " ) ) ;
2022-08-12 10:12:55 +08:00
if ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
stringObjectMap . put ( " mobile " , rs . getString ( " mobile " ) ) ;
stringObjectMap . put ( " address " , rs . getString ( " homeaddress " ) ) ;
}
rs . executeQuery ( " select departmentname from hrmresource hrm \ n " +
" left join hrmdepartment d \ n " +
" on hrm.departmentid = d.id \ n " +
" where hrm.id = ? " , stringObjectMap . get ( " fnumber " ) ) ;
2022-08-12 10:12:55 +08:00
if ( rs . next ( ) ) {
2022-07-07 10:14:25 +08:00
stringObjectMap . put ( " department " , rs . getString ( " departmentname " ) ) ;
}
}
2022-08-12 10:12:55 +08:00
if ( currentLevel + 1 < = Integer . parseInt ( level ) ) {
2022-07-21 11:01:36 +08:00
findUserItemByParantId ( ( String ) stringObjectMap . get ( " id " ) , currentLevel + 1 , level , rs , list , whereSql , true ) ;
2022-08-12 10:12:55 +08:00
} else if ( currentLevel = = Integer . parseInt ( level ) ) { // 多查一层
2022-07-21 11:01:36 +08:00
findUserItemByParantId ( ( String ) stringObjectMap . get ( " id " ) , currentLevel + 1 , level , rs , list , whereSql , false ) ;
2022-07-07 10:14:25 +08:00
}
}
list . addAll ( currentList ) ;
2022-07-21 11:01:36 +08:00
}
2022-07-07 10:14:25 +08:00
2022-07-21 11:01:36 +08:00
private boolean hasChildren ( String id , boolean isCompany ) {
String whereSql = " where fparentid = " + id + " " ;
2022-08-12 10:12:55 +08:00
if ( isCompany ) {
2022-07-21 11:01:36 +08:00
whereSql + = " and ftype in (0, 1, 2) " ;
}
grs . executeQuery ( " select count(1) as count from jcl_org_map " + whereSql ) ;
String count = " 0 " ;
2022-08-12 10:12:55 +08:00
if ( grs . next ( ) ) {
2022-07-21 11:01:36 +08:00
count = grs . getString ( " count " ) ;
}
return ! " 0 " . equals ( count ) ;
2022-07-07 10:14:25 +08:00
}
2022-10-21 09:28:33 +08:00
private String convertLevel ( String fLeaderLv ) {
2022-11-02 10:55:15 +08:00
StringBuilder jobLevelName = new StringBuilder ( ) ;
2022-10-26 20:12:14 +08:00
if ( StringUtils . isNotBlank ( fLeaderLv ) ) {
2022-10-21 09:28:33 +08:00
try {
2022-11-02 10:55:15 +08:00
String [ ] split = fLeaderLv . split ( " , " ) ;
for ( String s : split ) {
long parseLong = Long . parseLong ( s ) ;
LevelPO levelByID = MapperProxyFactory . getProxy ( LevelMapper . class ) . getLevelByID ( parseLong ) ;
if ( null ! = levelByID ) {
jobLevelName . append ( levelByID . getLevelName ( ) ) ;
}
2022-10-21 09:28:33 +08:00
}
} catch ( NumberFormatException exception ) {
2022-11-02 10:55:15 +08:00
jobLevelName = new StringBuilder ( fLeaderLv ) ;
2022-10-21 09:28:33 +08:00
}
}
2022-11-02 10:55:15 +08:00
return jobLevelName . toString ( ) ;
2022-10-21 09:28:33 +08:00
}
private String convertGrade ( String fLeaderSt ) {
2022-11-02 10:55:15 +08:00
StringBuilder jobGradeName = new StringBuilder ( ) ;
2022-10-26 20:12:14 +08:00
if ( StringUtils . isNotBlank ( fLeaderSt ) ) {
2022-10-21 09:28:33 +08:00
try {
2022-11-02 10:55:15 +08:00
String [ ] split = fLeaderSt . split ( " , " ) ;
for ( String s : split ) {
long parseLong = Long . parseLong ( s ) ;
GradePO gradeByID = MapperProxyFactory . getProxy ( GradeMapper . class ) . getGradeByID ( parseLong ) ;
if ( null ! = gradeByID ) {
jobGradeName . append ( gradeByID . getGradeName ( ) ) ;
}
2022-10-21 09:28:33 +08:00
}
} catch ( NumberFormatException exception ) {
2022-11-02 10:55:15 +08:00
jobGradeName = new StringBuilder ( fLeaderSt ) ;
2022-10-21 09:28:33 +08:00
}
}
2022-11-02 10:55:15 +08:00
return jobGradeName . toString ( ) ;
}
2022-11-08 15:21:29 +08:00
private void reBuildTreeList ( List < Map < String , Object > > list , String root ) {
2022-11-02 10:55:15 +08:00
// 分部数据,构建层级关系
Set < String > idSet = list . stream ( ) . filter ( item - > " 1 " . equals ( Util . null2String ( item . get ( " ftype " ) ) ) ) . map ( item - > Util . null2String ( item . get ( " id " ) ) ) . collect ( Collectors . toSet ( ) ) ;
list . forEach ( item - > {
2022-11-08 15:21:29 +08:00
if ( ! root . equals ( Util . null2String ( item . get ( " id " ) ) ) & & " 1 " . equals ( Util . null2String ( item . get ( " ftype " ) ) ) & & ! idSet . contains ( Util . null2String ( item . get ( " parentId " ) ) ) ) {
item . put ( " parentId " , root ) ;
item . put ( " fobjparentId " , root ) ;
2022-11-02 10:55:15 +08:00
}
} ) ;
2022-10-21 09:28:33 +08:00
}
2022-11-09 18:50:39 +08:00
2022-12-16 14:25:30 +08:00
private JclOrgMapper getJclOrgMapMapper ( ) {
return MapperProxyFactory . getProxy ( JclOrgMapper . class ) ;
}
2023-05-16 16:42:28 +08:00
2022-12-16 14:25:30 +08:00
@Override
2022-12-16 15:58:20 +08:00
public String synchronousData ( Map < String , Object > request2Map , User user ) {
2022-12-16 14:25:30 +08:00
String currentDate = OrganizationDateUtil . getFormatLocalDate ( new java . util . Date ( ) ) ;
java . sql . Date date = new java . sql . Date ( OrganizationDateUtil . stringToDate ( currentDate ) . getTime ( ) ) ;
Calendar cal = Calendar . getInstance ( ) ;
cal . setTime ( date ) ;
Calendar calendar = weaver . common . DateUtil . addDay ( cal , - 1 ) ;
java . sql . Date time = new java . sql . Date ( calendar . getTime ( ) . getTime ( ) ) ;
// 自下向上刷新
getJclOrgMapMapper ( ) . deleteAllMap ( date ) ;
2023-05-16 16:42:28 +08:00
getJclOrgMapMapper ( ) . updateAllMap ( date , time ) ;
2022-12-16 14:25:30 +08:00
//同步人员信息
2023-05-16 16:42:28 +08:00
getJclOrgMapMapper ( ) . insertResToMap ( level , grade ) ;
2022-12-16 14:25:30 +08:00
//同步岗位信息
2022-12-16 15:58:20 +08:00
getJclOrgMapMapper ( ) . insertJobToMap ( ) ;
//同步部门信息
2023-05-16 16:42:28 +08:00
getJclOrgMapMapper ( ) . insertDeptToMap ( level , grade ) ;
2022-12-16 15:58:20 +08:00
//同步分部信息
getJclOrgMapMapper ( ) . insertSubComToMap ( ) ;
//同步集团信息
getJclOrgMapMapper ( ) . insertComToMap ( ) ;
2022-12-21 13:40:19 +08:00
//清除部门合并、转移造成的脏数据
2022-12-21 15:45:49 +08:00
getJclOrgMapMapper ( ) . deleteJobNull ( date ) ;
2022-12-16 15:58:20 +08:00
//刷新在岗数、编制数(从岗位向上刷,岗位不需处理)
2023-05-16 16:42:28 +08:00
List < JclOrgMap > jclOrgMaps = getJclOrgMapMapper ( ) . getJclOrgMapByType ( " 3 " , date ) ;
for ( JclOrgMap jclOrgMap : jclOrgMaps ) {
2022-12-16 15:58:20 +08:00
int id = jclOrgMap . getId ( ) ;
2023-05-16 16:42:28 +08:00
countJobAndPlans ( " 3 " , id , currentDate ) ;
2022-12-16 15:58:20 +08:00
}
return " 同步成功 " ;
2022-12-16 14:25:30 +08:00
}
2023-05-16 16:42:28 +08:00
2023-06-28 17:58:12 +08:00
@Override
public void insertChartVersion ( Integer fclass , String description ) {
RecordSet rs = new RecordSet ( ) ;
String recordDate = OrganizationDateUtil . getFormatLocalDateTime ( LocalDateTime . now ( ) ) ;
String createDate = OrganizationDateUtil . getFormatLocalDate ( LocalDate . now ( ) ) ;
rs . executeQuery ( " select id from JCL_ORG_CHARTVERSION where fclass = ? and createdate = ? " , fclass , createDate ) ;
rs . next ( ) ;
String id = Util . null2String ( rs . getString ( " id " ) ) ;
if ( StringUtils . isNotEmpty ( id ) ) {
rs . executeUpdate ( " update JCL_ORG_CHARTVERSION set recorddate = ?,description = ?,creator = ? where fclass = ? and createdate = ? " , recordDate , description , user . getUID ( ) , fclass , createDate ) ;
} else {
rs . executeUpdate ( " insert into JCL_ORG_CHARTVERSION (recorddate,description,creator,deletetype,createdate,fclass) values(?,?,?,?,?,?) " , recordDate , description , user . getUID ( ) , 0 , createDate , fclass ) ;
}
}
2023-06-29 17:37:05 +08:00
@Override
public Map < String , Object > searchTimeLines ( Map < String , Object > params ) {
Map < String , Object > datas = new HashMap < > ( ) ;
RecordSet rs = new RecordSet ( ) ;
String fclass = Util . null2String ( params . get ( " fclass " ) ) ;
List < TimeLinesBO > timeLinesBOList = new ArrayList < > ( ) ;
timeLinesBOList . add ( TimeLinesBO . builder ( ) . key ( 0 ) . id ( 0 ) . title ( " 当前版本 " ) . color ( " blue " ) . time ( " " ) . build ( ) ) ;
rs . executeQuery ( " SELECT id,recorddate,description from JCL_ORG_CHARTVERSION where fclass = ? and deletetype = ? " , fclass , 0 ) ;
while ( rs . next ( ) ) {
timeLinesBOList . add ( TimeLinesBO . builder ( )
. key ( rs . getInt ( " id " ) )
. id ( rs . getInt ( " id " ) )
. title ( Util . null2String ( rs . getString ( " description " ) ) )
. color ( " grey " )
. time ( Util . null2String ( rs . getString ( " recorddate " ) ) )
. build ( ) ) ;
}
datas . put ( " timelineList " , timeLinesBOList ) ;
return datas ;
}
2022-12-16 15:58:20 +08:00
/ * *
* 刷新在岗 、 编制数
* /
2023-05-16 16:42:28 +08:00
void countJobAndPlans ( String type , int id , String currentDate ) {
2022-12-16 15:58:20 +08:00
java . sql . Date date = new java . sql . Date ( OrganizationDateUtil . stringToDate ( currentDate ) . getTime ( ) ) ;
RecordSet rs = new RecordSet ( ) ;
//处理上级
2022-12-19 08:44:37 +08:00
String sql = " select fparentid from jcl_org_map where ftype= " + type + " and id= " + id + " " ;
String whereSql = " " ;
if ( DBType . isOracle ( ) ) {
whereSql + = " and ((fdatebegin <= to_date(' " + currentDate + " ','yyyy-MM-DD') and fdateend >= to_date(' " + currentDate + " ','yyyy-MM-DD')) or (fdatebegin <= to_date(' " + currentDate + " ','yyyy-MM-DD') and fdateend is null )) " ;
} else {
whereSql + = " and ((fdatebegin <= ' " + currentDate + " ' and fdateend >= ' " + currentDate + " ') or (fdatebegin <= ' " + currentDate + " ' and fdateend is null )) " ;
}
rs . executeQuery ( sql + whereSql ) ;
2022-12-16 15:58:20 +08:00
String fparentid = null ;
String ftype = null ;
if ( rs . next ( ) ) {
fparentid = rs . getString ( " fparentid " ) ;
2022-12-20 09:02:51 +08:00
String typeSql = " select ftype from jcl_org_map where id= " + fparentid + whereSql ;
2022-12-19 08:44:37 +08:00
rs . executeQuery ( typeSql + whereSql ) ;
2022-12-16 15:58:20 +08:00
if ( rs . next ( ) ) {
ftype = rs . getString ( " ftype " ) ;
}
}
JclOrgMap jclOrgMap = getJclOrgMapMapper ( ) . getSumPlanAndJobByFParentId ( date , fparentid ) ;
2022-12-20 15:36:39 +08:00
if ( fparentid ! = null ) {
getJclOrgMapMapper ( ) . updateMapById ( Integer . parseInt ( fparentid ) , jclOrgMap . getFPlan ( ) , jclOrgMap . getFOnJob ( ) , date ) ;
if ( ! " -1 " . equals ( fparentid ) ) {
countJobAndPlans ( ftype , Integer . parseInt ( fparentid ) , String . valueOf ( currentDate ) ) ;
}
2022-12-16 15:58:20 +08:00
}
2022-12-20 15:36:39 +08:00
}
2023-05-16 16:42:28 +08:00
2022-12-20 15:36:39 +08:00
private String getFieldName ( String fieldabel ) {
RecordSet recordSet = new RecordSet ( ) ;
String fieldname = null ;
2023-05-16 16:42:28 +08:00
recordSet . executeQuery ( " select fieldname from jcl_org_field where fieldlabel=' " + fieldabel + " ' " ) ;
2022-12-20 15:36:39 +08:00
if ( recordSet . next ( ) ) {
fieldname = recordSet . getString ( " fieldname " ) ;
}
return fieldname ;
2022-12-16 15:58:20 +08:00
}
2023-05-16 16:42:28 +08:00
2022-11-09 18:50:39 +08:00
static class OrgSelectItem {
2023-06-26 17:00:12 +08:00
private Integer key ;
2022-11-09 18:50:39 +08:00
private String id ;
private String fnumber ;
private String fname ;
2023-06-26 17:00:12 +08:00
public Integer getKey ( ) {
return key ;
}
public void setKey ( Integer key ) {
this . key = key ;
}
2022-11-09 18:50:39 +08:00
public String getId ( ) {
return id ;
}
public void setId ( String id ) {
this . id = id ;
}
public String getFnumber ( ) {
return fnumber ;
}
public void setFnumber ( String fnumber ) {
this . fnumber = fnumber ;
}
public String getFname ( ) {
return fname ;
}
public void setFname ( String fname ) {
this . fname = fname ;
}
@Override
public boolean equals ( Object obj ) {
if ( obj instanceof OrgSelectItem ) {
OrgSelectItem item = ( OrgSelectItem ) obj ;
return this . getId ( ) . equals ( item . getId ( ) ) ;
}
return false ;
}
@Override
public int hashCode ( ) {
return Integer . parseInt ( this . getId ( ) ) ;
}
}
2022-07-07 10:14:25 +08:00
}