diff --git a/src/weaver/interfaces/dito/mq/RocketmqUtil.java b/src/weaver/interfaces/dito/mq/RocketmqUtil.java index dedb0aa2..7a794234 100644 --- a/src/weaver/interfaces/dito/mq/RocketmqUtil.java +++ b/src/weaver/interfaces/dito/mq/RocketmqUtil.java @@ -938,6 +938,9 @@ public class RocketmqUtil { JSONObject jsonObject = jsonArray.getJSONObject(i); String postCode = Util.null2String(jsonObject.get("postCode")); + String postName = Util.null2String(jsonObject.get("postName")); + String DBName = PropBean.getUfPropValue("DBName"); + Set stringSet = getDeptMatrixColumns(DBName); if(postCode.startsWith("MSS_CTO")) { @@ -985,6 +988,13 @@ public class RocketmqUtil { { if("A".equals(actType) || "M".equals(actType)) { + if(StringUtils.isNotEmpty(postName)) { + postName = postName.toLowerCase().replaceAll("\\s+", ""); + if(stringSet.contains(postName)){ + String sql = "update matrixtable_2 set "+postName+"=? where id=?"; + rs.executeUpdate(sql,new Object[]{userId,departmentId}); + } + } //当岗位为主岗位时才更新,1:主岗位 // if ("1".equals(defaultFlag)){ String updateUserJobSql = " update hrmresource set jobtitle=?,modified=?,modifier=? where id=? "; @@ -1011,6 +1021,13 @@ 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=?"; + rs.executeUpdate(sql,new Object[]{departmentId}); + } + } jobtitlesId = null; String updateUserJobSql = " update hrmresource set jobtitle=?,modified=?,modifier=? where id=? "; bb.writeLog("updateUserJobSql:"+updateUserJobSql); @@ -2216,4 +2233,24 @@ public class RocketmqUtil { return datas; } + /** + * 获取 部门矩阵表列 + * @return + * String DBName = PropBean.getUfPropValue("DBName"); + */ + public static Set getDeptMatrixColumns( String DBName){ + Set set = new HashSet<>(); + RecordSet rs = new RecordSet(); + rs.executeQuery("SELECT COLUMN_NAME FROM information_schema.COLUMNS " + + " WHERE TABLE_SCHEMA = '"+ DBName +"' " + + " AND TABLE_NAME = 'matrixtable_2'"); + while(rs.next()){ + String columnName = Util.null2String(rs.getString("COLUMN_NAME")); + // 全部转化为 小写存储 + columnName = columnName.toLowerCase().replaceAll("\\s+", ""); + set.add(columnName); + } + return set; + } + }