MQ接口逻代码修改1226

main
fage 1 year ago
parent 15045e06bc
commit ea2400a772

@ -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<String> 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<String> getDeptMatrixColumns( String DBName){
Set<String> 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;
}
}

Loading…
Cancel
Save