@ -453,7 +453,7 @@ public class RocketmqUtil {
if ( rs . next ( ) ) {
subcompanyid1 = Util . null2String ( rs . getString ( "id" ) ) ;
}
if ( "" . equals ( subcompanyid1 ) ) {
if ( StringUtils . isBlank ( subcompanyid1 ) ) {
String sql = " select id,subcompanyid1 from hrmdepartment where departmentcode = ?" ;
rs . executeQuery ( sql , new Object [ ] { parentOrgCode } ) ;
if ( rs . next ( ) ) {
@ -462,10 +462,10 @@ public class RocketmqUtil {
}
}
}
bb . writeLog ( "actType:" + actType ) ;
bb . writeLog ( "supdepid:" + supdepid ) ;
bb . writeLog ( "subcompanyid1:" + subcompanyid1 ) ;
// String departmentmark = " ~`~`7 "+orgName+"`~`8 "+orgName+"`~`~";
String departmentmark = orgName ;
if ( StringUtils . isNotEmpty ( subcompanyid1 ) )
{
@ -716,7 +716,7 @@ public class RocketmqUtil {
String queryRoleIdSql = " select id from hrmroles where rolesmark=?" ;
rs . executeQuery ( queryRoleIdSql , new Object [ ] { roleCode } ) ;
if ( rs . next ( ) ) {
roleId = rs. getString ( "id" ) ;
roleId = Util. null2String ( rs. getString ( "id" ) ) ;
}
}
bb . writeLog ( "userId:" + userId + " roleId:" + roleId ) ;
@ -727,7 +727,7 @@ public class RocketmqUtil {
String ifExistSql = "select id from hrmrolemembers where roleid=? and resourceid=?" ;
rs . executeQuery ( ifExistSql , new Object [ ] { roleId , userId } ) ;
if ( rs . next ( ) ) {
releationId = rs. getString ( "id" ) ;
releationId = Util. null2String ( rs. getString ( "id" ) ) ;
}
bb . writeLog ( "userId:" + userId + " roleId:" + roleId + "releationId:" + releationId ) ;
if ( StringUtils . isNotEmpty ( releationId ) ) {
@ -959,23 +959,28 @@ public class RocketmqUtil {
}
String userId = "" ;
String jobtitlesId = "" ;
String departmentId = "-1" ;
String departmentId = "" ;
String jobtitlecode = "" ;
try {
if ( StringUtils . isNotEmpty ( orgCode ) ) {
String querDepartmentIdSql = " select id from hrmdepartment where departmentcode=? " ;
bb . writeLog ( "querDepartmentIdSql:" + querDepartmentIdSql ) ;
rs . executeQuery ( querDepartmentIdSql , new Object [ ] { orgCode } ) ;
if ( rs . next ( ) ) {
departmentId = Util . null2String ( rs . getString ( "id" ) ,"null" );
departmentId = Util . null2String ( rs . getString ( "id" ) );
}
}
if ( StringUtils . isNotEmpty ( departmentId ) & & StringUtils . isNotEmpty ( systemUserCode ) )
{
String sql = " select id from hrmresource where workcode=? and departmentid = ?" ;
String sql = " select h.id,k.jobtitlecode " +
" from hrmresource h " +
" left join HrmJobTitles k on h.jobtitle = k.id " +
" where h.workcode=? and h.departmentid = ? " ;
bb . writeLog ( "sql:" + sql ) ;
rs . executeQuery ( sql , new Object [ ] { systemUserCode , departmentId } ) ;
if ( rs . next ( ) ) {
userId = Util . null2String ( rs . getString ( "id" ) ) ;
jobtitlecode = Util . null2String ( rs . getString ( "jobtitlecode" ) ) ;
}
}
if ( StringUtils . isNotEmpty ( postCode ) ) {
@ -983,7 +988,7 @@ public class RocketmqUtil {
bb . writeLog ( "queryRoleIdSql:" + queryRoleIdSql ) ;
rs . executeQuery ( queryRoleIdSql , new Object [ ] { postCode } ) ;
if ( rs . next ( ) ) {
jobtitlesId = rs. getString ( "id" ) ;
jobtitlesId = Util. null2String ( rs. getString ( "id" ) ) ;
}
}
bb . writeLog ( "jobtitlesId:" + jobtitlesId ) ;
@ -1042,54 +1047,75 @@ public class RocketmqUtil {
recordErrorData ( dataMap ) ;
// }
} else if ( "D" . equals ( actType ) ) {
if ( StringUtils . isNotEmpty ( postName ) ) {
postName = postName . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) ;
if ( stringSet . contains ( postName ) ) {
String sql = "update matrixtable_2 set " + postName + "=null where id=?" ;
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 ) ;
if ( StringUtils . isNotBlank ( jobtitlecode ) ) {
if ( jobtitlecode . equals ( postCode ) ) {
if ( StringUtils . isNotEmpty ( postName ) ) {
postName = postName . toLowerCase ( ) . replaceAll ( "\\s+" , "" ) ;
if ( stringSet . contains ( postName ) ) {
String sql = "update matrixtable_2 set " + postName + "=null where id=?" ;
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 ;
String updateUserJobSql = " update hrmresource set jobtitle=?,modified=?,modifier=? where id=? " ;
bb . writeLog ( "updateUserJobSql:" + updateUserJobSql ) ;
jobtitlesId = null ;
String updateUserJobSql = " update hrmresource set jobtitle=?,modified=?,modifier=? where id=? " ;
bb . writeLog ( "updateUserJobSql:" + updateUserJobSql ) ;
Object [ ] objects = new Object [ ] { jobtitlesId , currentDateTime , updateStaff , userId } ;
Object [ ] objects = new Object [ ] { jobtitlesId , currentDateTime , updateStaff , userId } ;
boolean flag = rs . executeUpdate ( updateUserJobSql , objects ) ;
bb . writeLog ( " updateUserJobFlag: " + flag ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "systable" , tableName ) ;
if ( ! flag ) {
dataMap . put ( "errmessage" , "删除人员岗位sql执行错误" ) ;
} else {
dataMap . put ( "errmessage" , "删除人员岗位sql执行成功" ) ;
}
dataMap . put ( "staffcode" , systemUserCode ) ;
boolean flag = rs . executeUpdate ( updateUserJobSql , objects ) ;
bb . writeLog ( " updateUserJobFlag: " + flag ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "systable" , tableName ) ;
if ( ! flag ) {
dataMap . put ( "errmessage" , "删除人员岗位sql执行错误" ) ;
} else {
dataMap . put ( "errmessage" , "删除人员岗位sql执行成功" ) ;
}
dataMap . put ( "staffcode" , systemUserCode ) ;
dataMap . put ( "zxyj" , updateUserJobSql ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
dataMap . put ( "zxyj" , updateUserJobSql ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
recordErrorData ( dataMap ) ;
recordErrorData ( dataMap ) ;
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "errmessage" , "人员岗位中人对应的岗位不存在,无法删除" ) ;
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMap ) ;
}
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "errmessage" , "人员岗位中人对应的岗位为空,无法删除" ) ;
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "staffcode" , systemUserCode ) ;
recordErrorData ( dataMap ) ;
}
}
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
@ -1195,7 +1221,7 @@ public class RocketmqUtil {
rs . executeQuery ( queryRoleSql , new Object [ ] { sysRoleCode } ) ;
bb . writeLog ( queryRoleSql ) ;
if ( rs . next ( ) ) {
rolesid = rs. getString ( "id" ) ;
rolesid = Util. null2String ( rs. getString ( "id" ) ) ;
}
}
bb . writeLog ( "rolesid:" + rolesid ) ;
@ -1384,13 +1410,15 @@ public class RocketmqUtil {
String jobtitlemark = sysPostName ;
String jobtitlename = sysPostName ;
JobTitlesComInfo jobTitlesComInfo ;
try {
String departmentId = "-1" ;
if ( StringUtils . isNotEmpty ( orgCode ) ) {
String querDepartmentIdSql = "select id from hrmdepartment where departmentcode=?" ;
rs . executeQuery ( querDepartmentIdSql , new Object [ ] { orgCode } ) ;
if ( rs . next ( ) ) {
departmentId = String. valueOf ( Util . getIntValue ( rs . getString ( "id" ) , - 1 ) ) ;
departmentId = Util. null2String ( rs . getString ( "id" ) , "null" ) ;
}
}
@ -1418,7 +1446,7 @@ public class RocketmqUtil {
String queryRoleSql = " select id from hrmjobtitles where jobtitlecode =? and jobactivityid = ?" ;
rs . executeQuery ( queryRoleSql , new Object [ ] { sysPostCode , jobactivitiesid } ) ;
if ( rs . next ( ) ) {
jobtitleid = rs. getString ( "id" ) ;
jobtitleid = Util. null2String ( rs. getString ( "id" ) ) ;
}
}
@ -1530,7 +1558,6 @@ public class RocketmqUtil {
dataMap . put ( "staffcode" , sysPostCode ) ;
recordErrorData ( dataMap ) ;
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
@ -1573,7 +1600,7 @@ public class RocketmqUtil {
recordErrorData ( dataMapp ) ;
} else {
dataMap . put ( "errmessage" , "系统岗位新增SQL执行成功" ) ;
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo ( ) ;
jobTitlesComInfo = new JobTitlesComInfo ( ) ;
jobTitlesComInfo . addCache ( jobtitleid ) ;
//岗位新增同步到部门自定义字段以及部门矩阵
boolean bool = insertDeptMatrix ( jobtitlename ) ;
@ -1601,7 +1628,6 @@ public class RocketmqUtil {
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
recordErrorData ( dataMap ) ;
} else {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
@ -1620,6 +1646,11 @@ public class RocketmqUtil {
recordErrorData ( dataMapp ) ;
}
}
jobTitlesComInfo = new JobTitlesComInfo ( ) ;
jobTitlesComInfo . removeJobTitlesCache ( ) ;
} catch ( Exception e ) {
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
@ -1812,10 +1843,14 @@ public class RocketmqUtil {
recordErrorData ( dataMap ) ;
} else if ( "D" . equals ( actType ) ) {
status = "5" ;
String staffCodenew = loginid + "_cf_0" ;
String userUpdateSql = " update hrmresource set status=?,loginid=?,workcode=? where id=? " ;
// String staffCodenew = loginid+"_cf_0";
// String userUpdateSql = " update hrmresource set status=?,loginid=?,workcode=? where id=? ";
//
// Object[] objects = new Object[]{status,staffCodenew,staffCodenew,userid};
// bb.writeLog("userUpdateSql:"+userUpdateSql);
Object [ ] objects = new Object [ ] { status , staffCodenew , staffCodenew , userid } ;
String userUpdateSql = " update hrmresource set status=? where id=? " ;
Object [ ] objects = new Object [ ] { status , userid } ;
bb . writeLog ( "userUpdateSql:" + userUpdateSql ) ;
boolean flag = rs . executeUpdate ( userUpdateSql , objects ) ;
@ -1836,182 +1871,132 @@ public class RocketmqUtil {
dataMap . put ( "errmessage" , "人员离职SQL执行成功" ) ;
}
recordErrorData ( dataMap ) ;
} else {
} else if ( "A" . equalsIgnoreCase ( actType ) ) {
int status1count = 0 ;
sql = " select id from hrmresource where loginid = '" + staffCode + "' and status in(0,1,2,3) " ;
bb . writeLog ( "loginidisnotnull-sql:" + sql ) ;
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id from hrmresource where loginid like '" + staffCode + "%' " ;
bb . writeLog ( "loginidisnotnull-sql:" + sql ) ;
rs . executeQuery ( sql ) ;
if ( rs . next ( ) ) {
status1count + + ;
while ( rs . next ( ) ) {
String user_id = Util . null2String ( rs . getString ( "id" ) ) ;
String upsql = " update hrmresource set loginid='" + staffCode + "_cf_" + status5count + "',workcode='" + staffCode + "_cf_" + status5count + "' where id = " + user_id ;
bb . writeLog ( "loginidisnotnull-upsql:" + upsql ) ;
loginList . add ( upsql ) ;
status5count + + ;
}
bb . writeLog ( "loginidisnotnull-status1count:" + status1count ) ;
if ( status1count = = 0 ) {
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id from hrmresource where loginid like '" + staffCode + "%' and status = 5" ;
// sql = " select id,status from hrmresource where (loginid = '"+staffCode+"' or loginid like '"+staffCode+"_cf%') and status = 5";
bb . writeLog ( "loginidisnotnull-sql:" + sql ) ;
rs . executeQuery ( sql ) ;
while ( rs . next ( ) ) {
String user_id = Util . null2String ( rs . getString ( "id" ) ) ;
String upsql = " update hrmresource set loginid='" + staffCode + "_cf_" + status5count + "',workcode='" + staffCode + "_cf_" + status5count + "' where id = " + user_id + " and status = 5 " ;
bb . writeLog ( "loginidisnotnull-upsql:" + upsql ) ;
loginList . add ( upsql ) ;
status5count + + ;
}
bb . writeLog ( "loginidisnotnull-status5count:" + status5count ) ;
bb . writeLog ( "loginidisnotnull-status5count:" + status5count ) ;
if ( status5count > 0 ) {
for ( String upsql : loginList ) {
boolean isTrue = rs . executeUpdate ( upsql ) ;
bb . writeLog ( "loginidisnotnull-isTrue:" + isTrue ) ;
}
if ( status5count > 0 ) {
for ( String upsql : loginList ) {
boolean isTrue = rs . executeUpdate ( upsql ) ;
bb . writeLog ( "loginidisnotnull-isTrue:" + isTrue ) ;
}
}
rs . executeProc ( "HrmResourceMaxId_Get" , "" ) ;
rs . next ( ) ;
String id = "" + rs . getInt ( 1 ) ;
bb . writeLog ( "loginidisnotnull-id:" + id ) ;
if ( StringUtils . isNotEmpty ( id ) )
{
String userInsertSql = " insert into hrmresource(id,loginid,password,workcode,lastname,departmentid,subcompanyid1," +
" creater,email,mobile,jobtitle,status,dsporder,systemlanguage,createdate,lastmoddate,created,modified," +
" locationid,seclevel,createrid,lastmodid,outkey) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
Object [ ] objects = new Object [ ] { id , staffCode , password , staffCode , lastname , deptId , subcompanyid1 ,
creator , email , pwdSmsTel , jobTitleId , status , loginedNum , systemlanguage , currentDate , currentDate , currentDateTime , currentDateTime ,
locationid , seclevel , createrid , lastmodid , staffId } ;
bb . writeLog ( "userInsertSql:" + userInsertSql ) ;
rs . executeProc ( "HrmResourceMaxId_Get" , "" ) ;
rs . next ( ) ;
String id = "" + rs . getInt ( 1 ) ;
bb . writeLog ( "loginidisnotnull-id:" + id ) ;
boolean flag = rs . executeUpdate ( userInsertSql , objects ) ;
bb . writeLog ( "flag:" + flag ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "staffcodecount" , datacount + "" ) ;
dataMap . put ( "staffcode" , staffCode ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "systable" , tableName ) ;
if ( StringUtils . isNotEmpty ( id ) )
{
String userInsertSql = " insert into hrmresource(id,loginid,password,workcode,lastname,departmentid,subcompanyid1," +
" creater,email,mobile,jobtitle,status,dsporder,systemlanguage,createdate,lastmoddate,created,modified," +
" locationid,seclevel,createrid,lastmodid,outkey) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
dataMap . put ( "zxyj" , userInsertSql ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
Object [ ] objects = new Object [ ] { id , staffCode , password , staffCode , lastname , deptId , subcompanyid1 ,
creator , email , pwdSmsTel , jobTitleId , status , loginedNum , systemlanguage , currentDate , currentDate , currentDateTime , currentDateTime ,
locationid , seclevel , createrid , lastmodid , staffId } ;
bb . writeLog ( "userInsertSql:" + userInsertSql ) ;
if ( flag ) {
userid = id + "" ;
dataMap . put ( "errmessage" , "人员新增SQL执行成功" ) ;
} else {
dataMap . put ( "errmessage" , "人员新增SQL执行错误" ) ;
}
recordErrorData ( dataMap ) ;
}
} else {
boolean flag = rs . executeUpdate ( userInsertSql , objects ) ;
bb . writeLog ( "flag:" + flag ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "staffcode" , staffCode ) ;
dataMap . put ( "staffcodecount" , datacount + "" ) ;
dataMap . put ( "staffcode" , staffCode ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "errmessage" , "人员在系统中已存在, 操作类型为A" ) ;
dataMap . put ( "systable" , tableName ) ;
recordErrorData ( dataMap ) ;
String context = "人员staffname:" + staffName + ",staffcode:" + staffCode + "的员工在系统中已存在, 操作类型为A, 请检查数据" ;
recordErrorMessage ( staffCode , context ) ;
dataMap . put ( "zxyj" , userInsertSql ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
if ( flag ) {
userid = id + "" ;
dataMap . put ( "errmessage" , "人员新增SQL执行成功" ) ;
} else {
dataMap . put ( "errmessage" , "人员新增SQL执行错误" ) ;
}
recordErrorData ( dataMap ) ;
}
}
} else {
if ( "A" . equalsIgnoreCase ( actType ) )
{
int status1count = 0 ;
sql = " select id from hrmresource where loginid = '" + staffCode + "' and status in(0,1,2,3) " ;
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id from hrmresource where loginid like '" + staffCode + "%' " ;
bb . writeLog ( "staff-sql:" + sql ) ;
rs . executeQuery ( sql ) ;
if ( rs . next ( ) ) {
status1count + + ;
while ( rs . next ( ) ) {
String user_id = Util . null2String ( rs . getString ( "id" ) ) ;
String upsql = " update hrmresource set loginid='" + staffCode + "_cf_" + status5count + "',workcode='" + staffCode + "_cf_" + status5count + "' where id = " + user_id + " " ;
bb . writeLog ( "upsql:" + upsql ) ;
loginList . add ( upsql ) ;
status5count + + ;
}
bb . writeLog ( "staff-status1count:" + status1count ) ;
if ( status1count = = 0 )
{
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id from hrmresource where loginid like '" + staffCode + "%' and status = 5" ;
bb . writeLog ( "staff-sql:" + sql ) ;
rs . executeQuery ( sql ) ;
while ( rs . next ( ) ) {
String user_id = Util . null2String ( rs . getString ( "id" ) ) ;
String upsql = " update hrmresource set loginid='" + staffCode + "_cf_" + status5count + "',workcode='" + staffCode + "_cf_" + status5count + "' where id = " + user_id + " and status = 5" ;
bb . writeLog ( "upsql:" + upsql ) ;
loginList . add ( upsql ) ;
status5count + + ;
}
bb . writeLog ( "staff-status5count:" + status5count ) ;
bb . writeLog ( "staff-status5count:" + status5count ) ;
if ( status5count > 0 ) {
for ( String upsql : loginList ) {
boolean isTrue = rs . executeUpdate ( upsql ) ;
bb . writeLog ( "isTrue:" + isTrue ) ;
}
if ( status5count > 0 ) {
for ( String upsql : loginList ) {
boolean isTrue = rs . executeUpdate ( upsql ) ;
bb . writeLog ( "isTrue:" + isTrue ) ;
}
}
rs . executeProc ( "HrmResourceMaxId_Get" , "" ) ;
rs . next ( ) ;
String id = "" + rs . getInt ( 1 ) ;
bb . writeLog ( "id:" + id ) ;
if ( StringUtils . isNotEmpty ( id ) )
{
String userInsertSql = " insert into hrmresource(id,loginid,password,workcode,lastname,departmentid,subcompanyid1," +
" creater,email,mobile,jobtitle,status,dsporder,systemlanguage,createdate,lastmoddate,created,modified," +
" locationid,seclevel,createrid,lastmodid,outkey) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
Object [ ] objects = new Object [ ] { id , staffCode , password , staffCode , lastname , deptId , subcompanyid1 ,
creator , email , pwdSmsTel , jobTitleId , status , loginedNum , systemlanguage , currentDate , currentDate , currentDateTime , currentDateTime ,
locationid , seclevel , createrid , lastmodid , staffId } ;
bb . writeLog ( "userInsertSql:" + userInsertSql ) ;
rs . executeProc ( "HrmResourceMaxId_Get" , "" ) ;
rs . next ( ) ;
String id = "" + rs . getInt ( 1 ) ;
bb . writeLog ( "id:" + id ) ;
if ( StringUtils . isNotEmpty ( id ) )
{
String userInsertSql = " insert into hrmresource(id,loginid,password,workcode,lastname,departmentid,subcompanyid1," +
" creater,email,mobile,jobtitle,status,dsporder,systemlanguage,createdate,lastmoddate,created,modified," +
" locationid,seclevel,createrid,lastmodid,outkey) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
Object [ ] objects = new Object [ ] { id , staffCode , password , staffCode , lastname , deptId , subcompanyid1 ,
creator , email , pwdSmsTel , jobTitleId , status , loginedNum , systemlanguage , currentDate , currentDate , currentDateTime , currentDateTime ,
locationid , seclevel , createrid , lastmodid , staffId } ;
bb . writeLog ( "userInsertSql:" + userInsertSql ) ;
boolean flag = rs . executeUpdate ( userInsertSql , objects ) ;
bb . writeLog ( "flag:" + flag ) ;
boolean flag = rs . executeUpdate ( userInsertSql , objects ) ;
bb . writeLog ( "flag:" + flag ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "staffcodecount" , datacount + "" ) ;
dataMap . put ( "staffcode" , staffCode ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "systable" , tableName ) ;
dataMap . put ( "zxyj" , userInsertSql ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
if ( flag ) {
userid = id + "" ;
dataMap . put ( "errmessage" , "人员新增SQL执行成功" ) ;
} else {
dataMap . put ( "errmessage" , "人员新增SQL执行错误" ) ;
}
recordErrorData ( dataMap ) ;
}
} else {
bb . writeLog ( "staff-status1count22:" + status1count ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
dataMap . put ( "staffcodecount" , datacount + "" ) ;
dataMap . put ( "staffcode" , staffCode ) ;
dataMap . put ( "syndate" , nowDateTime ) ;
dataMap . put ( "reqmessage" , jsonObject . toJSONString ( ) ) ;
dataMap . put ( "errmessage" , "工号:" + staffCode + "的员工现为在职, 无法进行新增, 操作类型为A" ) ;
dataMap . put ( "systable" , tableName ) ;
recordErrorData ( dataMap ) ;
String context = "人员staffname:" + staffName + ",staffcode:" + staffCode + "的员工在系统中已存在, 操作类型为A, 请检查数据" ;
recordErrorMessage ( staffCode , context ) ;
dataMap . put ( "zxyj" , userInsertSql ) ;
dataMap . put ( "zxcs" , convertObject2String ( objects ) ) ;
if ( flag ) {
userid = id + "" ;
dataMap . put ( "errmessage" , "人员新增SQL执行成功" ) ;
} else {
dataMap . put ( "errmessage" , "人员新增SQL执行错误" ) ;
}
recordErrorData ( dataMap ) ;
}
} else if ( "M" . equalsIgnoreCase ( actType ) ) {
int status1count = 0 ;
@ -2026,12 +2011,12 @@ public class RocketmqUtil {
{
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id from hrmresource where loginid like '" + staffCode + "%' and status = 5 " ;
sql = " select id from hrmresource where loginid like '" + staffCode + "%' " ;
bb . writeLog ( "staff-M-sql:" + sql ) ;
rs . executeQuery ( sql ) ;
while ( rs . next ( ) ) {
String user_id = Util . null2String ( rs . getString ( "id" ) ) ;
String upsql = " update hrmresource set loginid='" + staffCode + "_cf_" + status5count + "',workcode='" + staffCode + "_cf_" + status5count + "' where id = " + user_id + " and status = 5 " ;
String upsql = " update hrmresource set loginid='" + staffCode + "_cf_" + status5count + "',workcode='" + staffCode + "_cf_" + status5count + "' where id = " + user_id + " " ;
bb . writeLog ( "upsql-M:" + upsql ) ;
loginList . add ( upsql ) ;
status5count + + ;
@ -2549,4 +2534,5 @@ public class RocketmqUtil {
return rs . getInt ( "ordee" ) - 1 ;
}
}