支行名称改为关联sys_dept表获取

This commit is contained in:
CYQ 2025-10-21 16:45:38 +08:00
parent 4009c675c4
commit 0f7bff9922

View File

@ -36,72 +36,74 @@ public class MarketingValidInvalidProcessor extends AbstractBusinessProcessor {
// 插入营销人员信息与经办人员不重复的 // 插入营销人员信息与经办人员不重复的
String insertSql = String insertSql =
"INSERT INTO marketing_valid_invalid ( " + "INSERT INTO marketing_valid_invalid ( " +
" branch_name " + " branch_name " +
" ,employee_name " + " ,employee_name " +
" ,marketing_code " + " ,marketing_code " +
" ,customer_name " + " ,customer_name " +
" ,customer_id " + " ,customer_id " +
" ,invalid_business " + " ,invalid_business " +
" ,valid_business " + " ,valid_business " +
" ,check_flag " + " ,check_flag " +
" ,tenant_id " + " ,tenant_id " +
" ,create_dept " + " ,create_dept " +
" ,create_by " + " ,create_by " +
" ,create_time " + " ,create_time " +
" ,record_month " + " ,record_month " +
")( " + ")( " +
"select " + "select " +
" dept_name " + " e.dept_name " +
" ,jb_name " + " ,a.jb_name " +
" ,jb_id " + " ,a.jb_id " +
" ,cust_name " + " ,a.cust_name " +
" ,cust_id " + " ,a.cust_id " +
" ,CASE " + " ,CASE " +
" WHEN check_flag='9' " + " WHEN check_flag='9' " +
" then subcategory_name " + " then subcategory_name " +
" ELSE '' " + " ELSE '' " +
" END " + " END " +
" ,CASE " + " ,CASE " +
" WHEN check_flag='1' " + " WHEN check_flag='1' " +
" then subcategory_name " + " then subcategory_name " +
" ELSE '' " + " ELSE '' " +
" END " + " END " +
" ,check_flag " + " ,check_flag " +
" ,b.tenant_id " + " ,b.tenant_id " +
" ,b.dept_id " + " ,b.dept_id " +
" ,b.user_id " + " ,b.user_id " +
" ,? " + " ,? " +
" ,? " + " ,? " +
"from mps_market a " + "from mps_market a " +
"INNER JOIN sys_user b ON a.jb_id = b.mkt_no AND b.del_flag = '0' " + "INNER JOIN sys_user b ON a.jb_id = b.mkt_no AND b.del_flag = '0' " +
"where SUBSTR(a.entry_date,1,7)=? and a.del_flag='0' and a.check_flag<>'0' " + "left join sys_dept e ON b.dept_id = e.dept_id " +
"union " + "where SUBSTR(a.entry_date,1,7)=? and a.del_flag='0' and a.check_flag<>'0' " +
"select " + "union " +
" dept_name " + "select " +
" ,yx_name " + " e.dept_name " +
" ,yx_id " + " ,a.yx_name " +
" ,cust_name " + " ,a.yx_id " +
" ,cust_id " + " ,a.cust_name " +
" ,CASE " + " ,a.cust_id " +
" WHEN check_flag='9' " + " ,CASE " +
" then subcategory_name " + " WHEN check_flag='9' " +
" ELSE '' " + " then subcategory_name " +
" END " + " ELSE '' " +
" ,CASE " + " END " +
" WHEN check_flag='1' " + " ,CASE " +
" then subcategory_name " + " WHEN check_flag='1' " +
" ELSE '' " + " then subcategory_name " +
" END " + " ELSE '' " +
" ,check_flag " + " END " +
" ,b.tenant_id " + " ,check_flag " +
" ,b.dept_id " + " ,b.tenant_id " +
" ,b.user_id " + " ,b.dept_id " +
" ,? " + " ,b.user_id " +
" ,? " + " ,? " +
"from mps_market a " + " ,? " +
"INNER JOIN sys_user b ON a.yx_id = b.mkt_no AND b.del_flag = '0' " + "from mps_market a " +
"where SUBSTR(a.entry_date,1,7)=? and a.del_flag='0' and a.check_flag<>'0'" + "INNER JOIN sys_user b ON a.yx_id = b.mkt_no AND b.del_flag = '0' " +
"left join sys_dept e ON b.dept_id = e.dept_id " +
"where SUBSTR(a.entry_date,1,7)=? and a.del_flag='0' and a.check_flag<>'0' " +
")"; ")";
Timestamp now = Timestamp.valueOf(LocalDateTime.now()); Timestamp now = Timestamp.valueOf(LocalDateTime.now());