@ -11,13 +11,17 @@ import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet ;
import weaver.conn.RecordSet ;
import weaver.formmode.setup.ModeRightInfo ;
import weaver.formmode.setup.ModeRightInfo ;
import weaver.general.BaseBean ;
import weaver.general.BaseBean ;
import weaver.general.LabelUtil ;
import weaver.general.TimeUtil ;
import weaver.general.TimeUtil ;
import weaver.general.Util ;
import weaver.general.Util ;
import weaver.hrm.cachecenter.bean.RolemembersComInfo ;
import weaver.hrm.cachecenter.bean.RolemembersComInfo ;
import weaver.hrm.company.DepartmentComInfo ;
import weaver.hrm.company.DepartmentComInfo ;
import weaver.hrm.definedfield.HrmFieldComInfo ;
import weaver.hrm.job.JobTitlesComInfo ;
import weaver.hrm.resource.ResourceComInfo ;
import weaver.hrm.resource.ResourceComInfo ;
import weaver.hrm.roles.RolesComInfo ;
import weaver.hrm.roles.RolesComInfo ;
import weaver.interfaces.dito.comInfo.PropBean ;
import weaver.interfaces.dito.comInfo.PropBean ;
import weaver.matrix.MatrixUtil ;
import weaver.systeminfo.systemright.CheckUserRight ;
import weaver.systeminfo.systemright.CheckUserRight ;
import java.io.IOException ;
import java.io.IOException ;
@ -955,14 +959,14 @@ public class RocketmqUtil {
}
}
String userId = "" ;
String userId = "" ;
String jobtitlesId = "" ;
String jobtitlesId = "" ;
String departmentId = " ";
String departmentId = " -1 ";
try {
try {
if ( StringUtils . isNotEmpty ( orgCode ) ) {
if ( StringUtils . isNotEmpty ( orgCode ) ) {
String querDepartmentIdSql = " select id from hrmdepartment where departmentcode=? " ;
String querDepartmentIdSql = " select id from hrmdepartment where departmentcode=? " ;
bb . writeLog ( "querDepartmentIdSql:" + querDepartmentIdSql ) ;
bb . writeLog ( "querDepartmentIdSql:" + querDepartmentIdSql ) ;
rs . executeQuery ( querDepartmentIdSql , new Object [ ] { orgCode } ) ;
rs . executeQuery ( querDepartmentIdSql , new Object [ ] { orgCode } ) ;
if ( rs . next ( ) ) {
if ( rs . next ( ) ) {
departmentId = rs. getString ( "id ") ;
departmentId = Util. null2String ( rs. getString ( "id ") , "null ") ;
}
}
}
}
if ( StringUtils . isNotEmpty ( departmentId ) & & StringUtils . isNotEmpty ( systemUserCode ) )
if ( StringUtils . isNotEmpty ( departmentId ) & & StringUtils . isNotEmpty ( systemUserCode ) )
@ -989,10 +993,27 @@ public class RocketmqUtil {
if ( "A" . equals ( actType ) | | "M" . equals ( actType ) )
if ( "A" . equals ( actType ) | | "M" . equals ( actType ) )
{
{
if ( StringUtils . isNotEmpty ( postName ) ) {
if ( StringUtils . isNotEmpty ( postName ) ) {
postName = postName . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) ;
postName = postName . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) .replaceAll ( "_" , "" ) ;
if ( stringSet . contains ( postName ) ) {
if ( stringSet . contains ( postName ) ) {
String sql = "update matrixtable_2 set " + postName + "=? where id=?" ;
String sql = "update matrixtable_2 set " + postName + "=? where id=?" ;
rs . executeUpdate ( sql , new Object [ ] { userId , departmentId } ) ;
boolean bool = rs . executeUpdate ( sql , new Object [ ] { userId , departmentId } ) ;
if ( bool ) {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "更新人员岗位同步到部门矩阵执行成功" ) ;
dataMapp . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMapp ) ;
} else {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "更新人员岗位同步到部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMapp ) ;
}
}
}
}
}
//当岗位为主岗位时才更新, 1: 主岗位
//当岗位为主岗位时才更新, 1: 主岗位
@ -1025,7 +1046,24 @@ public class RocketmqUtil {
postName = postName . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) ;
postName = postName . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) ;
if ( stringSet . contains ( postName ) ) {
if ( stringSet . contains ( postName ) ) {
String sql = "update matrixtable_2 set " + postName + "=null where id=?" ;
String sql = "update matrixtable_2 set " + postName + "=null where id=?" ;
rs . executeUpdate ( sql , new Object [ ] { departmentId } ) ;
boolean bool = rs . executeUpdate ( sql , new Object [ ] { departmentId } ) ;
if ( bool ) {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "删除人员岗位同步到部门矩阵执行成功" ) ;
dataMapp . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMapp ) ;
} else {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "删除人员岗位同步到部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMapp ) ;
}
}
}
}
}
jobtitlesId = null ;
jobtitlesId = null ;
@ -1061,6 +1099,14 @@ public class RocketmqUtil {
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "staffcode" , systemUserCode ) ;
dataMap . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMap ) ;
recordErrorData ( dataMap ) ;
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "人员岗位中岗位或者人员ID在系统中不存在同步到部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMapp ) ;
}
}
} catch ( Exception e ) {
} catch ( Exception e ) {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
@ -1339,12 +1385,12 @@ public class RocketmqUtil {
String jobtitlename = sysPostName ;
String jobtitlename = sysPostName ;
try {
try {
String departmentId = " ";
String departmentId = " -1 ";
if ( StringUtils . isNotEmpty ( orgCode ) ) {
if ( StringUtils . isNotEmpty ( orgCode ) ) {
String querDepartmentIdSql = "select id from hrmdepartment where departmentcode=?" ;
String querDepartmentIdSql = "select id from hrmdepartment where departmentcode=?" ;
rs . executeQuery ( querDepartmentIdSql , new Object [ ] { orgCode } ) ;
rs . executeQuery ( querDepartmentIdSql , new Object [ ] { orgCode } ) ;
if ( rs . next ( ) ) {
if ( rs . next ( ) ) {
departmentId = rs. getString ( "id" ) ;
departmentId = String. valueOf ( Util . getIntValue ( rs. getString ( "id" ) , - 1 ) ) ;
}
}
}
}
@ -1379,6 +1425,11 @@ public class RocketmqUtil {
if ( StringUtils . isNotEmpty ( jobtitleid ) )
if ( StringUtils . isNotEmpty ( jobtitleid ) )
{
{
if ( "M" . equals ( actType ) ) { //修改
if ( "M" . equals ( actType ) ) { //修改
rs . executeQuery ( "select * from hrmjobtitles where id=?" , jobtitleid ) ;
rs . next ( ) ;
String oldjobtitlename = Util . null2String ( rs . getString ( "jobtitlename" ) ) ;
String updateHrmjobactivitiesSql = "update hrmjobtitles set jobtitlemark=?,jobtitlename=?,modified=?,modifier=? where id=?" ;
String updateHrmjobactivitiesSql = "update hrmjobtitles set jobtitlemark=?,jobtitlename=?,modified=?,modifier=? where id=?" ;
Object [ ] objects = new Object [ ] { jobtitlemark , jobtitlename , modified , modifier , jobtitleid } ;
Object [ ] objects = new Object [ ] { jobtitlemark , jobtitlename , modified , modifier , jobtitleid } ;
@ -1391,8 +1442,36 @@ public class RocketmqUtil {
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "systable" , tableName ) ;
if ( ! flag ) {
if ( ! flag ) {
dataMap . put ( "errmessage" , "系统岗位更新SQL执行错误" ) ;
dataMap . put ( "errmessage" , "系统岗位更新SQL执行错误" ) ;
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "修改岗位同步到部门自定义字段以及部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
} else {
} else {
dataMap . put ( "errmessage" , "系统岗位更新SQL执行成功" ) ;
dataMap . put ( "errmessage" , "系统岗位更新SQL执行成功" ) ;
//岗位修改同步到部门自定义字段以及部门矩阵
boolean bool = updateDeptMatrix ( oldjobtitlename , jobtitlename ) ;
if ( bool ) {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "修改岗位同步到部门自定义字段以及部门矩阵执行成功" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
} else {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "修改岗位同步到部门自定义字段以及部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
}
}
}
dataMap . put ( "zxyj" , updateHrmjobactivitiesSql ) ;
dataMap . put ( "zxyj" , updateHrmjobactivitiesSql ) ;
@ -1414,8 +1493,36 @@ public class RocketmqUtil {
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "systable" , tableName ) ;
if ( ! flag ) {
if ( ! flag ) {
dataMap . put ( "errmessage" , "系统岗位封存SQL执行错误" ) ;
dataMap . put ( "errmessage" , "系统岗位封存SQL执行错误" ) ;
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "删除岗位同步到部门自定义字段以及部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
} else {
} else {
dataMap . put ( "errmessage" , "系统岗位封存SQL执行成功" ) ;
dataMap . put ( "errmessage" , "系统岗位封存SQL执行成功" ) ;
//岗位删除同步到部门自定义字段以及部门矩阵
boolean bool = deleteDeptMatrix ( jobtitlename ) ;
if ( bool ) {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "删除岗位同步到部门自定义字段以及部门矩阵执行成功" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
} else {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "删除岗位同步到部门自定义字段以及部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
}
}
}
dataMap . put ( "zxyj" , updateHrmjobactivitiesSql ) ;
dataMap . put ( "zxyj" , updateHrmjobactivitiesSql ) ;
@ -1423,6 +1530,7 @@ public class RocketmqUtil {
dataMap . put ( "staffcode" , sysPostCode ) ;
dataMap . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMap ) ;
recordErrorData ( dataMap ) ;
} else {
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
@ -1431,6 +1539,14 @@ public class RocketmqUtil {
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "staffcode" , sysPostCode ) ;
dataMap . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMap ) ;
recordErrorData ( dataMap ) ;
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "系统岗位不存在无法修改或者删除部门矩阵" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
}
}
} else {
} else {
if ( "A" . equals ( actType ) ) { //新增
if ( "A" . equals ( actType ) ) { //新增
@ -1447,8 +1563,37 @@ public class RocketmqUtil {
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "systable" , tableName ) ;
if ( ! flag ) {
if ( ! flag ) {
dataMap . put ( "errmessage" , "系统岗位新增SQL执行错误" ) ;
dataMap . put ( "errmessage" , "系统岗位新增SQL执行错误" ) ;
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "新增岗位同步到部门自定义字段以及部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
} else {
} else {
dataMap . put ( "errmessage" , "系统岗位新增SQL执行成功" ) ;
dataMap . put ( "errmessage" , "系统岗位新增SQL执行成功" ) ;
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo ( ) ;
jobTitlesComInfo . addCache ( jobtitleid ) ;
//岗位新增同步到部门自定义字段以及部门矩阵
boolean bool = insertDeptMatrix ( jobtitlename ) ;
if ( bool ) {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "新增岗位同步到部门自定义字段以及部门矩阵执行成功" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
} else {
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "新增岗位同步到部门自定义字段以及部门矩阵执行错误" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
}
}
}
dataMap . put ( "staffcode" , sysPostCode ) ;
dataMap . put ( "staffcode" , sysPostCode ) ;
@ -1456,6 +1601,7 @@ public class RocketmqUtil {
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
recordErrorData ( dataMap ) ;
recordErrorData ( dataMap ) ;
} else {
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
@ -1464,6 +1610,14 @@ public class RocketmqUtil {
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "staffcode" , sysPostCode ) ;
dataMap . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMap ) ;
recordErrorData ( dataMap ) ;
Map < String , String > dataMapp = new HashMap < String , String > ( ) ;
dataMapp . put ( "syndate" , nowDateTime ) ;
dataMapp . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMapp . put ( "systable" , tableName ) ;
dataMapp . put ( "errmessage" , "系统岗位不存在无法修改或者删除部门矩阵" ) ;
dataMapp . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMapp ) ;
}
}
}
}
} catch ( Exception e ) {
} catch ( Exception e ) {
@ -2253,4 +2407,146 @@ public class RocketmqUtil {
return set ;
return set ;
}
}
/ * *
* 修 改 岗 位 同 步 到 部 门 自 定 义 字 段 以 及 部 门 矩 阵
* @param oldjobtitlename
* @param newjobtitlename
* @return
* /
public static boolean updateDeptMatrix ( String oldjobtitlename , String newjobtitlename ) {
boolean bool = false ;
RecordSet rs = new RecordSet ( ) ;
try {
rs . executeUpdate ( "update htmllabelinfo set labelname='" + newjobtitlename + "' where labelname='" + oldjobtitlename + "'" ) ;
oldjobtitlename = oldjobtitlename . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) . replaceAll ( "_" , "" ) ;
newjobtitlename = newjobtitlename . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) . replaceAll ( "_" , "" ) ;
rs . executeQuery ( "select * from hrm_formfield where fieldname=?" , oldjobtitlename ) ;
rs . next ( ) ;
String fieldid = Util . null2String ( rs . getString ( "fieldid" ) ) ;
if ( ! oldjobtitlename . equals ( newjobtitlename ) ) {
rs . writeLog ( "============ RocketmqUtil deleteDeptMatrix oldjobtitlename 111 ====================== " + oldjobtitlename ) ;
rs . writeLog ( "============ RocketmqUtil deleteDeptMatrix oldjobtitlename 222 ====================== " + newjobtitlename ) ;
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo ( ) ;
rs . executeUpdate ( "UPDATE hrm_formfield SET fieldname=? where fieldid=?" , newjobtitlename , fieldid ) ;
rs . execute ( "ALTER TABLE hrmdepartmentdefined CHANGE " + oldjobtitlename + " " + newjobtitlename + " TEXT" ) ;
HrmFieldComInfo . removeFieldCache ( ) ;
//同步部门数据到矩阵
MatrixUtil . sysDepartmentData ( ) ;
bool = true ;
}
} catch ( Exception e ) {
e . printStackTrace ( ) ;
rs . writeLog ( e ) ;
bool = false ;
}
return bool ;
}
/ * *
* 删 除 岗 位 同 步 到 部 门 自 定 义 字 段 以 及 部 门 矩 阵
* @param jobtitlename
* @return
* /
public static boolean deleteDeptMatrix ( String jobtitlename ) {
boolean bool = false ;
RecordSet rs = new RecordSet ( ) ;
try {
jobtitlename = jobtitlename . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) . replaceAll ( "_" , "" ) ;
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo ( ) ;
rs . writeLog ( "============ RocketmqUtil deleteDeptMatrix jobtitlename 111 ====================== " + jobtitlename ) ;
String htmlLabelInfoSql = "delete from htmllabelinfo where labelname=?" ;
rs . executeUpdate ( htmlLabelInfoSql , new Object [ ] { jobtitlename } ) ;
String hrmFormFieldSql = "delete from hrm_formfield where fieldname=?" ;
rs . executeUpdate ( hrmFormFieldSql , new Object [ ] { jobtitlename } ) ;
rs . execute ( "UPDATE hrmdepartmentdefined set " + jobtitlename + "=null" ) ;
rs . execute ( "ALTER TABLE hrmdepartmentdefined DROP COLUMN " + jobtitlename + " " ) ;
HrmFieldComInfo . removeFieldCache ( ) ;
//同步部门数据到矩阵
MatrixUtil . sysDepartmentData ( ) ;
bool = true ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
rs . writeLog ( e ) ;
bool = false ;
}
return bool ;
}
/ * *
* 新 增 岗 位 同 步 到 部 门 自 定 义 字 段 以 及 部 门 矩 阵
* @param jobtitlename
* @return
* /
public static boolean insertDeptMatrix ( String jobtitlename ) {
boolean bool = false ;
RecordSet rs = new RecordSet ( ) ;
try {
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo ( ) ;
rs . writeLog ( "============ RocketmqUtil InsertDeptMatrix jobtitlename 111 ====================== " + jobtitlename ) ;
int lableid = new LabelUtil ( ) . getLabelId ( jobtitlename ) ;
int hrmfieldid = getMaxFieldId ( ) ;
rs . writeLog ( "============ RocketmqUtil InsertDeptMatrix hrmfieldid ====================== " + hrmfieldid ) ;
int hrmfieldorder = getMaxOrder ( ) ;
rs . writeLog ( "============ RocketmqUtil InsertDeptMatrix hrmfieldorder ====================== " + hrmfieldorder ) ;
jobtitlename = jobtitlename . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) . replaceAll ( "_" , "" ) ;
rs . writeLog ( "============ RocketmqUtil InsertDeptMatrix jobtitlename 222 ====================== " + jobtitlename ) ;
String hrmFormFieldSql = "insert into hrm_formfield(fieldid,fielddbtype,fieldname,fieldlabel,fieldhtmltype,type,fieldorder,ismand,isuse,groupid,allowhide) " +
"values(?,?,?,?,?,?,?,?,?,?,?)" ;
rs . executeUpdate ( hrmFormFieldSql , new Object [ ] { hrmfieldid , "text" , jobtitlename , "" + lableid , "3" , "17" , hrmfieldorder , "0" , "1" , "7" , "1" } ) ;
rs . execute ( "ALTER TABLE hrmdepartmentdefined ADD COLUMN " + jobtitlename + " TEXT " ) ;
HrmFieldComInfo . removeFieldCache ( ) ;
//同步部门数据到矩阵
MatrixUtil . sysDepartmentData ( ) ;
bool = true ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
rs . writeLog ( e ) ;
bool = false ;
}
return bool ;
}
public static int getMaxFieldId ( ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select max(fieldid)as ordee from hrm_formfield" ) ;
rs . next ( ) ;
return rs . getInt ( "ordee" ) + 1 ;
}
public static int getMaxOrder ( ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select max(fieldorder)as ordee from hrm_formfield" ) ;
rs . next ( ) ;
return rs . getInt ( "ordee" ) + 1 ;
}
public static int getMinLabelIndexId ( ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select min(indexid)as ordee from htmllabelinfo" ) ;
rs . next ( ) ;
return rs . getInt ( "ordee" ) - 1 ;
}
}
}