@ -1,7 +1,9 @@
package com.weaver.seconddev.jcl.organization.service.impl ;
import com.alibaba.nacos.common.utils.CollectionUtils ;
import com.weaver.ebuilder.datasource.api.conn.RecordDataSource ;
import com.google.common.collect.Lists ;
import com.weaver.common.form.metadata.ModuleSource ;
import com.weaver.common.form.param.FieldManageParam ;
import com.weaver.ebuilder.datasource.api.conn.WeaverConnection ;
import com.weaver.ebuilder.form.client.entity.field.FieldsQueryDto ;
import com.weaver.ebuilder.form.client.entity.field.ModuleField ;
@ -9,7 +11,11 @@ import com.weaver.ebuilder.form.client.service.emobile.IEtFormDatasetService;
import com.weaver.ebuilder.teams.etform.org.bean.EBSimpleEmployee ;
import com.weaver.seconddev.jcl.organization.controller.EmployeeRelationController ;
import com.weaver.seconddev.jcl.organization.service.EmployeeRelationService ;
import com.weaver.seconddev.jcl.organization.util.CommonUtils ;
import com.weaver.seconddev.jcl.organization.util.Constants ;
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils ;
import com.weaver.teams.domain.user.SimpleEmployee ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.lang3.StringUtils ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
@ -17,10 +23,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service ;
import java.sql.CallableStatement ;
import java.sql.SQLException ;
import java.sql.Types ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
import java.util.stream.Collectors ;
@Service
public class EmployeeRelationServiceImpl implements EmployeeRelationService {
@ -31,6 +38,8 @@ public class EmployeeRelationServiceImpl implements EmployeeRelationService {
private DatabaseUtils databaseUtils ;
@Autowired
private IEtFormDatasetService etFormDataSetService ;
@Autowired
private EmployeeInformationServiceImpl employeeInformationService ;
@Override
@ -51,7 +60,7 @@ public class EmployeeRelationServiceImpl implements EmployeeRelationService {
// }
// }
// }
String sql = "select id from uf_jcl_employee_information where id_no ='" + identity + "' and IS_DELETE = 0 and delete_type = 0 and TENANT_KEY = 't7n9jpeaoa' and sfjrhmd = 1 ";
String sql = "select id from uf_jcl_employee_information where id_no ='" + identity + "' and IS_DELETE = 0 and delete_type = 0 and sfjrhmd = 1 ";
Map < String , Object > rs = databaseUtils . execute ( "LOGIC" , "weaver-ebuilder-form-service" , sql ) ;
List < Map < String , Object > > recordList = databaseUtils . getDataSourceList ( rs ) ;
log . error ( "queryLeaderPdByYear.recordList:{}" , recordList ) ;
@ -133,7 +142,7 @@ public class EmployeeRelationServiceImpl implements EmployeeRelationService {
if ( StringUtils . isBlank ( identity ) & & StringUtils . isBlank ( mobile ) & & StringUtils . isBlank ( email ) ) {
flag = false ;
} else {
String sql = "select id from uf_jcl_rzgl where IS_DELETE = 0 and delete_type = 0 and TENANT_KEY = 't7n9jpeaoa' and (";
String sql = "select id from uf_jcl_rzgl where IS_DELETE = 0 and delete_type = 0 and (";
if ( StringUtils . isNotBlank ( identity ) ) {
sql + = " sfz_1mhf = '" + identity + "' or" ;
log . error ( "queryIsNotHaveScanTheCodeInfo.identity:{}" , sql ) ;
@ -157,6 +166,78 @@ public class EmployeeRelationServiceImpl implements EmployeeRelationService {
return flag ;
}
@Override
public Map < String , Object > getEmployeeColumns ( ) {
Map < String , Object > result = new HashMap < > ( ) ;
String sql = "select form_id from form_table where table_name=? and delete_type='0'" ;
List < String > paramList = Lists . newArrayList ( ) ;
paramList . add ( Constants . EMPLOYEE_INFORMATION ) ;
String employee_form_id = CommonUtils . null2String ( databaseUtils . getSqlList ( sql , paramList ) . get ( 0 ) . get ( "form_id" ) ) ;
log . error ( "employee_form_id : [{}]" , employee_form_id ) ;
sql = "select id,module from FORM where module='hrm' and ownership='personal'" ;
Map < String , Object > rs = databaseUtils . execute ( "LOGIC" , "weaver-ebuilder-form-service" , sql ) ;
List < Map < String , Object > > personFormList = databaseUtils . getDataSourceList ( rs ) ;
log . error ( "getEmployeeColumns.personFormList:{}" , personFormList ) ;
//基本信息自定义字段表
String personCustomfieldFormid = ( String ) personFormList . get ( 0 ) . get ( "hrm" ) ;
log . error ( "getEmployeeColumns.personCustomfieldFormid:{}" , personCustomfieldFormid ) ;
List < String > formIdParamList = Lists . newArrayList ( ) ;
formIdParamList . add ( employee_form_id ) ;
sql = "select id,group_name from form_field_group where form_id='" + employee_form_id + "' and delete_type='0'" ;
Map < String , Object > rs2 = databaseUtils . execute ( "LOGIC" , "weaver-ebuilder-form-service" , sql ) ;
List < Map < String , Object > > fieldGroupList = databaseUtils . getDataSourceList ( rs2 ) ;
log . error ( "getEmployeeColumns.fieldGroupList:{}" , fieldGroupList ) ;
Map < String , String > fieldGroup = fieldGroupList . stream ( ) . collect ( Collectors . toMap ( e - > e . get ( "group_name" ) . toString ( ) , e - > e . get ( "id" ) . toString ( ) ) ) ;
formIdParamList . add ( personCustomfieldFormid ) ;
/ * *
* 员 工 信 息 表 所 有 字 段
* /
log . error ( "employeeInformationService : [{}]" , employeeInformationService ) ;
FieldManageParam ownEntity = getFieldManageParam ( employee_form_id , ModuleSource . ebuilderform ) ;
List < Map < Object , Object > > employeeFieldList = employeeInformationService . getFieldList ( ownEntity , new SimpleEmployee ( ) ) ;
log . error ( "employeeFieldList : [{}]" , employeeFieldList ) ;
//员工信息主表-基本信息字段
List < Map < Object , Object > > mainFormBasicFieldList = employeeFieldList . stream ( ) . filter ( e - > fieldGroup . get ( Constants . BASIC_INFORMATION ) . equals ( e . get ( "groupId" ) ) & & "" . equals ( CommonUtils . null2String ( e . get ( "subFormId" ) ) ) ) . collect ( Collectors . toList ( ) ) ;
//员工信息主表-账户信息字段
List < Map < Object , Object > > mainFormAccountFieldList = employeeFieldList . stream ( ) . filter ( e - > fieldGroup . get ( Constants . ACCOUNT_INFORMATION ) . equals ( e . get ( "groupId" ) ) & & "" . equals ( CommonUtils . null2String ( e . get ( "subFormId" ) ) ) ) . collect ( Collectors . toList ( ) ) ;
//员工信息主表-个人信息字段
List < Map < Object , Object > > mainFormPersonFieldList = employeeFieldList . stream ( ) . filter ( e - > fieldGroup . get ( Constants . PERSONAL_INFORMATION ) . equals ( e . get ( "groupId" ) ) & & "" . equals ( CommonUtils . null2String ( e . get ( "subFormId" ) ) ) ) . collect ( Collectors . toList ( ) ) ;
log . error ( "mainFormBasicFieldList : [{}]" , mainFormBasicFieldList ) ;
/ * *
* 人 力 资 源 - 基 本 信 息 自 定 义 字 段
* /
FieldManageParam personCustomEntity = getFieldManageParam ( personCustomfieldFormid , ModuleSource . hrm ) ;
log . error ( "personCustomEntity : [{}]" , personCustomEntity ) ;
List < Map < Object , Object > > personCustomFieldList = employeeInformationService . getFieldList ( personCustomEntity , new SimpleEmployee ( ) ) ;
List < Map < Object , Object > > customFieldList = personCustomFieldList . stream ( ) . filter ( e - > ! e . get ( "componentKey" ) . equals ( "BaseField" ) ) . collect ( Collectors . toList ( ) ) ;
result . put ( "fieldGroupList" , fieldGroupList ) ;
result . put ( "formIdParamList" , formIdParamList ) ;
result . put ( "mainFormBasicFieldList" , mainFormBasicFieldList ) ;
result . put ( "mainFormAccountFieldList" , mainFormAccountFieldList ) ;
result . put ( "mainFormPersonFieldList" , mainFormPersonFieldList ) ;
result . put ( "personCustomFieldList" , personCustomFieldList ) ;
result . put ( "customFieldList" , customFieldList ) ;
log . error ( "result : [{}]" , result ) ;
return result ;
}
private FieldManageParam getFieldManageParam ( String formid , ModuleSource moduleSource ) {
FieldManageParam entity = new FieldManageParam ( ) ;
entity . setFormId ( Long . valueOf ( formid ) ) ;
entity . setModule ( moduleSource ) ;
entity . setNeedDataCount ( true ) ;
entity . setNeedPanelField ( true ) ;
return entity ;
}
private void GetTableAlterStatements ( ) {
//1.获取连接池实例