diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java index f57ec3e..98632af 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java @@ -187,4 +187,28 @@ public class EmployeeRelationController { return actionMap; } + + /** + * 员工管理-获取员工信息表和系统表字段 + * @return + */ + @GetMapping("/getEmployeeColumns") + @WeaPermission(publicPermission = true) + public Map getEmployeeColumns(){ + Map actionMap = new HashMap<>(); + // 根据表名查询所有字段 + Map mapList = employeeRelationService.getEmployeeColumns(); + if(mapList.size()>0){ + log.error("getTableColumns.mapList:{}", mapList); + actionMap.put("code","200"); + actionMap.put("msg","接口调用成功!"); + }else{ + actionMap.put("code","201"); + actionMap.put("msg","返回数据为空!"); + } + actionMap.put("mapList",mapList); + log.error("getTableColumns.actionMap:{}", actionMap); + return actionMap; + } + } \ No newline at end of file diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynAllEmployeeInfoAction.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynAllEmployeeInfoAction.java index 0afb29a..b6b61ae 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynAllEmployeeInfoAction.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynAllEmployeeInfoAction.java @@ -41,7 +41,7 @@ public class SynAllEmployeeInfoAction implements EsbServerlessRpcRemoteInterface } public List> queryEmployeesInfo() { - String sql=" SELECT id,birthDate,first_work_date,hiredate,age,work_year,sl from uf_jcl_employee_information where delete_type=0 and TENANT_KEY='t7n9jpeaoa' " ; + String sql=" SELECT id,birthDate,first_work_date,hiredate,age,work_year,sl from uf_jcl_employee_information where delete_type=0 " ; log.error("queryEmployeesInfo.sql:{}",sql); Map rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); List> recordList = databaseUtils.getDataSourceList(rs); @@ -90,7 +90,7 @@ public class SynAllEmployeeInfoAction implements EsbServerlessRpcRemoteInterface String firstWorkDateString = (String) objectMap.get("work_year"); String joinDateString = (String) objectMap.get("sl"); String sql = "update uf_jcl_employee_information set age = '" + birthDateString + "',work_year = '" + firstWorkDateString + "',sl = '" + joinDateString + "'" + - " where id = '" + id + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where id = '" + id + "' and delete_type=0 "; log.error("updateEmployeesInfo.sql:{}", sql); rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); log.error("updateEmployeesInfo.rs:{}", rs); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynEmployeeAgeGlSlInfoAction.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynEmployeeAgeGlSlInfoAction.java index d15ca78..fc2a654 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynEmployeeAgeGlSlInfoAction.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynEmployeeAgeGlSlInfoAction.java @@ -38,7 +38,7 @@ public class SynEmployeeAgeGlSlInfoAction implements EsbServerlessRpcRemoteInter } public List> queryEmployeesInfo() { - String sql=" SELECT id,birthDate,first_work_date,hiredate,age,work_year,sl from uf_jcl_employee_information where delete_type=0 and TENANT_KEY='t7n9jpeaoa' " ; + String sql=" SELECT id,birthDate,first_work_date,hiredate,age,work_year,sl from uf_jcl_employee_information where delete_type=0 " ; log.error("queryEmployeesInfo.sql:{}",sql); Map rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); List> recordList = databaseUtils.getDataSourceList(rs); @@ -87,7 +87,7 @@ public class SynEmployeeAgeGlSlInfoAction implements EsbServerlessRpcRemoteInter String firstWorkDateString = (String) objectMap.get("work_year"); String joinDateString = (String) objectMap.get("sl"); String sql = "update uf_jcl_employee_information set age = '" + birthDateString + "',work_year = '" + firstWorkDateString + "',sl = '" + joinDateString + "'" + - " where id = '" + id + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where id = '" + id + "' and delete_type=0 "; log.error("updateEmployeesInfo.sql:{}", sql); rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); log.error("updateEmployeesInfo.rs:{}", rs); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateFileYgddInfoAction.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateFileYgddInfoAction.java index c31ac54..d80b352 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateFileYgddInfoAction.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateFileYgddInfoAction.java @@ -38,7 +38,7 @@ public class UpdateFileYgddInfoAction implements EsbServerlessRpcRemoteInterface } public List> queryYgddInfo(String requestId) { - String sql=" SELECT * from uf_jcl_rydd where id = '" + requestId + "' and delete_type=0 and TENANT_KEY='t7n9jpeaoa' " ; + String sql=" SELECT * from uf_jcl_rydd where id = '" + requestId + "' and delete_type=0 " ; log.error("queryYgddInfo222.sql:{}",sql); Map rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); List> recordList = databaseUtils.getDataSourceList(rs); @@ -60,7 +60,7 @@ public class UpdateFileYgddInfoAction implements EsbServerlessRpcRemoteInterface if (isTodayOrBefore(ddsxrq)) { //更新数据到员工基础信息表 String sql = "update eteams.employee set department = '" + ddhbm + "',POSITION = '" + ddhgw + "',SUPERIOR = '" + ddhzjsj + "'" + - " where id = '" + ddr + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where id = '" + ddr + "' and delete_type=0 "; log.error("UpdateYgddInfoAction222.sql:{}", sql); rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); log.error("UpdateYgddInfoAction222.rs:{}", rs); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateGlzzygidAction.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateGlzzygidAction.java index 5cbcd6c..d7229e4 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateGlzzygidAction.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateGlzzygidAction.java @@ -44,12 +44,12 @@ public class UpdateGlzzygidAction implements EsbServerlessRpcRemoteInterface { String str = ""; int flag = 0; if(StringUtils.isNotBlank(sfzhm)){ - sql=" SELECT user from hr_userinfo where delete_type=0 and TENANT_KEY='t7n9jpeaoa' and ID_NO = '" + sfzhm + "'" ; + sql=" SELECT user from hr_userinfo where delete_type=0 and ID_NO = '" + sfzhm + "'" ; }else if(StringUtils.isNotBlank(sjh)){ - sql=" select id from eteams.employee where delete_type=0 and TENANT_KEY='t7n9jpeaoa' and mobile = '" + sjh + "'" ; + sql=" select id from eteams.employee where delete_type=0 and mobile = '" + sjh + "'" ; flag = 1; }else if(StringUtils.isNotBlank(yx)){ - sql=" select id from eteams.employee where delete_type=0 and TENANT_KEY='t7n9jpeaoa' and email = '" + yx + "'" ; + sql=" select id from eteams.employee where delete_type=0 and email = '" + yx + "'" ; flag = 2; }else{ return rs; @@ -70,13 +70,13 @@ public class UpdateGlzzygidAction implements EsbServerlessRpcRemoteInterface { //更新员工信息表 if(flag==0){ str = "update uf_jcl_employee_information set glzzyg = '" + userId + "'" + - " where id_no = '" + sfzhm + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where id_no = '" + sfzhm + "' and delete_type=0 "; }else if(flag==1) { str = "update uf_jcl_employee_information set glzzyg = '" + userId + "'" + - " where mobile = '" + sjh + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where mobile = '" + sjh + "' and delete_type=0 "; }else { str = "update uf_jcl_employee_information set glzzyg = '" + userId + "'" + - " where email = '" + yx + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where email = '" + yx + "' and delete_type=0 "; } log.error("queryEmployeeInfoBySfz.sql:{}",str); rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", str); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateYgddInfoAction.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateYgddInfoAction.java index 6679033..6c837c6 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateYgddInfoAction.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/UpdateYgddInfoAction.java @@ -37,7 +37,7 @@ public class UpdateYgddInfoAction implements EsbServerlessRpcRemoteInterface { } public List> queryYgddInfo() { - String sql=" SELECT * from uf_jcl_rydd where delete_type=0 and TENANT_KEY='t7n9jpeaoa' " ; + String sql=" SELECT * from uf_jcl_rydd where delete_type=0 " ; log.error("queryYgddInfo.sql:{}",sql); Map rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); List> recordList = databaseUtils.getDataSourceList(rs); @@ -60,7 +60,7 @@ public class UpdateYgddInfoAction implements EsbServerlessRpcRemoteInterface { if (isToday(ddsxrq)||"3".equals(status)) { //更新数据到员工基础信息表 String sql = "update eteams.employee set department = '" + ddhbm + "',POSITION = '" + ddhgw + "',SUPERIOR = '" + ddhzjsj + "'" + - " where id = '" + ddr + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 "; + " where id = '" + ddr + "' and delete_type=0 "; log.error("UpdateYgddInfoAction.sql:{}", sql); rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); log.error("UpdateYgddInfoAction.rs:{}", rs); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java index 8144867..bd328c7 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java @@ -18,4 +18,6 @@ public interface EmployeeRelationService { String getFormField(String formId,String fieldId,String title); boolean queryIsNotHaveScanTheCodeInfo(String mobile,String email,String identity); + + Map getEmployeeColumns(); } diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java index d15a53d..34a4629 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java @@ -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 rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); List> 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 getEmployeeColumns() { + Map result = new HashMap<>(); + String sql = "select form_id from form_table where table_name=? and delete_type='0'"; + List 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 rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); + List> personFormList = databaseUtils.getDataSourceList(rs); + log.error("getEmployeeColumns.personFormList:{}", personFormList); + + //基本信息自定义字段表 + String personCustomfieldFormid=(String)personFormList.get(0).get("hrm"); + log.error("getEmployeeColumns.personCustomfieldFormid:{}", personCustomfieldFormid); + + + List 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 rs2 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); + List> fieldGroupList = databaseUtils.getDataSourceList(rs2); + log.error("getEmployeeColumns.fieldGroupList:{}", fieldGroupList); + + Map 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> employeeFieldList = employeeInformationService.getFieldList(ownEntity,new SimpleEmployee()); + log.error("employeeFieldList : [{}]",employeeFieldList); + //员工信息主表-基本信息字段 + List> mainFormBasicFieldList = employeeFieldList.stream().filter(e->fieldGroup.get(Constants.BASIC_INFORMATION).equals(e.get("groupId")) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList()); + //员工信息主表-账户信息字段 + List> mainFormAccountFieldList = employeeFieldList.stream().filter(e->fieldGroup.get(Constants.ACCOUNT_INFORMATION).equals(e.get("groupId")) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList()); + //员工信息主表-个人信息字段 + List> 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> personCustomFieldList = employeeInformationService.getFieldList(personCustomEntity,new SimpleEmployee()); + List> 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.获取连接池实例