@ -1641,9 +1641,10 @@ public class RocketmqUtil {
recordErrorData ( dataMap ) ;
} else if ( "D" . equals ( actType ) ) {
status = "5" ;
String userUpdateSql = " update hrmresource set status=? where workcode=? " ;
String staffCodenew = loginid + "_cf_0" ;
String userUpdateSql = " update hrmresource set status=?,loginid=?,workcode=? where id=? " ;
Object [ ] objects = new Object [ ] { status , staffCode } ;
Object [ ] objects = new Object [ ] { status , staffCode new, staffCodenew , userid } ;
bb . writeLog ( "userUpdateSql:" + userUpdateSql ) ;
boolean flag = rs . executeUpdate ( userUpdateSql , objects ) ;
@ -1677,12 +1678,13 @@ public class RocketmqUtil {
if ( status1count = = 0 ) {
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id,status from hrmresource where (loginid = '" + staffCode + "' or loginid like '" + staffCode + "_cf%') and status = 5" ;
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 ;
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 + + ;
@ -1764,12 +1766,12 @@ public class RocketmqUtil {
{
int status5count = 0 ;
List < String > loginList = new ArrayList < String > ( ) ;
sql = " select id from hrmresource where loginid = '"+ staffCode + " ' and status = 5" ;
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 ;
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 + + ;
@ -1839,13 +1841,102 @@ public class RocketmqUtil {
String context = "人员staffname:" + staffName + ",staffcode:" + staffCode + "的员工在系统中已存在, 操作类型为A, 请检查数据" ;
recordErrorMessage ( staffCode , context ) ;
}
} else if ( "M" . equalsIgnoreCase ( actType ) ) {
int status1count = 0 ;
sql = " select id from hrmresource where loginid = '" + staffCode + "' and status in(0,1,2,3) " ;
bb . writeLog ( "staff-M-sql:" + sql ) ;
rs . executeQuery ( sql ) ;
if ( rs . next ( ) ) {
status1count + + ;
}
bb . writeLog ( "staff-M-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-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 " ;
bb . writeLog ( "upsql-M:" + upsql ) ;
loginList . add ( upsql ) ;
status5count + + ;
}
bb . writeLog ( "staff-M-status5count:" + status5count ) ;
if ( status5count > 0 ) {
for ( String upsql : loginList ) {
boolean isTrue = rs . executeUpdate ( upsql ) ;
bb . writeLog ( "isTrue-M:" + isTrue ) ;
}
}
rs . executeProc ( "HrmResourceMaxId_Get" , "" ) ;
rs . next ( ) ;
String id = "" + rs . getInt ( 1 ) ;
bb . writeLog ( "id-M:" + 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-M:" + userInsertSql ) ;
boolean flag = rs . executeUpdate ( userInsertSql , objects ) ;
bb . writeLog ( "flag-M:" + 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" , "人员M新增SQL执行成功" ) ;
} else {
dataMap . put ( "errmessage" , "人员M新增SQL执行错误" ) ;
}
recordErrorData ( dataMap ) ;
}
} else {
bb . writeLog ( "staff-M-status1count:" + 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 + "的员工现为在职, 无法进行M新增, 操作类型为M" ) ;
dataMap . put ( "systable" , tableName ) ;
recordErrorData ( dataMap ) ;
String context = "人员staffname:" + staffName + ",staffcode:" + staffCode + "的员工在系统中已存在, 操作类型为M新增, 请检查数据" ;
recordErrorMessage ( staffCode , context ) ;
}
} else {
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" , "人员在系统中不存在, 操作类型为M或者D" ) ;
dataMap . put ( "errmessage" , "人员在系统中不存在,操作类型为 D") ;
dataMap . put ( "systable" , tableName ) ;
recordErrorData ( dataMap ) ;
@ -1862,10 +1953,10 @@ public class RocketmqUtil {
seqorder = Util . null2String ( rs . getString ( "seqorder" ) ) ;
}
if ( StringUtils . isNotEmpty ( seqorder ) ) {
String cusUpdateSql = " update cus_fielddata set " + cus_staff + "=?," + cus_eid + "=? ,"+ cus_sysuserid + "=? where scope=? and scopeid=? and id=?";
String cusUpdateSql = " update cus_fielddata set " + cus_staff + "=?," + cus_eid + "=? where scope=? and scopeid=? and id=?";
bb . writeLog ( cusUpdateSql ) ;
Object [ ] objects = new Object [ ] { staffId , eId , s ysUserId, s cope, scopeid , userid } ;
Object [ ] objects = new Object [ ] { staffId , eId , s cope, scopeid , userid } ;
boolean deflag = rs . executeUpdate ( cusUpdateSql , objects ) ;
Map < String , String > dataMap = new HashMap < String , String > ( ) ;
@ -2046,8 +2137,8 @@ public class RocketmqUtil {
BaseBean bb = new BaseBean ( ) ;
bb . writeLog ( "recordErrorMessage" ) ;
try {
int code = Util . getIntValue ( PropBean . getUfPropValue ( "MQ Error ") , 0 ) ;
if ( code < 0 ) {
int code = Util . getIntValue ( PropBean . getUfPropValue ( "MQ MessageType ") , 0 ) ;
if ( code > 0 ) {
MessageType messageType = MessageType . newInstance ( code ) ; // 消息来源(见文档第四点补充 必填)
Set < String > userIdList = new HashSet < String > ( ) ; // 接收人id 必填
userIdList . add ( "1" ) ;