系统明细表逻辑删除问题优化

This commit is contained in:
Administrator 2025-04-29 15:36:03 +08:00
parent 76134a3d8b
commit e3ed457b0a
2 changed files with 22 additions and 48 deletions

View File

@ -219,7 +219,7 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
userInfo_new.put("USER", getIgnoreCase(employee_info, "id"));
userInfo_new.put("FORM_DATA",getIgnoreCase(employee_info, "id"));
//学位字段
userInfo_new.put("DEGREE",containsKeyIgnoreCase(employee_info,"degreename")?getIgnoreCase(employee_info, "degreename"):null);
//userInfo_new.put("DEGREE",containsKeyIgnoreCase(employee_info,"degreename")?getIgnoreCase(employee_info, "degreename"):null);
userInfo_new.put("CREATE_TIME",nowData);
userInfo_new.put("update_time",nowData);
//插入
@ -582,16 +582,9 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
*/
public void updateAllYgxxDetailInfo(String ygxxid){
log.error("updateAllYgxxDetailInfo.ygxxid:{}", ygxxid);
//先查询表明有记录
String str = "select * from hr_employment_record where USER_ID = '" + ygxxid + "' ";
List<Map<String, Object>> strInfo = getYgxxDetailInfo(str);
log.error("getYgxxDetailInfo.strInfo:{}", strInfo);
//先删除原来记录只能逻辑删除更新时间也必须加上
String sql = "update hr_employment_record set delete_type = 1,update_time =? where USER_ID = ? ";
List<String> paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
String sql = "update hr_employment_record set delete_type = 1,update_time ='" + nowData + "' where USER_ID = "+ygxxid ;
deleteDetailData(sql);
/**
* 工作履历表
* */
@ -626,23 +619,16 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
/**
* 教育经历表
* */
//先查询表明有记录
str = "select * from hr_education where employee_id = '" + ygxxid + "' ";
List<Map<String, Object>> str2Info = getYgxxDetailInfo(str);
log.error("getYgxxDetailInfo.str2Info:{}", str2Info);
//先删除原来记录
sql = "update hr_education set delete_type = 1,update_time =? where employee_id = ? ";
paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
sql = "update hr_education set delete_type = 1,update_time ='" + nowData + "' where employee_id = "+ygxxid;
deleteDetailData(sql);
String jysql = "select * from uf_jcl_emp_jyjl where FORM_DATA_ID = '" + ygxxid + "' and delete_type=0";
List<Map<String, Object>> jyjlInfo = getYgxxDetailInfo(jysql);
List<Map<String, Object>> jyjlColumns = getTableColumnsOfTableName("hr_education");
List<String> listOfjyjlColumns = jyjlColumns.stream()
.map(map -> map.get("column_name").toString())
.collect(Collectors.toList());
log.error("getYgxxDetailInfo.jyjlInfo:{}", jyjlInfo);
log.error("getYgxxDetailInfo.jyjlInfo0172:{}", jyjlInfo);
log.error("getYgxxDetailInfo.listOfjyjlColumns:{}", listOfjyjlColumns);
for (Map<String, Object> map : jyjlInfo) {
Map<String, Object> jyjlInfo_new = new HashMap<>();
@ -668,11 +654,8 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
* 家庭信息表
* */
//先删除原来记录
sql = "update hr_family set delete_type = 1,update_time =? where employee_id = ? ";
paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
sql = "update hr_family set delete_type = 1,update_time ='" + nowData + "' where employee_id = "+ygxxid;
deleteDetailData(sql);
String jtxxsql = "select * from uf_jcl_emp_jtxx where FORM_DATA_ID = '" + ygxxid + "' and delete_type=0";
List<Map<String, Object>> jtxxInfo = getYgxxDetailInfo(jtxxsql);
List<Map<String, Object>> jtxxColumns = getTableColumnsOfTableName("hr_family");
@ -705,11 +688,8 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
* 表彰与奖励
* */
//先删除原来记录
sql = "update hr_rewards_before set delete_type = 1,update_time =? where Employeeid = ? ";
paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
sql = "update hr_rewards_before set delete_type = 1,update_time ='" + nowData + "' where Employeeid = "+ygxxid;
deleteDetailData(sql);
String bzsql = "select * from uf_jcl_emp_bzyjl where FORM_DATA_ID = '" + ygxxid + "' and delete_type=0";
List<Map<String, Object>> bzInfo = getYgxxDetailInfo(bzsql);
List<Map<String, Object>> bzColumns = getTableColumnsOfTableName("hr_rewards_before");
@ -742,11 +722,8 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
* 培训经历
* */
//先删除原来记录
sql = "update hr_train set delete_type = 1,update_time =? where employee_id = ? ";
paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
sql = "update hr_train set delete_type = 1,update_time ='" + nowData + "' where employee_id = "+ygxxid;
deleteDetailData(sql);
String pxsql = "select * from uf_jcl_emp_pxjl where FORM_DATA_ID = '" + ygxxid + "' and delete_type=0";
List<Map<String, Object>> pxInfo = getYgxxDetailInfo(pxsql);
List<Map<String, Object>> pxColumns = getTableColumnsOfTableName("hr_train");
@ -779,11 +756,8 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
* 语言能力
* */
//先删除原来记录
sql = "update hr_language set delete_type = 1,update_time =? where employee_id = ? ";
paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
sql = "update hr_language set delete_type = 1,update_time ='" + nowData + "' where employee_id = "+ygxxid;
deleteDetailData(sql);
String yysql = "select * from uf_jcl_emp_yynl where FORM_DATA_ID = '" + ygxxid + "' and delete_type=0";
List<Map<String, Object>> yyInfo = getYgxxDetailInfo(yysql);
List<Map<String, Object>> yyColumns = getTableColumnsOfTableName("hr_language");
@ -816,11 +790,8 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
* 权威机构资格
* */
//先删除原来记录
sql = "update hr_certification set delete_type = 1,update_time =? where employee_id = ? ";
paramList = new ArrayList<>();
paramList.add(nowData);
paramList.add(ygxxid);
deleteDetailData(sql,paramList);
sql = "update hr_certification set delete_type = 1,update_time ='" + nowData + "' where employee_id = "+ygxxid;
deleteDetailData(sql);
String qwsql = "select * from uf_jcl_emp_qwjgzgrz where FORM_DATA_ID = '" + ygxxid + "' and delete_type=0";
List<Map<String, Object>> qwInfo = getYgxxDetailInfo(qwsql);
List<Map<String, Object>> qwColumns = getTableColumnsOfTableName("hr_certification");
@ -1073,8 +1044,8 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa
* 删除系统明细表数据
* @return
*/
public void deleteDetailData(String sql,List<String> paramList){
log.error("deleteDetailData.sql:{}paramList{}", sql, paramList);
public void deleteDetailData(String sql){
log.error("deleteDetailData888.sql:{}", sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
log.error("deleteDetailData.recordList:{}", recordList);

View File

@ -111,7 +111,10 @@ public class DatabaseUtils {
*/
public List<Map<String, Object>> getDataSourceList(Map<String, Object> map) {
List<Map<String, Object>> entity = new ArrayList();
if ("OK".equals(com.weaver.seconddev.jcl.organization.util.CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT)) && map.get("count") != null && CommonUtils.getIntValue(map.get("count")) > 0) {
if ("OK".equals(com.weaver.seconddev.jcl.organization.util.CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))
&& map.get("count") != null
&& CommonUtils.getIntValue(map.get("count")) > 0
&& map.get("records") != null) {
entity = (List) map.get("records");
}