@ -11,14 +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.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 ;
@ -478,7 +481,7 @@ public class RocketmqUtil {
if ( "M" . equalsIgnoreCase ( actType ) )
if ( "M" . equalsIgnoreCase ( actType ) )
{
{
String deptUpdateSql = " update hrmdepartment set departmentmark=?,departmentname=?," +
String deptUpdateSql = " update hrmdepartment set departmentmark=?,departmentname=?," +
" subcompanyid1=?,showorder=?, supdepid=? where departmentcode=? " ;
" subcompanyid1=?,showorder=?, supdepid=? where departmentcode=? " ;
bb . writeLog ( "deptUpdateSql:" + deptUpdateSql ) ;
bb . writeLog ( "deptUpdateSql:" + deptUpdateSql ) ;
Object [ ] objects = new Object [ ] { departmentmark , departmentmark , subcompanyid1 , orgId , supdepid , orgCode } ;
Object [ ] objects = new Object [ ] { departmentmark , departmentmark , subcompanyid1 , orgId , supdepid , orgCode } ;
@ -512,7 +515,7 @@ public class RocketmqUtil {
if ( hrmResourceCount = = 0 ) {
if ( hrmResourceCount = = 0 ) {
String deptUpdateSql = " update hrmdepartment set departmentmark=?,departmentname=?,canceled=?," +
String deptUpdateSql = " update hrmdepartment set departmentmark=?,departmentname=?,canceled=?," +
" subcompanyid1=?,showorder=?, supdepid=? where departmentcode=? " ;
" subcompanyid1=?,showorder=?, supdepid=? where departmentcode=? " ;
bb . writeLog ( "deptUpdateSql:" + deptUpdateSql ) ;
bb . writeLog ( "deptUpdateSql:" + deptUpdateSql ) ;
Object [ ] objects = new Object [ ] { departmentmark , departmentmark , canceled , subcompanyid1 , orgId , supdepid , orgCode } ;
Object [ ] objects = new Object [ ] { departmentmark , departmentmark , canceled , subcompanyid1 , orgId , supdepid , orgCode } ;
@ -692,8 +695,8 @@ public class RocketmqUtil {
if ( StringUtils . isNotEmpty ( systemUserCode ) ) {
if ( StringUtils . isNotEmpty ( systemUserCode ) ) {
String sql = " select h.id,d.departmentcode from hrmresource h \n" +
String sql = " select h.id,d.departmentcode from hrmresource h \n" +
" inner join hrmdepartment d on d.id = h.departmentid \n" +
" inner join hrmdepartment d on d.id = h.departmentid \n" +
" where loginid='" + systemUserCode + "'" ;
" where loginid='" + systemUserCode + "'" ;
bb . writeLog ( "sql:" + sql ) ;
bb . writeLog ( "sql:" + sql ) ;
rs . executeQuery ( sql ) ;
rs . executeQuery ( sql ) ;
if ( rs . next ( ) ) {
if ( rs . next ( ) ) {
@ -970,9 +973,9 @@ public class RocketmqUtil {
if ( StringUtils . isNotEmpty ( departmentId ) & & StringUtils . isNotEmpty ( systemUserCode ) )
if ( StringUtils . isNotEmpty ( departmentId ) & & StringUtils . isNotEmpty ( systemUserCode ) )
{
{
String sql = " select h.id,k.jobtitlecode " +
String sql = " select h.id,k.jobtitlecode " +
" from hrmresource h " +
" from hrmresource h " +
" left join HrmJobTitles k on h.jobtitle = k.id " +
" left join HrmJobTitles k on h.jobtitle = k.id " +
" where h.workcode=? and h.departmentid = ? " ;
" where h.workcode=? and h.departmentid = ? " ;
bb . writeLog ( "sql:" + sql ) ;
bb . writeLog ( "sql:" + sql ) ;
rs . executeQuery ( sql , new Object [ ] { systemUserCode , departmentId } ) ;
rs . executeQuery ( sql , new Object [ ] { systemUserCode , departmentId } ) ;
if ( rs . next ( ) ) {
if ( rs . next ( ) ) {
@ -995,10 +998,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: 主岗位
@ -1034,7 +1054,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 ;
@ -1088,6 +1125,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 > ( ) ;
@ -1368,7 +1413,7 @@ public class RocketmqUtil {
JobTitlesComInfo jobTitlesComInfo ;
JobTitlesComInfo jobTitlesComInfo ;
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 } ) ;
@ -1408,6 +1453,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 } ;
@ -1420,8 +1470,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 ) ;
@ -1443,8 +1521,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 ) ;
@ -1460,6 +1566,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 ) ) { //新增
@ -1476,8 +1590,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 = 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 ) ;
@ -1493,6 +1636,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 ) ;
}
}
}
}
@ -1666,7 +1817,7 @@ public class RocketmqUtil {
bb . writeLog ( "status:" + status ) ;
bb . writeLog ( "status:" + status ) ;
String userUpdateSql = " update hrmresource set loginid=?,lastname=?,departmentid=?,subcompanyid1=?," +
String userUpdateSql = " update hrmresource set loginid=?,lastname=?,departmentid=?,subcompanyid1=?," +
" creater=?,email=?,mobile=?,status=?,dsporder=?,lastmoddate=?,modified=? where workcode=? " ;
" creater=?,email=?,mobile=?,status=?,dsporder=?,lastmoddate=?,modified=? where workcode=? " ;
Object [ ] objects = new Object [ ] { loginid , lastname , deptId , subcompanyid1 , creator , email , pwdSmsTel , status , loginedNum , currentDate , currentDateTime , staffCode } ;
Object [ ] objects = new Object [ ] { loginid , lastname , deptId , subcompanyid1 , creator , email , pwdSmsTel , status , loginedNum , currentDate , currentDateTime , staffCode } ;
@ -1751,9 +1902,9 @@ public class RocketmqUtil {
if ( StringUtils . isNotEmpty ( id ) )
if ( StringUtils . isNotEmpty ( id ) )
{
{
String userInsertSql = " insert into hrmresource(id,loginid,password,workcode,lastname,departmentid,subcompanyid1," +
String userInsertSql = " insert into hrmresource(id,loginid,password,workcode,lastname,departmentid,subcompanyid1," +
" creater,email,mobile,jobtitle,status,dsporder,systemlanguage,createdate,lastmoddate,created,modified," +
" creater,email,mobile,jobtitle,status,dsporder,systemlanguage,createdate,lastmoddate,created,modified," +
" locationid,seclevel,createrid,lastmodid,outkey) " +
" locationid,seclevel,createrid,lastmodid,outkey) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
Object [ ] objects = new Object [ ] { id , staffCode , password , staffCode , lastname , deptId , subcompanyid1 ,
Object [ ] objects = new Object [ ] { id , staffCode , password , staffCode , lastname , deptId , subcompanyid1 ,
creator , email , pwdSmsTel , jobTitleId , status , loginedNum , systemlanguage , currentDate , currentDate , currentDateTime , currentDateTime ,
creator , email , pwdSmsTel , jobTitleId , status , loginedNum , systemlanguage , currentDate , currentDate , currentDateTime , currentDateTime ,
@ -2241,4 +2392,147 @@ 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 ;
}
}
}