diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java index c01f05b43..abdf2118a 100644 --- a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java +++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java @@ -336,16 +336,22 @@ public class InsertCustomerHistoryInfo { "select '' as customerid,cf.name as customername,cf.CERTTYPE,cf.certid,'共同承租人' as customertype,'' as customer_num,cf.FLOWUNID,cf.PROJECT_ID from customer_family_temp cf where cf.FLOWUNID = '" + flowunid + "'\n"; List> customerinfo = conn.executeQuery(sql); - String certid = ""; - List> cfinfo = new ArrayList<>(); + String certids = ""; + + for (int i = 0; i < customerinfo.size(); i++) { + if(customerinfo.size()==i+1){ + certids = certids+"'"+customerinfo.get(i).get("certid")+"'"; + }else { + certids = certids+"'"+customerinfo.get(i).get("certid")+"'"+","; + } + } //避免项目的历史客户信息重复录入 - for (int i = customerinfo.size()-1; i >= 0; i--) { - String cfsql = "select id from customer_history_info_temp where certid <> '"+customerinfo.get(i).get("certid")+"' and flowunid = '"+customerinfo.get(i).get("flowunid")+"'"; - cfinfo = conn.executeQuery(cfsql); + String cfsql = "select id from customer_history_info_temp where certid not in ("+certids+") and flowunid = '"+flowunid+"'"; + List> cfinfo = conn.executeQuery(cfsql); + - } if(cfinfo.size()>0){ for (int i = 0; i < cfinfo.size(); i++) {