#EC_HJ155# 人员MQ同步优化接口、大数据MQ优化

main
shilei 1 year ago
parent 6f60ece698
commit 15045e06bc

@ -107,6 +107,7 @@ public class HrmRocketmqUtil {
dataMap.put("syndate",nowDateTime);
dataMap.put("reqmessage",jsonObject.toJSONString());
dataMap.put("reqobject",datasObject.toJSONString());
dataMap.put("systable","hrmresource");
dataMap.put("zxyj",sql);
dataMap.put("zxcs",convertObject2String(objects));
@ -116,7 +117,8 @@ public class HrmRocketmqUtil {
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("syndate",nowDateTime);
dataMap.put("reqmessage",datasObject.toJSONString());
dataMap.put("reqmessage",jsonObject.toJSONString());
dataMap.put("reqobject",datasObject.toJSONString());
dataMap.put("systable","hrmresource");
dataMap.put("errmessage","入参参数personno、managerno在cus_fielddata查询为空");
dataMap.put("personno",personno);
@ -127,7 +129,8 @@ public class HrmRocketmqUtil {
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("syndate",nowDateTime);
dataMap.put("reqmessage",datasObject.toJSONString());
dataMap.put("reqmessage",jsonObject.toJSONString());
dataMap.put("reqobject",datasObject.toJSONString());
dataMap.put("systable","hrmresource");
dataMap.put("errmessage","入参参数personno、managerno未空");
recordErrorData(dataMap);
@ -137,7 +140,8 @@ public class HrmRocketmqUtil {
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("syndate",nowDateTime);
dataMap.put("reqmessage",datasObject.toJSONString());
dataMap.put("reqmessage",jsonObject.toJSONString());
dataMap.put("reqobject",datasObject.toJSONString());
dataMap.put("systable","hrmresource");
dataMap.put("errmessage","入参参数status不为1");
dataMap.put("personno",personno);
@ -149,7 +153,7 @@ public class HrmRocketmqUtil {
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("syndate",nowDateTime);
dataMap.put("reqmessage",masterInfoObject.toJSONString());
dataMap.put("reqmessage",jsonObject.toJSONString());
dataMap.put("systable","hrmresource");
dataMap.put("errmessage","入参参数缺少datas");
recordErrorData(dataMap);
@ -207,14 +211,24 @@ public class HrmRocketmqUtil {
String errmessage = Util.null2String(dataMap.get("errmessage"));
String systable = Util.null2String(dataMap.get("systable"));
String reqobject = Util.null2String(dataMap.get("reqobject"));
if(!reqobject.contains("\\\"")){
reqobject = reqobject.replace("\"","\"");
}
String zxyj = Util.null2String(dataMap.get("zxyj"));
String zxcs = Util.null2String(dataMap.get("zxcs"));
String zxjg = Util.null2String(dataMap.get("zxjg"));
String personno = Util.null2String(dataMap.get("personno"));
if(!reqmessage.contains("\\\"")){
reqmessage = reqmessage.replace("\"","\"");
}
int bool = 0;
sql =" insert into "+uftable+"(uuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,syndate,reqmessage,errmessage,systable)" +
" values(?,?,?,?,?,?,?,?,?,?)" ;
boolean flag = rs.executeUpdate(sql,new Object[]{uuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,syndate,reqmessage,errmessage,systable});
sql =" insert into "+uftable+"(uuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,syndate,reqmessage,errmessage,systable,reqobject,zxyj,zxcs,zxjg,personno)" +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
boolean flag = rs.executeUpdate(sql,new Object[]{uuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,syndate,reqmessage,errmessage,systable,reqobject,zxyj,zxcs,zxjg,personno});
bb.writeLog("sql;"+sql);
if(flag){
bool++;

@ -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,staffCodenew,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, sysUserId, scope,scopeid,userid} ;
Object[] objects = new Object[]{staffId, eId, scope,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("MQError"),0);
if(code<0){
int code = Util.getIntValue(PropBean.getUfPropValue("MQMessageType"),0);
if(code>0){
MessageType messageType = MessageType.newInstance(code); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<String>(); // 接收人id 必填
userIdList.add("1");

Loading…
Cancel
Save