凭证相关--起租前生成凭证

This commit is contained in:
xiezhiwen 2018-09-25 20:34:49 +08:00
parent ebf19a0994
commit 95fda83770
3 changed files with 182 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package com.tenwa.voucher.CreateVoucherProcess.CreateVoucherMethodSettle;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherToBeforeOnhire;
/**
* 汽车类传统/传统--起租前生成财务凭证
* @author xiezhiwen
*/
public class ContractBeforeOnhireToVoucher extends BaseBussiness {
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String FlowUnid=this.getAttribute("FlowUnid").toString();
CreateVoucherToBeforeOnhire cvbo=new CreateVoucherToBeforeOnhire();
// 传统
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000156","feetype2"); // 收到客户保证金--回租
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000157","feetype1"); // 收到客户手续费--回租
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000158","feetype5"); // 收到客户预付款(首付)--回租
// 汽车类传统
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000192","feetype2"); // 收到客户记录保证金--回租
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000193","feetype1"); // 收到客户手续费--回租
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000194","feetype5"); // 收到客户预付款(首付)--回租
cvbo.CreateVoucher(FlowUnid, "PZ2018092500000195","feetype24");// 记录GPS安装服务费不参融--回租
return "true";
}
}

View File

@ -0,0 +1,149 @@
package com.tenwa.voucher.CreateVoucherProcess;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.voucher.LV_VOUCHER_CONFIG;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.voucher.serviceImp.CreateVoucherServiceImpl;
public class CreateVoucherToBeforeOnhire extends BaseBussiness {
public String CreateVoucher(String FlowUnid, String VOUCHERNO, String FeeType) throws Exception {
Transaction Sqlca = null;
Map<String, String> map = new HashMap<String, String>();
Map<String, String> param = new HashMap<String, String>();
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
String MONEY = null;
String MONEYNOTAX = null;
String MONEYTAX = null;
String ACCOUNT_DATE = null;
String FACT_DATE = null;
String CONTRACT_ID = null;
String CONTRACT_NUMBER = null;
String PROJECT_NAME = null;
String leas_form = null;
String DISTRIBUTOR_ID = null;
String DISTRIBUTOR_NAME = null;
String CARID = null;
String CARMODEL = null;
String CUSTID = null;
String CUSTNAME = null;
String CUSTOMERTYPE = null;
String BUSINESSTYPE = null;
String ACC_NUM = null;
String tax_type="";
String sql = "";
param.clear();
map.put("FlowUnid", FlowUnid);
map.put("FEE_TYPE", FeeType);
String fee_type="";
if("feetype24".equals(fee_type)) {
tax_type="GPS";
}else {
tax_type="本金";
}
// 传统
if("PZ2018092500000156".equals(VOUCHERNO) || "PZ2018092500000157".equals(VOUCHERNO) || "PZ2018092500000158".equals(VOUCHERNO)) {
sql = "SELECT LFIT.FACT_MONEY AS MONEY,ROUND(LFIT.FACT_MONEY / getTax (LCI.LEAS_FORM,'"+tax_type+"',LCI.INPUTTIME),2) AS MONEYNOTAX,(LFIT.FACT_MONEY - ROUND(LFIT.FACT_MONEY / getTax (LCI.LEAS_FORM,'本金',LCI.INPUTTIME),2)) AS MONEYTAX,DATE_FORMAT(SYSDATE(), '%Y/%m/%d') AS ACCOUNT_DATE,DATE_FORMAT(SYSDATE(), '%Y/%m/%d') AS FACT_DATE,LFIT.CONTRACT_ID,LCI.CONTRACT_NUMBER,LCI.PROJECT_NAME,LCI.LEAS_FORM,DI.DISTRIBUTOR_CODING DISTRIBUTOR_ID,DI.DISTRIBUTOR_NAME,LEC.ID AS CARID,LEC.MODEL,CIF.CUSTOMER_NUM AS CUSTOMERID,CIF.CUSTOMERNAME,CIF.CUSTOMERTYPE,LPI.BUSINESSTYPE,LFIT.ACC_NUMBER FROM LC_FUND_INCOME_TEMP LFIT LEFT JOIN LB_CONTRACT_INFO LCI ON LFIT.CONTRACT_ID = LCI.ID LEFT JOIN DISTRIBUTOR_INFO DI ON DI.DISTRIBUTOR_NO = LCI.DISTRIBUTOR_ID LEFT JOIN LB_EQUIPMENT_CAR LEC ON LEC.CONTRACT_ID = LCI.ID LEFT JOIN lb_union_lessee lul ON lul.contract_id = lci.id LEFT JOIN customer_info cif ON cif.customerid = lul.customer_id LEFT JOIN LB_PROJECT_INFO LPI ON LPI.ID = LUL.PROJECT_ID LEFT JOIN LC_CALC_CONDITION LCCT ON LCCT.CONTRACT_ID = LCI.ID WHERE LFIT.FEE_TYPE = :FEE_TYPE AND LCI.BUSINESSTYPE='2' AND LFIT.FLOWUNID = :FLOWUNID ";
}else {// 汽车类传统
sql = "SELECT LFIT.FACT_MONEY AS MONEY,ROUND(LFIT.FACT_MONEY / getTax (LCI.LEAS_FORM,'"+tax_type+"',LCI.INPUTTIME),2) AS MONEYNOTAX,(LFIT.FACT_MONEY - ROUND(LFIT.FACT_MONEY / getTax (LCI.LEAS_FORM,'本金',LCI.INPUTTIME),2)) AS MONEYTAX,DATE_FORMAT(SYSDATE(), '%Y/%m/%d') AS ACCOUNT_DATE,DATE_FORMAT(SYSDATE(), '%Y/%m/%d') AS FACT_DATE,LFIT.CONTRACT_ID,LCI.CONTRACT_NUMBER,LCI.PROJECT_NAME,LCI.LEAS_FORM,DI.DISTRIBUTOR_CODING DISTRIBUTOR_ID,DI.DISTRIBUTOR_NAME,LEC.ID AS CARID,LEC.MODEL,CIF.CUSTOMER_NUM AS CUSTOMERID,CIF.CUSTOMERNAME,CIF.CUSTOMERTYPE,LPI.BUSINESSTYPE,LFIT.ACC_NUMBER FROM LC_FUND_INCOME_TEMP LFIT LEFT JOIN LB_CONTRACT_INFO LCI ON LFIT.CONTRACT_ID = LCI.ID LEFT JOIN DISTRIBUTOR_INFO DI ON DI.DISTRIBUTOR_NO = LCI.DISTRIBUTOR_ID LEFT JOIN LB_EQUIPMENT_CAR LEC ON LEC.CONTRACT_ID = LCI.ID LEFT JOIN lb_union_lessee lul ON lul.contract_id = lci.id LEFT JOIN customer_info cif ON cif.customerid = lul.customer_id LEFT JOIN LB_PROJECT_INFO LPI ON LPI.ID = LUL.PROJECT_ID LEFT JOIN LC_CALC_CONDITION LCCT ON LCCT.CONTRACT_ID = LCI.ID WHERE LFIT.FEE_TYPE = :FEE_TYPE AND LCI.BUSINESSTYPE='3' AND LFIT.FLOWUNID = :FLOWUNID ";
}
// 查询sql, 将结果集封装到list集合中
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(Sqlca, sql, map);
CreateVoucherServiceImpl vs = new CreateVoucherServiceImpl();
String VOUCHER_TYPE = "1";// 凭证分类 金蝶
String userid = "admin";
//遍历获取结果集, 将结果写入map中
for (int i = 0; i < dataList.size(); i++) {
MONEY = dataList.get(i).get("MONEY").toString();
if ("".equals(MONEY)||MONEY == null)MONEY = "0.00";
double mon = Double.parseDouble(MONEY);
// 判断有金额, 封装值到map中
if (Math.abs(mon) > 0) {
MONEYNOTAX = dataList.get(i).get("MONEYNOTAX").toString();
MONEYTAX = dataList.get(i).get("MONEYTAX").toString();
ACCOUNT_DATE = dataList.get(i).get("ACCOUNT_DATE").toString();
FACT_DATE = dataList.get(i).get("FACT_DATE").toString();
CONTRACT_ID = dataList.get(i).get("CONTRACT_ID").toString();
CONTRACT_NUMBER = dataList.get(i).get("CONTRACT_NUMBER").toString();
PROJECT_NAME = dataList.get(i).get("PROJECT_NAME").toString();
leas_form = dataList.get(i).get("LEAS_FORM").toString();
DISTRIBUTOR_ID = dataList.get(i).get("DISTRIBUTOR_ID");
DISTRIBUTOR_NAME = dataList.get(i).get("DISTRIBUTOR_NAME");
CARID = dataList.get(i).get("CARID");
CARMODEL = dataList.get(i).get("MODEL");
CUSTID = dataList.get(i).get("CUSTOMERID");
CUSTNAME = dataList.get(i).get("CUSTOMERNAME");
CUSTOMERTYPE = dataList.get(i).get("CUSTOMERTYPE");
BUSINESSTYPE = dataList.get(i).get("BUSINESSTYPE");
ACC_NUM = dataList.get(i).get("ACC_NUMBER");
param.put("FACT_MONEY", MONEY);
param.put("INTERESTNOTAX", MONEYNOTAX);
param.put("TAX", MONEYTAX);
param.put("ACCOUNT_DATE", ACCOUNT_DATE);
param.put("FACT_DATE", FACT_DATE);
param.put("CONTRACT_ID", CONTRACT_ID);
param.put("CONTRACT_NUMBER", CONTRACT_NUMBER);
param.put("PROJECT_NAME", PROJECT_NAME);
param.put("LEAS_FORM", leas_form);
param.put("DISTRIBUTOR_ID", DISTRIBUTOR_ID);
param.put("DISTRIBUTOR_NAME", DISTRIBUTOR_NAME);
param.put("CARID", CARID);
param.put("CARMODEL", CARMODEL);
param.put("CUSTID", CUSTID);
param.put("CUSTNAME", CUSTNAME);
param.put("CUSTOMERTYPE", CUSTOMERTYPE);
param.put("BUSINESSTYPE", BUSINESSTYPE);
param.put("ACC_NUMBER", ACC_NUM);
// 传统类型
if("2".equals(BUSINESSTYPE)){
// 融资租赁资产
param.put("LEASFORMASSET", "02/03/05/06");
// 部门,业务二部
param.put("DEPT", "02");
// 传统融资租赁收入
param.put("LEASINCOMEFORM", "06");
}else if("3".equals(BUSINESSTYPE)){
// 融资租赁资产
param.put("LEASFORMASSET", "04");
// 部门,业务二部
param.put("DEPT", "02");
// 汽车类传统融资租赁收入
param.put("LEASINCOMEFORM", "05");
}
// param.put("FUNDTYPE", ""); // 主营类型
param.put("BUSINESSTYPE", "06");
param.put("FlowUnid", FlowUnid);
map.clear();
map.put("PROJ_TYPE", leas_form);
map.put("VOUCHER_NO", VOUCHERNO);
// 根据map中的参数, 查询LV_VOUCHER_CONFIG表数据
BizObject vouch = DataOperatorUtil.getSingleJBO(LV_VOUCHER_CONFIG.CLASS_NAME, map, Sqlca);
// 如果结果不为空,
if (vouch != null) {
//将创建凭证的参数传入在下一层
vs.createVoucher(vouch.getAttribute("MODULAR_NUMBER").getString(),vouch.getAttribute("OWNED_COMPANY").getString(), leas_form, VOUCHER_TYPE, userid, param,Sqlca);
}
}
}
if (Sqlca != null) {
Sqlca.commit();
}
String sMessage = "true";
return sMessage;
}
}

