Merge remote-tracking branch 'origin/release20211231' into release20211231

This commit is contained in:
zhanglei 2023-09-19 19:58:24 +08:00
commit 2834907249
2 changed files with 48 additions and 0 deletions

View File

@ -49,6 +49,8 @@
<script type="text/javascript">
window.onload=function(){
AsControl.RunJavaMethodTrans("com.tenwa.voucher.CreateVoucherProcess.InsertCustomerHistoryInfo","InsertCustomerHistoryInfoTemp","flowunid=<%=flowunid%>");
//去除录入后又删除的数据
AsControl.RunJavaMethodTrans("com.tenwa.voucher.CreateVoucherProcess.InsertCustomerHistoryInfo","InsertCustomerHistoryInfo","flowunid=<%=flowunid%>");
}
</script>
<%@ include file="/IncludeEnd.jsp"%>

View File

@ -11,6 +11,7 @@ import com.tenwa.reckon.util.Conn;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -321,4 +322,49 @@ public class InsertCustomerHistoryInfo {
}
public void InsertCustomerHistoryInfo(JBOTransaction tx) throws Exception{
try {
tx= JBOFactory.createJBOTransaction();
Conn conn = new Conn(tx);
String flowunid = this.flowunid;
//获取客户基本信息
String sql = "select ci.customerid,ci.customername,ci.certtype,ci.certid,'主承租人' as customertype,ci.customer_num,lul.FLOWUNID,lul.project_id from customer_info ci left join lb_union_lessee_temp lul on lul.customer_id = ci.customerid where lul.IS_MAIN = 'Y' and lul.FLOWUNID = '" + flowunid + "' \n" +
"union \n" +
"select lgu.ASSUROR as customerid,lgu.FULLNAME as customername,lgu.CERTTYPE,lgu.certid,'担保人' as customertype,'' as customer_num,lgu.FLOWUNID,lgu.project_id from lb_guarantee_unit_temp lgu where lgu.FLOWUNID = '" + flowunid + "'\n" +
"union \n" +
"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<Map<String, String>> customerinfo = conn.executeQuery(sql);
String certid = "";
List<Map<String, String>> cfinfo = new ArrayList<>();
//避免项目的历史客户信息重复录入
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);
}
if(cfinfo.size()>0){
for (int i = 0; i < cfinfo.size(); i++) {
String id = cfinfo.get(i).get("id");
Transaction sqlca = Transaction.createTransaction(tx);
//删除客户历史信息表多余信息
String ssql = "delete from CUSTOMER_HISTORY_INFO_TEMP where id = '"+id+"'";
SqlObject sqlObject = new SqlObject(ssql);
sqlca.executeSQL(sqlObject);
tx.commit();
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}