接口平台

This commit is contained in:
lixuebo 2019-08-18 14:34:29 +08:00
parent 7e7523a4f3
commit e323f686ef
9 changed files with 362 additions and 243 deletions

View File

@ -17,11 +17,18 @@
String sButtons[][] = {
{"true","All","Button","查看定位信息","查看定位信息","queryOrder()","","","","",""},
{"true","","Button","查看安装图","查看安装图","showImage()","","","","",""},
{"true","","Button","提交流程","提交流程","test()","","","","",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<link rel="stylesheet" href="<%=sWebRootPath%>/js/viewpicture/css/viewer.min.css">
<script type="text/javascript">
function test(){
//var sParams="ApplyType=BusinessApplyApply,CurUserID=8006U00000001,ProductId=H01-C01-X-001-WYC,ProductName=北汽新能源网约车,CustomerType=03,carAttributes=new_car,leasehold=01,carSystem=2017款 奥迪TT(进口) TTS Roadster 2.0 TFSI quattro,custname=测试自动发起流程,certtype=Ind01,certid=110101199003075170,CustomerId=,productModel=奥迪,carSeries=奥迪TT(进口),versionid=V1.0,modelid=1128682,businessType=1,price=634800,liter=2.0T,geartype=自动,sourcetype=web,operationType=AMPLE";
var sParams="submitFlowunid=FBO2019070300000005,submitFlowNo=BusinessApplyFlow,submitUserId=8006U00000001,submitTask=0030";
AsControl.RunJavaMethodTrans("com.tenwa.flow.action.comm.BaseFlowStartAction","submitFlow",sParams);
}
function queryOrder(){
var orderNo = getItemValue(0,getRow(),"ORDER_NO");
if(undefined==orderNo){alert("请选择一行");return;}

View File

@ -2438,7 +2438,7 @@
<attribute name="owner" label="电话所有人" type="STRING" length="10"/>
<attribute name="inputtime" label="登记时间" type="STRING" length="32"/>
<attribute name="updatetime" label="更新时间" type="STRING" length="32"/>
<attribute name="flowunid" label="流程标识" type="STRING" length="32"/>
<attribute name="FLOWUNID" label="流程标识" type="STRING" length="32"/>
<attribute name="FULLADDRESS" label="地址全名" type="STRING" length="400"/>
</attributes>
<manager>
@ -2707,6 +2707,7 @@
<attribute name="business_income" label="企业年主营业务收入" type="STRING" length="100"/>
<attribute name="unit_properties" label="单位性质" type="STRING" length="100"/>
<attribute name="company_properties" label="集团性质" type="STRING" length="16"/>
<attribute name="FLOWUNID" label="流程标识" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
@ -2747,6 +2748,7 @@
<attribute name="PROJECT_ID" label="项目编号" type="STRING" length="32"/>
<attribute name="ASSURE_RELATION" label="关系" type="STRING" length="10"/>
<attribute name="SEX" label="性别" type="STRING" length="3"/>
<attribute name="FLOWUNID" label="流程标识" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
@ -2851,6 +2853,7 @@
<attribute name="spnumber" label="手机号——配偶" type="STRING" length="32"/>
<attribute name="smincome" label="月收入——配偶" type="DOUBLE" length="22" scale="2"/>
<attribute name="e_mail" label="电邮" type="STRING" length="32"/>
<attribute name="FLOWUNID" label="流程标识" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>

View File

@ -282,4 +282,15 @@ public class NameManager
}*/
return lastTime;
}
/*//鳳龰華硊靡備
public static String getItemName(String codeno,String AddressCode) throws Exception{
if("".equals(AddressCode))
return "";
JBOTransaction tx = JBOFactory.createJBOTransaction();
Transaction Sqlca = Transaction.createTransaction(tx);
String addressName = Sqlca.getString("select cl.itemname from code_library cl where cl.codeno='"+codeno+"' and cl.itemno='"+AddressCode+"'");
Sqlca.disConnect();
return addressName;
}*/
}

View File