View File

@ -314,6 +314,12 @@ public class CreateVoucherServiceImpl {
}else if("PZ2018072100000037".equals(VOUCHERNO)||"PZ2018080400000091".equals(VOUCHERNO) || "PZ2018072100000038".equals(VOUCHERNO)||"PZ2018080400000092".equals(VOUCHERNO)){
subData.put("CUSTID","APZL00000000DC");//经销商id
subData.put("CUSTNAME","业务系统待查客户");//经销商名称
}else if("PZ2018092500000192".equals(VOUCHERNO)||"PZ2018092500000193".equals(VOUCHERNO) || "PZ2018092500000194".equals(VOUCHERNO)||"PZ2018092500000195".equals(VOUCHERNO)){
subData.put("CUSTID","APZL00000000DC");//经销商id
subData.put("CUSTNAME","业务系统待查客户");//经销商名称
}else if("PZ2018092500000156".equals(VOUCHERNO)||"PZ2018092500000157".equals(VOUCHERNO) || "PZ2018092500000158".equals(VOUCHERNO)){
subData.put("CUSTID","APZL00000000DC");//经销商id
subData.put("CUSTNAME","业务系统待查客户");//经销商名称
}else {
subData.put("CUSTID",dataTemp.get("CUSTID"));//客商id
subData.put("CUSTNAME",dataTemp.get("CUSTNAME"));//客商名称