@ -5,12 +5,14 @@ import java.util.List;
import java.util.Map;
import apx.com.amarsoft.als.base.flow.FlowTask;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.app.flow.FlowAction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import jbo.com.tenwa.entity.comm.flow.FLOW_WORK_FLAG;
import jbo.sys.FLOW_OBJECT;
@ -18,6 +20,7 @@ import jbo.sys.FLOW_TASK;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
@ -173,11 +176,14 @@ public class BaseFlowStartAction extends FlowBussionAction {
public void setSubmitUserId(String submitUserId) {
this.submitUserId = submitUserId;
}
//接口平台提交流程方法
public String submitFlow(JBOTransaction tx){
public String submitFlow(){
JBOTransaction tx = null;
try {
//开始根据参数提交指定步骤
String submitTask = this.getSubmitTask();
tx = JBOFactory.createJBOTransaction();
Transaction tran = Transaction.createTransaction(tx);
String taskNo = tran.getString("SELECT SERIALNO FROM FLOW_TASK WHERE objectno='"+submitFlowunid+"' and flowno='"+submitFlowNo+"' ORDER BY begintime DESC LIMIT 1");
//执行需要提交的步骤
@ -200,8 +206,15 @@ public class BaseFlowStartAction extends FlowBussionAction {
flowAction.setPhaseAction(obj.getString("userinfo").replaceAll(","," "));
}
flowAction.submit( tx );
tx.commit();
return "success@"+submitFlowunid;
} catch (Exception e) {
try {
tx.rollback();
tx.commit();
} catch (JBOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
return "error_message";
}

View File

@ -2,30 +2,25 @@ package com.tenwa.flow.action.comm;
import com.amarsoft.awe.util.JavaMethod;
import com.amarsoft.context.ASUser;
import fr.opensagres.xdocreport.core.utils.Base64Utility;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.stereotype.Controller;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
@Controller
public class FlowController extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
private static final long serialVersionUID = -8195828333793281342L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
this.doGet(request, response);
}
/**
* 共需要传递几个基础参数
* ClassName: 用于查找需要执行的startAction
@ -40,31 +35,45 @@ public class FlowController extends HttpServlet {
response.setDateHeader( "Expires", 0L );
response.setCharacterEncoding( "UTF-8" );
PrintWriter out = response.getWriter();
Map<String, Object> result = new HashMap<>();
String sClassName = request.getParameter( "ClassName" );
String type = request.getParameter( "type" );
//发起流程固定initFLow
String sMethodName = "interfaceInitFlow";
String curUserID = request.getParameter("CurUserID");
String sArgs = request.getParameter("Args");
String result;
try {
if ( sArgs == null ) {
sArgs = "";
} else {
sArgs += getFixedFlowParam( sArgs );
String sResult = null;
if("new".equals(type)){
String sClassName = request.getParameter( "ClassName" );
String curUserID = request.getParameter("CurUserID");
String sArgs = request.getParameter("Args");
if ( sArgs == null ) {
sArgs = "";
} else {
sArgs += getFixedFlowParam( sArgs );
}
ASUser CurUser = ASUser.getUser(curUserID, null );
sResult = JavaMethod.runTrans( sClassName, sMethodName, sArgs, CurUser ).getReturnText();
if (sResult.indexOf("success")==-1) {
throw new Exception( "发起流程失败" );
}
}else if("alter".equals(type)){
BaseFlowStartAction baseFlowStartAction = new BaseFlowStartAction();
baseFlowStartAction.setSubmitFlowunid(request.getParameter("flowunid"));
baseFlowStartAction.setSubmitFlowNo(request.getParameter("flowNo"));
baseFlowStartAction.setSubmitUserId(request.getParameter("userId"));
baseFlowStartAction.setSubmitTask(request.getParameter("submitTask"));
sResult = baseFlowStartAction.submitFlow();
baseFlowStartAction=null;
if (sResult.indexOf("success")==-1) {
throw new Exception( "提交流程失败" );
}
}
ASUser CurUser = ASUser.getUser(curUserID, null );
String sResult = JavaMethod.runTrans( sClassName, sMethodName, sArgs, CurUser ).getReturnText();
if ( sResult.indexOf( "success" ) == -1 ) {
throw new Exception( "·¢ÆðÁ÷³Ìʧ°Ü" );
}
result.put( "data", sResult.split( "@" )[ 1 ] );
result.put( "status", "success" );
result = sResult.split("@")[1];
} catch ( Exception e ) {
e.printStackTrace();
result.put( "status", "error" );
result = "ERR-9999";
}
ObjectMapper objectMapper = new ObjectMapper();
out.print( objectMapper.writeValueAsString( result ) );
out.print(objectMapper.writeValueAsString(result));
out.flush();
out.close();
}

View File

@ -1,17 +1,14 @@
package com.tenwa.lease.flow.project.commbusiness;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP;
import jbo.sys.CODE_LIBRARY;
import jbo.sys.PF_CUSTOMER_ADDRESS;
import jbo.sys.PF_CUSTOMER_FAMILY;
import jbo.sys.PF_CUSTOMER_PERSON;
import jbo.sys.PF_PROJECT_INFO;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.flow.baseBussion.BaseBussiness;
/**

View File

@ -1,26 +0,0 @@
package com.tenwa.lease.flow.project.commbusiness;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.reckon.executor.CreateTransactionExecutor;
/**
* ½Ó¿Úƽ̨×â½ð²âËã
*/
public class HelpToBorrowCalculate extends BaseBussiness {
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
if(this.getAttribute("serial")==null)
return "true";
String serial = this.getAttribute("serial").toString();
//×â½ð²âËã
CreateTransactionExecutor createTransactionExecutor = new CreateTransactionExecutor();
createTransactionExecutor.setCalType("proj_process");
createTransactionExecutor.setFlowunid(this.getAttribute("FlowUnid").toString());
createTransactionExecutor.setPlannumber(this.getAttribute("FlowKey").toString()+"01");
createTransactionExecutor.setProductId(this.getAttribute("ProductId").toString());
createTransactionExecutor.run();
return "true";
}
}

View File

@ -1,13 +1,5 @@
package com.tenwa.lease.flow.project.commbusiness;
import com.amarsoft.app.als.sys.tools.DateUtil;
import com.amarsoft.app.util.ProductParamUtil;
import com.tenwa.util.SerialNumberUtil;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_ADDRESS;
import jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_CERT;
@ -24,39 +16,24 @@ import jbo.app.tenwa.customer.CUSTOMER_TYPE;
import jbo.app.tenwa.customer.CUSTOMER_TYPE_TEMP;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INVOICE_TYPE;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INVOICE_TYPE_HIS;
import jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR_TEMP;
import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE;
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP;
import jbo.prd.PRD_SPECIFIC_LIBRARY;
import jbo.sys.PF_CALC_CONDITION;
import jbo.sys.PF_CUSTOMER_ACCOUNT;
import jbo.sys.PF_GUARANTEE_UNIT;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.dw.ASObjectModel;
import com.amarsoft.awe.dw.ui.validator.ValidateRule;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.context.ASUser;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.flow.util.FlowUtil;
import com.tenwa.reckon.executor.CreateTransactionExecutor;
import com.tenwa.reckon.product.ProductCondition;
import org.apache.commons.lang3.time.DateUtils;
/**
* 项目基本信息初始化
@ -204,144 +181,11 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
this.saveUnionLessee(bmLULT, tx, customerId, asUser);//union表
this.saveProjInfo(bm, tx, asUser,distributoIid,null);//保存项目信息表
this.saveBusinessStatus(bsbom, tx, asUser);//项目进度表
/**接口平台初始化数据*/
if(serial!=null){
//共同申请人
BizObjectManager cftbom = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME, tx);
BizObject cftbo = cftbom.newObject();
cftbo.setAttributeValue("customerid",customerId);
cftbo.setAttributeValue("flowunid",this.getAttribute("FlowUnid"));
cftbo.setAttributeValue("PROJECT_ID",this.getAttribute("ProjectId"));
BusinessApplicationPfToTemp.savePartner(cftbo,cftbom,serial);
//担保人拷表
Map<String, String> fromCondtion = new HashMap<String,String>();
fromCondtion.put("SERIAL",serial);
Map<String, String> otherProperty = new HashMap<String,String>();
otherProperty.put("FLOWUNID",this.getAttribute("FlowUnid").toString());
otherProperty.put("PROJECT_ID",this.getAttribute("ProjectId").toString());
DataOperatorUtil.copyJBOSet(PF_GUARANTEE_UNIT.CLASS_NAME,fromCondtion,LB_GUARANTEE_UNIT_TEMP.CLASS_NAME,null,otherProperty,null,tx);
//扣款卡信息拷表
otherProperty.put("customerid",customerId);
otherProperty.put("acc_info","Debit");
otherProperty.put("acc_type","Debit");
otherProperty.put("CUSTTYPE","lessee");
DataOperatorUtil.copyJBOSet(PF_CUSTOMER_ACCOUNT.CLASS_NAME,fromCondtion,CUSTOMER_ACCOUNT_TEMP.CLASS_NAME,null,otherProperty,null,tx);
//商务条件拷表
String calType = "proj_process";
otherProperty.clear();
otherProperty.put("FLOWUNID",this.getAttribute("FlowUnid").toString());
String planNumber = SerialNumberUtil.getPlannumber(this.getAttribute("ProjectNo").toString(), calType, tx );
otherProperty.put("PROJECT_PLAN_NUMBER", planNumber);
BizObject fcc = DataOperatorUtil.getSingleJBO( PF_CALC_CONDITION.CLASS_NAME, fromCondtion, tx );
String productId = this.getAttribute( "ProductId" ).toString();
// 净融资额
setCleanLeaseMoney( otherProperty, productId, fcc );
// 调息方式
setProductAdjustRules( otherProperty, productId );
// 投放日
String today = DateUtil.getToday();
otherProperty.put( "LEASE_AMT_DATE", today );
otherProperty.put( "START_DATE", today );
// 租金推算方式
otherProperty.put( "RENT_OR_RATE", "rate" );
// 设置年利率
setYearRate( otherProperty, productId );
// 设置还款间隔
setIncomeNubmer( otherProperty, productId, fcc );
// 计算第一第二期租金支付日
setFirstSecondPlan( otherProperty, productId, fcc );
DataOperatorUtil.copyJBOSet(PF_CALC_CONDITION.CLASS_NAME,fromCondtion,LC_CALC_CONDITION_TEMP.CLASS_NAME,null,otherProperty,null,tx);
System.out.println( "=====================" + flowunid + "====================" );
// 自动测算
autoCalc( flowunid, calType, planNumber, productId, tx );
}
}
String sMessage="true";
return sMessage;
}
public void autoCalc( String flowunid, String calType, String planNumber, String productId, JBOTransaction tx ) throws Exception {
CreateTransactionExecutor cte = new CreateTransactionExecutor();
cte.setCalType( calType );
cte.setFlowunid( flowunid );
cte.setPlannumber( planNumber );
cte.setProductId( productId );
cte.runTrans( tx );
}
public void setCleanLeaseMoney( Map<String, String> otherProperty, String productId, BizObject fcc ) throws Exception {
String equipAmt = fcc.getAttribute( "EQUIP_AMT" ).toString();
String firstPayment = fcc.getAttribute( "FIRST_PAYMENT" ).toString();
String gpsFee = fcc.getAttribute( "GPS_FEE" ).toString();
BigDecimal financingMoney = BigDecimal.ZERO;
financingMoney = financingMoney.add( new BigDecimal( "".equals( gpsFee ) ? "0" : gpsFee ) );
// TODO 补充其他融资项
otherProperty.put( "CLEAN_LEASE_MONEY",
new BigDecimal( "".equals( equipAmt ) ? "0" : equipAmt ).subtract(
new BigDecimal( "".equals( firstPayment ) ? "0" : firstPayment ) ).add( financingMoney ).toString() );
}
public void setProductAdjustRules( Map<String, String> otherProperty, String productId ) throws Exception {
Map<String,Map<String,String>> map = ProductParamUtil.getProductComponentType( productId, "PRD0320" );
if ( map.containsKey( "ADJUST_INTEREST" ) ){
Map<String,String> rule=map.get( "ADJUST_INTEREST" );
if ( null != rule.get( "rate_float_type" ) && null != rule.get( "adjust_style" ) ) {
//调息方式
otherProperty.put( "ADJUST_TYPE", rule.get("rate_float_type") );
otherProperty.put( "ADJUST_STYLE", rule.get("adjust_style") );
}
}
}
public void setFirstSecondPlan( Map<String, String> otherProperty, String productId, BizObject fcc ) throws Exception {
String periodType = otherProperty.get( "PERIOD_TYPE" );
String leaseAmtDate = otherProperty.get( "LEASE_AMT_DATE" );
String incomeIntervalMonth = otherProperty.get( "INCOME_INTERVAL_MONTH" );
String defaultDueDay = fcc.getAttribute( "DefaultDueDay" ).toString();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd" );
Date lad = sdf.parse( leaseAmtDate );
lad = DateUtils.setDays( lad, Integer.parseInt( defaultDueDay ) );
String firstPlanDate = "";
String secondPlanDate = "";
if ( "period_type_1".equals( periodType ) ) {
firstPlanDate = leaseAmtDate;
secondPlanDate = sdf.format( DateUtils.addMonths( lad, Integer.parseInt( incomeIntervalMonth ) ) );
} else {
firstPlanDate = sdf.format( DateUtils.addMonths( lad, Integer.parseInt( incomeIntervalMonth ) ) );
secondPlanDate = sdf.format( DateUtils.addMonths( lad, Integer.parseInt( incomeIntervalMonth ) * 2 ) );
}
otherProperty.put( "FIRST_PLAN_DATE", firstPlanDate );
otherProperty.put( "SECOND_PLAN_DATE", secondPlanDate );
}
public void setIncomeNubmer( Map<String, String> otherProperty, String productId, BizObject fcc ) throws Exception {
otherProperty.put( "INCOME_NUMBER_YEAR", "income_12" );
String incomeIntervalMonth = "1";
otherProperty.put( "INCOME_INTERVAL_MONTH", incomeIntervalMonth );
String incomeNumber = fcc.getAttribute( "INCOME_NUMBER" ).toString();
otherProperty.put( "LEASE_TERM", Integer.parseInt( incomeNumber ) * Integer.parseInt( incomeIntervalMonth ) + "" );
}
public void setYearRate( Map<String, String> otherProperty, String productId ) throws Exception {
Map<String, Map<String, String>> productRates = ProductParamUtil.getProductComponentType( productId, "PRD0350" );
Map<String, String> productRate = productRates.get( "product_rate" );
String periodType = ProductParamUtil.getProductParameterValue( productId, "PRD0350", "period_type", "begin_end" );
periodType = periodType == null ? "period_type_0" : periodType;
otherProperty.put( "PERIOD_TYPE", periodType );
if ( productRate != null ) {
String yearRate = productRate.get("ProductRate") == null ? "0" : productRate.get("ProductRate");
otherProperty.put( "YEAR_RATE", yearRate );
}
}
private BizObject saveCustomerInfo(BizObjectManager bomCI,JBOTransaction tx,ASUser asUser,String distributoIid)throws JBOException{
BizObject bmC = bomCI.newObject();//保存客户信息
try {
@ -384,31 +228,6 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
boCRT.setAttributeValue("inputtime", StringFunction.getTodayNow());//登记时间,系统当前时间
if("03".equals(this.getAttribute("CustomerType"))){
boCRT.setAttributeValue("BALANCESHEET", "申请人");
/**接口平台初始化数据*/
if(serial!=null){
//自然人客户基本信息
BusinessApplicationPfToTemp.savePerson(boCRT,serial);
//自然人客户居住地址信息
BizObjectManager bmCA =JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME,tx);
BizObject boCA = bmCA.newObject();
boCA.setAttributeValue("CUSTOMERID",customerId);
boCA.setAttributeValue("flowunid",this.getAttribute("FlowUnid"));
BusinessApplicationPfToTemp.saveCustomerAddress(boCA,serial);
bmCA.saveObject(boCA);
//自然人配偶信息
if("01".equals(boCRT.getAttribute("MARRIAGE").toString())){
BizObjectManager bmCFT =JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME,tx);
BizObject boCFT = bmCFT.newObject();
boCFT.setAttributeValue("CUSTOMERID",customerId);
boCFT.setAttributeValue("flowunid",this.getAttribute("FlowUnid"));
boCFT.setAttributeValue("PROJECT_ID",this.getAttribute("ProjectId"));
BusinessApplicationPfToTemp.saveSpouseInformation(boCFT,serial);
bmCFT.saveObject(boCFT);
}
}
}else{
//法人客户基本信息
BusinessApplicationPfToTemp.saveCompany(boCRT,serial);
}
bomC.saveObject(boCRT);
} catch (Exception e) {
@ -505,10 +324,6 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
bo.setAttributeValue("source_type",this.getAttribute("sourcetype"));//申请类型
bo.setAttributeValue("HaveCommission",haveCommission);
bo.setAttributeValue("is_netcar",isNetCar == null ? "" : isNetCar);
/**接口平台初始化数据*/
if(serial!=null){
BusinessApplicationPfToTemp.saveProjInfo(bo,serial);
}
bomLPI.saveObject(bo);
}catch (Exception e){
tx.rollback();

View File

@ -0,0 +1,290 @@
package com.tenwa.lease.flow.project.commbusiness;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.time.DateUtils;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_COMPANY_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP;
import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
import jbo.sys.PF_CALC_CONDITION;
import jbo.sys.PF_CUSTOMER_ACCOUNT;
import jbo.sys.PF_CUSTOMER_ADDRESS;
import jbo.sys.PF_CUSTOMER_COMPANY;
import jbo.sys.PF_CUSTOMER_FAMILY;
import jbo.sys.PF_CUSTOMER_PERSON;
import jbo.sys.PF_GUARANTEE_UNIT;
import jbo.sys.PF_PROJECT_INFO;
import com.amarsoft.app.als.sys.tools.DateUtil;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.context.ASUser;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.reckon.executor.CreateTransactionExecutor;
import com.tenwa.util.SerialNumberUtil;
/**
* 业务申请阶段接口平台数据拷入临时表
*/
public class PlatformDataToTemp extends BaseBussiness {
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
if(this.getAttribute("serial")==null) return "true";
ASUser asUser=new ASUser(this.getAttribute("CurUserID").toString());
String serial = this.getAttribute("serial").toString();
String flowunid = this.getAttribute("ObjectNo").toString();
String customerId = Sqlca.getString("SELECT customerid FROM customer_info_temp WHERE flowunid='"+flowunid+"'");
String projectId = this.getAttribute("ProjectId").toString();
String customerType = this.getAttribute("CustomerType").toString();
Map<String,String> fromCondtion = new HashMap<String,String>();
Map<String,String> toCondtion = new HashMap<String,String>();
Map<String,String> otherProperty = new HashMap<String,String>();
int number = Integer.valueOf(Sqlca.getString("select count(1) from PF_CUSTOMER_ACCOUNT where flowunid='"+flowunid+"'"));
//判断是新增申请还是修改申请新增申请没有流程编号用流水号查询修改申请有流程编号
fromCondtion.put("SERIAL",serial);
String sqlWhere = " SERIAL = '"+serial+"'";
String bowhere ="SERIAL=:SERIAL";
String boKey = "SERIAL";
String boValue = serial;
if(number>0){
fromCondtion.clear();
fromCondtion.put("FLOWUNID",flowunid);
sqlWhere = " FLOWUNID = '"+flowunid+"'";
bowhere ="FLOWUNID=:FLOWUNID";
boKey = "FLOWUNID";
boValue = flowunid;
}
/**共同申请人拷表和配偶信息*/
otherProperty.put("customerid",customerId);
otherProperty.put("flowunid",flowunid);
otherProperty.put("PROJECT_ID",projectId);
Sqlca.executeSQL(new SqlObject("delete from CUSTOMER_FAMILY_TEMP where flowunid='"+flowunid+"'"));
String sql = "select id from PF_CUSTOMER_FAMILY where "+sqlWhere;
ASResultSet res = Sqlca.getASResultSet(new SqlObject(sql));
while(res.next()){
fromCondtion.put("id",res.getString("id"));
DataOperatorUtil.copySingleJBO(PF_CUSTOMER_FAMILY.CLASS_NAME,fromCondtion,CUSTOMER_FAMILY_TEMP.CLASS_NAME,null,otherProperty,Sqlca);
}
res.close();
fromCondtion.remove("id");
/**自然人客户居住地址信息*/
Sqlca.executeSQL(new SqlObject("delete from CUSTOMER_ADDRESS_TEMP where flowunid='"+flowunid+"'"));
String dressdetail = Sqlca.getString("select dressdetail from PF_CUSTOMER_ADDRESS where "+sqlWhere);
if(!"".equals(dressdetail)&&!"null".equals(dressdetail)){
String province = Sqlca.getString("select province from PF_CUSTOMER_ADDRESS where "+sqlWhere);
String itemname = Sqlca.getString("select itemname from CODE_LIBRARY where codeno='AreaCode' and itemno='"+province+"'");
otherProperty.remove("PROJECT_ID");
otherProperty.put("addtype","0060");
otherProperty.put("isadd","yes");
otherProperty.put("isnew","yes");
otherProperty.put("country","CHN");
otherProperty.put("FULLADDRESS",itemname+dressdetail);
DataOperatorUtil.copySingleJBO(PF_CUSTOMER_ADDRESS.CLASS_NAME,fromCondtion,CUSTOMER_ADDRESS_TEMP.CLASS_NAME,null,otherProperty,Sqlca);
}
/**客户信息拷表*/
otherProperty.clear();
otherProperty.put("flowunid",flowunid);
otherProperty.put("customerid",customerId);
otherProperty.put("CERTTYPE",this.getAttribute("certtype").toString());
otherProperty.put("CERTID",this.getAttribute("certid").toString());
otherProperty.put("INPUTUSERID",asUser.getUserID());
otherProperty.put("INPUTORGID",asUser.getOrgID());
otherProperty.put("inputtime",StringFunction.getTodayNow());
/**判断法人客户还是自然人客户*/
if("03".equals(customerType)){
otherProperty.put("FULLNAME",this.getAttribute("custname").toString());
otherProperty.put("BALANCESHEET","申请人");
Sqlca.executeSQL(new SqlObject("delete from CUSTOMER_PERSON_TEMP where flowunid='"+flowunid+"'"));
DataOperatorUtil.copySingleJBO(PF_CUSTOMER_PERSON.CLASS_NAME,fromCondtion,CUSTOMER_PERSON_TEMP.CLASS_NAME,null,otherProperty,Sqlca);
}else{
Sqlca.executeSQL(new SqlObject("delete from CUSTOMER_COMPANY_TEMP where flowunid='"+flowunid+"'"));
otherProperty.put("company_name",this.getAttribute("custname").toString());
DataOperatorUtil.copySingleJBO(PF_CUSTOMER_COMPANY.CLASS_NAME,fromCondtion,CUSTOMER_COMPANY_TEMP.CLASS_NAME,null,otherProperty,Sqlca);
}
/**项目基本信息拷表*/
BizObjectManager lpitBm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME,Sqlca);
BizObject lpitBo = lpitBm.createQuery("flowunid=:flowunid").setParameter("flowunid",flowunid).getSingleResult(true);
BizObject ppiBo = JBOFactory.createBizObjectQuery(PF_PROJECT_INFO.CLASS_NAME,bowhere).setParameter(boKey,boValue).getSingleResult(false);
lpitBo.setAttributeValue("inputName",ppiBo.getAttribute("inputName").toString());
lpitBo.setAttributeValue("inputTel",ppiBo.getAttribute("inputTel").toString());
lpitBo.setAttributeValue("IS_NETCAR",ppiBo.getAttribute("IS_NETCAR").toString());
if(!"0".equals(ppiBo.getAttribute("IS_NETCAR").toString())){
lpitBo.setAttributeValue("IS_OPERATION",ppiBo.getAttribute("IS_OPERATION").toString());
lpitBo.setAttributeValue("IS_AFFILIATED",ppiBo.getAttribute("IS_AFFILIATED").toString());
lpitBo.setAttributeValue("IS_OPERATION_QUALIFICATION",ppiBo.getAttribute("IS_OPERATION_QUALIFICATION").toString());
lpitBo.setAttributeValue("AFFILIATEDNAME",ppiBo.getAttribute("AFFILIATEDNAME").toString());
lpitBo.setAttributeValue("TRANSPORTCERTID",ppiBo.getAttribute("TRANSPORTCERTID").toString());
lpitBo.setAttributeValue("TRANSPORTDATE",ppiBo.getAttribute("TRANSPORTDATE").toString());
lpitBo.setAttributeValue("NETCERTID",ppiBo.getAttribute("NETCERTID").toString());
lpitBo.setAttributeValue("LEGALPERSONNAME",ppiBo.getAttribute("LEGALPERSONNAME").toString());
lpitBo.setAttributeValue("LEGALPERSONID",ppiBo.getAttribute("LEGALPERSONID").toString());
lpitBo.setAttributeValue("AFFILIATEDDATE",ppiBo.getAttribute("AFFILIATEDDATE").toString());
lpitBo.setAttributeValue("AFFILIATEDENDDATE",ppiBo.getAttribute("AFFILIATEDENDDATE").toString());
lpitBo.setAttributeValue("REGISTEREDMONEY",ppiBo.getAttribute("REGISTEREDMONEY").toString());
lpitBo.setAttributeValue("AFFILIATEDACTUALADDRESS",ppiBo.getAttribute("AFFILIATEDACTUALADDRESS").toString());
lpitBo.setAttributeValue("AFFILIATEDADDRESS",ppiBo.getAttribute("AFFILIATEDADDRESS").toString());
}
lpitBm.saveObject(lpitBo);
/**担保人拷表*/
Sqlca.executeSQL(new SqlObject("delete from LB_GUARANTEE_UNIT_TEMP where flowunid='"+flowunid+"'"));
otherProperty.clear();
otherProperty.put("FLOWUNID",this.getAttribute("FlowUnid").toString());
otherProperty.put("PROJECT_ID",this.getAttribute("ProjectId").toString());
sql = "select id from PF_GUARANTEE_UNIT where "+sqlWhere;
res = Sqlca.getASResultSet(new SqlObject(sql));
while(res.next()){
fromCondtion.put("id",res.getString("id"));
DataOperatorUtil.copyJBOSet(PF_GUARANTEE_UNIT.CLASS_NAME,fromCondtion,LB_GUARANTEE_UNIT_TEMP.CLASS_NAME,null,otherProperty,null,Sqlca);
}
res.close();
fromCondtion.remove("id");
/**扣款卡信息*/
Sqlca.executeSQL(new SqlObject("delete from CUSTOMER_ACCOUNT_TEMP where flowunid='"+flowunid+"'"));
otherProperty.clear();
otherProperty.put("flowunid",flowunid);
otherProperty.put("customerid",customerId);
otherProperty.put("acc_info","Debit");
otherProperty.put("acc_type","Debit");
otherProperty.put("CUSTTYPE","lessee");
DataOperatorUtil.copyJBOSet(PF_CUSTOMER_ACCOUNT.CLASS_NAME,fromCondtion,CUSTOMER_ACCOUNT_TEMP.CLASS_NAME,null,otherProperty,null,Sqlca);
/**商务条件*/
Sqlca.executeSQL(new SqlObject("delete from LC_CALC_CONDITION_TEMP where flowunid='"+flowunid+"'"));
String calType = "proj_process";
otherProperty.clear();
otherProperty.put("FLOWUNID",this.getAttribute("FlowUnid").toString());
String planNumber = SerialNumberUtil.getPlannumber(this.getAttribute("ProjectNo").toString(),calType,Sqlca);
otherProperty.put("PROJECT_PLAN_NUMBER", planNumber);
BizObject fcc = DataOperatorUtil.getSingleJBO(PF_CALC_CONDITION.CLASS_NAME,fromCondtion,Sqlca);
String productId = this.getAttribute( "ProductId" ).toString();
// 净融资额
setCleanLeaseMoney( otherProperty, productId, fcc );
// 调息方式
setProductAdjustRules( otherProperty, productId );
// 投放日
String today = DateUtil.getToday();
otherProperty.put( "LEASE_AMT_DATE", today );
otherProperty.put( "START_DATE", today );
// 租金推算方式
otherProperty.put( "RENT_OR_RATE", "rate" );
// 设置年利率
setYearRate( otherProperty, productId );
// 设置还款间隔
setIncomeNubmer( otherProperty, productId, fcc );
// 计算第一第二期租金支付日
setFirstSecondPlan( otherProperty, productId, fcc );
DataOperatorUtil.copyJBOSet(PF_CALC_CONDITION.CLASS_NAME,fromCondtion,LC_CALC_CONDITION_TEMP.CLASS_NAME,null,otherProperty,null,Sqlca);
System.out.println( "=====================" + flowunid + "====================" );
// 自动测算
autoCalc(flowunid,calType,planNumber,productId,Sqlca);
return "true";
}
public void setCleanLeaseMoney( Map<String, String> otherProperty, String productId, BizObject fcc ) throws Exception {
String equipAmt = fcc.getAttribute( "EQUIP_AMT" ).toString();
String firstPayment = fcc.getAttribute( "FIRST_PAYMENT" ).toString();
String gpsFee = fcc.getAttribute( "GPS_FEE" ).toString();
BigDecimal financingMoney = BigDecimal.ZERO;
financingMoney = financingMoney.add( new BigDecimal( "".equals( gpsFee ) ? "0" : gpsFee ) );
// TODO 补充其他融资项
otherProperty.put( "CLEAN_LEASE_MONEY",
new BigDecimal( "".equals( equipAmt ) ? "0" : equipAmt ).subtract(
new BigDecimal( "".equals( firstPayment ) ? "0" : firstPayment ) ).add( financingMoney ).toString() );
}
public void setProductAdjustRules( Map<String, String> otherProperty, String productId ) throws Exception {
Map<String,Map<String,String>> map = ProductParamUtil.getProductComponentType( productId, "PRD0320" );
if ( map.containsKey( "ADJUST_INTEREST" ) ){
Map<String,String> rule=map.get( "ADJUST_INTEREST" );
if ( null != rule.get( "rate_float_type" ) && null != rule.get( "adjust_style" ) ) {
//调息方式
otherProperty.put( "ADJUST_TYPE", rule.get("rate_float_type") );
otherProperty.put( "ADJUST_STYLE", rule.get("adjust_style") );
}
}
}
public void setYearRate( Map<String, String> otherProperty, String productId ) throws Exception {
Map<String, Map<String, String>> productRates = ProductParamUtil.getProductComponentType( productId, "PRD0350" );
Map<String, String> productRate = productRates.get( "product_rate" );
String periodType = ProductParamUtil.getProductParameterValue( productId, "PRD0350", "period_type", "begin_end" );
periodType = periodType == null ? "period_type_0" : periodType;
otherProperty.put( "PERIOD_TYPE", periodType );
if ( productRate != null ) {
String yearRate = productRate.get("ProductRate") == null ? "0" : productRate.get("ProductRate");
otherProperty.put( "YEAR_RATE", yearRate );
}
}
public void setIncomeNubmer( Map<String, String> otherProperty, String productId, BizObject fcc ) throws Exception {
otherProperty.put( "INCOME_NUMBER_YEAR", "income_12" );
String incomeIntervalMonth = "1";
otherProperty.put( "INCOME_INTERVAL_MONTH", incomeIntervalMonth );
String incomeNumber = fcc.getAttribute( "INCOME_NUMBER" ).toString();
otherProperty.put( "LEASE_TERM", Integer.parseInt( incomeNumber ) * Integer.parseInt( incomeIntervalMonth ) + "" );
}
public void setFirstSecondPlan( Map<String, String> otherProperty, String productId, BizObject fcc ) throws Exception {
String periodType = otherProperty.get( "PERIOD_TYPE" );
String leaseAmtDate = otherProperty.get( "LEASE_AMT_DATE" );
String incomeIntervalMonth = otherProperty.get( "INCOME_INTERVAL_MONTH" );
String defaultDueDay = fcc.getAttribute( "DefaultDueDay" ).toString();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd" );
Date lad = sdf.parse( leaseAmtDate );
lad = DateUtils.setDays( lad, Integer.parseInt( defaultDueDay ) );
String firstPlanDate = "";
String secondPlanDate = "";
if ( "period_type_1".equals( periodType ) ) {
firstPlanDate = leaseAmtDate;
secondPlanDate = sdf.format( DateUtils.addMonths( lad, Integer.parseInt( incomeIntervalMonth ) ) );
} else {
firstPlanDate = sdf.format( DateUtils.addMonths( lad, Integer.parseInt( incomeIntervalMonth ) ) );
secondPlanDate = sdf.format( DateUtils.addMonths( lad, Integer.parseInt( incomeIntervalMonth ) * 2 ) );
}
otherProperty.put( "FIRST_PLAN_DATE", firstPlanDate );
otherProperty.put( "SECOND_PLAN_DATE", secondPlanDate );
}
public void autoCalc( String flowunid, String calType, String planNumber, String productId, JBOTransaction tx ) throws Exception {
CreateTransactionExecutor cte = new CreateTransactionExecutor();
cte.setCalType( calType );
cte.setFlowunid( flowunid );
cte.setPlannumber( planNumber );
cte.setProductId( productId );
cte.runTrans( tx );
}
}