Merge branch 'develop' of git@git2.tenwa.com.cn:ApzlDev/apzl_leasing.git into develop

This commit is contained in:
zhulianghua 2018-09-17 13:26:22 +08:00
commit 1c933a95f9
35 changed files with 1319 additions and 627 deletions

View File

@ -34,13 +34,9 @@
var planIds = "";
for(var i = 0;i < sParm.length; i++){
//if(planIds.length == 0){
//planIds += sParm[i] +"@";
//}else{
planIds += sParm[i] +"@";
//}
}
//alert(planIds);
planIds = planIds.substr(0,planIds.length-1);
//alert(planIds);
spara = "planIds="+planIds+",CurUserID=<%=CurUser.getUserID()%>";

View File

@ -24,7 +24,7 @@
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function submitInvoice(){
debugger;
//debugger;
var sParm = getItemValueArray(0,"id");
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{

View File

@ -40,7 +40,7 @@
var docList="<%=docList%>";
myleft.width=1;
if("SingleRow"=="<%=type%>"){
if("FundPaymentCarFlow"=="<%=sFlowNo%>"||"BusinessApplyFlow"=="<%=sFlowNo%>"||"MortgageFileFlow"=="<%=sFlowNo%>"||"ProjectCreditFlow"=="<%=sFlowNo%>"||"ContractSupportFlow"=="<%=sFlowNo%>"){
if("FundPaymentCarFlow"=="<%=sFlowNo%>"||"BusinessApplyFlow"=="<%=sFlowNo%>"||"MortgageFileFlow"=="<%=sFlowNo%>"||"ProjectCreditFlow"=="<%=sFlowNo%>"||"ContractSupportFlow"=="<%=sFlowNo%>"||"ProjectRecreditFlow"=="<%=sFlowNo%>"||"ProjectSupportFlow"=="<%=sFlowNo%>"){
AsControl.OpenView("/Tenwa/Comm/DocList/PayDocList.jsp","docList="+docList,"right","");
}else{
AsControl.OpenView("/Tenwa/Comm/DocList/BussinessApproveDocList.jsp","docList="+docList,"right","");

View File

@ -10,6 +10,7 @@
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.MultiSelect=true;
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
@ -17,6 +18,7 @@
//{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","查询","查询","selectInvoice()","","","","",""},
{"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
@ -37,20 +39,49 @@
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/invoiceDownloadServlet?CompClientID=<%=sCompClientID%>&path="+path, "downloadTemplate");
}
function lotdown(){
var localFiles=getItemValueArray(0,"localFile");
//alert(localFiles);
if(typeof(localFiles)=="undefined"||localFiles==null||localFiles==""){alert("请选择");return;}
var files = "";
for(var i=0;i<localFiles.length;i++){
files += localFiles[i]+"@";
}
files = files.substr(0,files.length-1);
//alert(files);
// para = "files="+files;
// alert(para);
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/invoiceLotDownloadServlet?CompClientID=<%=sCompClientID%>&files="+files, "downloadTemplate");
reloadSelf();
}
function selectInvoice(){
var sid = getItemValue(0,getRow(0),"sid");
//var sid = getItemValue(0,getRow(0),"sid");
var sid = getItemValueArray(0,"sid");
if(typeof(sid) == "undefined" || sid.length == 0 )
{
alert("请选择查询数据!");
return;
}
//alert(sid);
/* if(typeof(sid)=="undefined" || sObjectInfo.length==0 ){
alert("请选择查询开票数据!");
return ;
} */
spara = "sid="+sid+",CurUserID=<%=CurUser.getUserID()%>";
//var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.lease.app.invoicemanager.InvoiceManagerController","selectConfirm",spara);
var sids = "";
for(var i = 0;i < sid.length; i++){
sids += sid[i] +"@";
}
sids = sids.substr(0,sids.length-1);
//alert(sids);
spara = "sid="+sids+",CurUserID=<%=CurUser.getUserID()%>";
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.apzl.invoicemanager.rentplaninvoice.rentPlanInvoiceManager","selectConfirm",spara);
alert(returnValue);
alert(returnValue);
reloadSelf();
}
function newRecord(){

View File

@ -7,16 +7,31 @@
*/
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
String applytype = CurPage.getParameter("ApplyType");
String ishistory=CurPage.getParameter("IsHistory");
String RightType=CurPage.getParameter("RightType");
ASObjectModel doTemp = new ASObjectModel("TodoAdjustInterestList");
//判断业务类型
String businessType="";
String orgId=CurUser.getOrgID().substring(0,7);
if("AdjustInterestCarApply".equals(applytype)){
businessType="1";
}else{
if("8009010".equals(orgId)){
businessType="2";
}else if("8009011".equals(orgId)){
businessType="3";
}else{
businessType="";
}
}
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.MultiSelect = true;
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(sFlowUnid+","+sFlowUnid);
dwTemp.genHTMLObjectWindow(businessType+","+sFlowUnid+","+sFlowUnid);
if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){
isShowButton=false;
}

View File

@ -6,18 +6,34 @@
History Log:
*/
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
String applytype = CurPage.getParameter("ApplyType");
String ishistory=CurPage.getParameter("IsHistory");
String RightType=CurPage.getParameter("RightType");
ASObjectModel doTemp = new ASObjectModel("LCAdjustContractRoll");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory");//如果是历史则新显示历史数据
}
//判断业务类型
String businessType="";
String orgId=CurUser.getOrgID().substring(0,7);
if("AdjustRollBackApply".equals(applytype)){
businessType="1";
}else{
if("8009010".equals(orgId)){
businessType="2";
}else if("8009011".equals(orgId)){
businessType="3";
}else{
businessType="";
}
}
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.MultiSelect = true;
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(sFlowUnid);
dwTemp.genHTMLObjectWindow(sFlowUnid+","+businessType);
if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){
isShowButton=false;
}

View File

@ -6,8 +6,7 @@
function newApply(){
debugger;
var flowno="<%=CurPage.getParameter("ApplyType")%>";
var orgId="<%=CurUser.getOrgID()%>";
orgId.substring(0, 7);
var orgId="<%=CurUser.getOrgID()%>".substring(0, 7);
var selname="";
var parm="";
var businessType="";

View File

@ -5,8 +5,7 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
var orgId="<%=CurUser.getOrgID()%>";
orgId.substring(0, 7);
var orgId="<%=CurUser.getOrgID()%>".substring(0, 7);
var businessType="";
if(orgId=="8009010"){
businessType="2";

View File

@ -5,8 +5,7 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
var orgId="<%=CurUser.getOrgID()%>";
orgId.substring(0, 7);
var orgId="<%=CurUser.getOrgID()%>".substring(0, 7);
var businessType="";
if(orgId=="8009010"){
businessType="2";

View File

@ -5,7 +5,17 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
AsDialog.OpenSelector("SelectContractForEnd","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
var orgId="<%=CurUser.getOrgID()%>".substring(0,7);
var businessType="";
if(orgId=="8009010"){
businessType="2";
}else if(orgId=="8009011"){
businessType="3";
}else{
alert("当前用户不能发起申请!");
return;
}
AsDialog.OpenSelector("SelectContractForEnd","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;

View File

@ -5,9 +5,7 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
debugger;
var orgId="<%=CurUser.getOrgID()%>";
orgId.substring(0, 7);
var orgId="<%=CurUser.getOrgID()%>".substring(0, 7);
var businessType="";
if(orgId=="8009010"){
businessType="2";

View File

@ -5,7 +5,7 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
AsDialog.OpenSelector("TriditionselectContractOnhireChange","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
AsDialog.OpenSelector("selectContractOnhireChange","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;

View File

@ -5,7 +5,17 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
AsDialog.OpenSelector("TriditionselectContractOnhireChange","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
var orgId="<%=CurUser.getOrgID()%>".substring(0,7);
var businessType="";
if(orgId=="8009010"){
businessType="2";
}else if(orgId=="8009011"){
businessType="3";
}else{
alert("当前用户不能发起申请!");
return;
}
AsDialog.OpenSelector("TriditionselectContractOnhireChange","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;

View File

@ -5,7 +5,17 @@
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply()
{
AsDialog.OpenSelector("selectTraditionContractPaymentPlanTerminate","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
var orgId="<%=CurUser.getOrgID()%>".substring(0,7);
var businessType="";
if(orgId=="8009010"){
businessType="2";
}else if(orgId=="8009011"){
businessType="3";
}else{
alert("当前用户不能发起申请!");
return;
}
AsDialog.OpenSelector("selectTraditionContractPaymentPlanTerminate","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;

View File

@ -205,6 +205,13 @@
if(!checkCertidRepeat()){
return;
}
var assurerelation = getItemValue(0,0,"ASSURE_RELATION");
if(assurerelation.length>10){
setErrorTips("ASSURE_RELATION","关系输入过长!!");
return;
}else{
setErrorTips("ASSURE_RELATION","");
}
/*var ID = getItemValue(0,getRow(0),'ID');
if("undefined"==ID||""==ID || null==ID){
AsDebug.showMessage("提示","请选中一条数据!","","",true);

View File

@ -4,8 +4,7 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply(){
var orgId="<%=CurUser.getOrgID()%>";
orgId.substring(0, 7);
var orgId="<%=CurUser.getOrgID()%>".substring(0, 7);
var businessType="";
if(orgId=="8009010"){
businessType="2";

View File

@ -5,8 +5,7 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply(){
var orgId="<%=CurUser.getOrgID()%>";
orgId.substring(0, 7);
var orgId="<%=CurUser.getOrgID()%>".substring(0, 7);
var businessType="";
if(orgId=="8009010"){
businessType="2";

View File

@ -5,9 +5,25 @@
String flowunid = CurPage.getParameter("FlowUnid");
String rightType = CurPage.getParameter("RightType");
String applytype = CurPage.getParameter("ApplyType");
String factDate = JBOFactory.createBizObjectQuery(LC_EBANK_TEMP.CLASS_NAME, "flowunid=:flowunid")
.setParameter("flowunid", flowunid).getSingleResult(false).getAttribute("FACT_DATE").getString();
CurPage.setAttribute("fact_date", factDate);
//判断业务类型
String businessType="";
String orgId=CurUser.getOrgID().substring(0,7);
if("FundCollectionApply".equals(applytype)){
businessType="1";
}else{
if("8009010".equals(orgId)){
businessType="2";
}else if("8009011".equals(orgId)){
businessType="3";
}else{
businessType="";
}
}
ASObjectModel doTemp = new ASObjectModel("VILCRentPlanList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
@ -16,7 +32,7 @@
dwTemp.MultiSelect = true;
}
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(factDate);
dwTemp.genHTMLObjectWindow(businessType+","+factDate);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {

View File

@ -122,4 +122,6 @@
<INVOICE_APPID>6797763f-e55a-421c-9fe1-07a9fbd1d87a</INVOICE_APPID>
<INVOICE_SPBM>3060109010000000000</INVOICE_SPBM>
<INVOICE_LOCAL_PATH>D:\\pdf</INVOICE_LOCAL_PATH>
<COPY_LOCAL_PATH>D:/liuzhaoPDF/</COPY_LOCAL_PATH>
<ZIP_LOCAL_PATH>D:/liuzhaoCopyPDF/</ZIP_LOCAL_PATH>
</Domain>

View File

@ -19,7 +19,7 @@
<Parameter CHECKSCRIPT="" CODESCRIPT="rent_day" CODESOURCE="Code" COMPONENTTYPE="PRD0301," DATATYPE="4" HTMLSTYLE="" METHODSCRIPT="" METHODTYPE="Nothing" OPERATOR="VALUE" PARAMETERID="DefaultDueDay" PARAMETERNAME="默认还款日" SELECTSCRIPT="" SELECTTYPE="04" STATUS="1"/>
<Parameter CHECKSCRIPT="" CODESCRIPT="" CODESOURCE="" COMPONENTTYPE="PRD0301," DATATYPE="2" HTMLSTYLE="" METHODSCRIPT="jbo.acct.ACCT_RPT_SEGMENT.GainAmount" METHODTYPE="JBO" OPERATOR="MINIMUMVALUE,MAXIMUMVALUE,VALUE" PARAMETERID="GainAmount" PARAMETERNAME="递变幅度" SELECTSCRIPT="" SELECTTYPE="" STATUS="1"/>
<Parameter CHECKSCRIPT="" CODESCRIPT="" CODESOURCE="" COMPONENTTYPE="PRD0301," DATATYPE="5" HTMLSTYLE="" METHODSCRIPT="jbo.acct.ACCT_RPT_SEGMENT.GainCyc" METHODTYPE="JBO" OPERATOR="MINIMUMVALUE,MAXIMUMVALUE,OPTIONALVALUE" PARAMETERID="GainCyc" PARAMETERNAME="递变周期" SELECTSCRIPT="" SELECTTYPE="" STATUS="1"/>
<Parameter CHECKSCRIPT="" CODESCRIPT="income_number_year" CODESOURCE="Code" COMPONENTTYPE="PRD0301," DATATYPE="4" METHODSCRIPT="" METHODTYPE="Nothing" OPERATOR="VALUE" PARAMETERID="PayFrequencyType" PARAMETERNAME="ĬÈÏ»¹¿îÖÜÆÚ" SELECTTYPE="05" STATUS="1"/>
<Parameter CHECKSCRIPT="" CODESCRIPT="income_number_year" CODESOURCE="Code" COMPONENTTYPE="PRD0301," DATATYPE="4" METHODSCRIPT="" METHODTYPE="Nothing" OPERATOR="OPTIONALVALUE" PARAMETERID="PayFrequencyType" PARAMETERNAME="ĬÈÏ»¹¿îÖÜÆÚ" SELECTTYPE="06" STATUS="1"/>
<Parameter CHECKSCRIPT="" CODESCRIPT="TermUnit" CODESOURCE="Code" COMPONENTTYPE="PRD0301," DATATYPE="4" HTMLSTYLE="" METHODSCRIPT="jbo.acct.ACCT_RPT_SEGMENT.PayFrequencyUnit" METHODTYPE="JBO" OPERATOR="VALUE" PARAMETERID="PayFrequencyUnit" PARAMETERNAME="指定周期单位" SELECTSCRIPT="" SELECTTYPE="05" STATUS="1"/>
<Parameter CHECKSCRIPT="" CODESCRIPT="" CODESOURCE="" COMPONENTTYPE="PRD0301," DATATYPE="5" HTMLSTYLE="" METHODSCRIPT="jbo.acct.ACCT_RPT_SEGMENT.PayFrequency" METHODTYPE="JBO" OPERATOR="MINIMUMVALUE,MAXIMUMVALUE" PARAMETERID="PayFrequency" PARAMETERNAME="指定周期" SELECTSCRIPT="" SELECTTYPE="" STATUS="1"/>
<Parameter CODESCRIPT="SEGTermFlag" CODESOURCE="Code" COMPONENTTYPE="PRD0301," DATATYPE="4" METHODSCRIPT="jbo.acct.ACCT_RPT_SEGMENT.SegTermFlag" METHODTYPE="JBO" OPERATOR="VALUE" PARAMETERID="SegTermFlag" PARAMETERNAME="区段期限标示" SELECTTYPE="05" STATUS="1"/>

View File

@ -3702,5 +3702,22 @@
</managerProperties>
</manager>
</class>
<class name="VI_CONTRACT_OVERDUE" label="" keyAttributes="contract_id">
<attributes>
<attribute name="contract_id" label="合同id" type="STRING"/>
<attribute name="contract_number" label="合同编号" type="STRING"/>
<attribute name="CONTRACT_STATUS" label="合同状态" type="STRING"/>
<attribute name="over_list" label="逾期期数" type="STRING"/>
<attribute name="over_days" label="逾期天数" type="STRING"/>
<attribute name="over_money" label="逾期金额" type="STRING"/>
<attribute name="over_penalty" label="逾期罚息" type="STRING"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="vi_contract_overdue" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -4714,6 +4714,7 @@
<attribute name="updateuserid" label="updateuserid" type="STRING" length="32"/>
<attribute name="updateorgid" label="updateorgid" type="STRING" length="32"/>
<attribute name="updatetime" label="updatetime" type="STRING" length="32"/>
<attribute name="over_days" label="逾期天数" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>

View File

@ -182,6 +182,10 @@
<servlet-name>InvoiceDownloadServlet</servlet-name>
<servlet-class>com.tenwa.app.invoice.servlet.InvoiceDownloadServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>InvoiceLotDownloadServlet</servlet-name>
<servlet-class>com.tenwa.app.invoice.servlet.InvoiceLotDownloadServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>DocDownloadServlet</servlet-name>
<servlet-class>com.tenwa.doc.servlet.DocDownloadServlet</servlet-class>
@ -270,6 +274,10 @@
<servlet-name>InvoiceDownloadServlet</servlet-name>
<url-pattern>/servlet/view/invoiceDownloadServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>InvoiceLotDownloadServlet</servlet-name>
<url-pattern>/servlet/view/invoiceLotDownloadServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DocDownloadServlet</servlet-name>
<url-pattern>/servlet/view/docDownloadServlet</url-pattern>

View File

@ -49,6 +49,11 @@ public class SaveBusinessStatus {
public static void saveByContractId(String contractId ,JBOTransaction tx ,String statusCode,String userid) throws JBOException{
BizObject lcibo = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME).createQuery("ID=:ID").setParameter("ID", contractId).getSingleResult(false);
String cn = lcibo.getAttribute(LB_CONTRACT_INFO.CONTRACT_NUMBER).getString();
BizObject contractOverdue = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.VI_CONTRACT_OVERDUE", "contract_id=:contract_id").setParameter("contract_id", contractId).getSingleResult(false);
String overDays = "";
if(contractOverdue !=null){
overDays = contractOverdue.getAttribute("over_days").toString();
}
ASUser user = new ASUser(userid);
BizObjectManager bsbom = JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME, tx);
BizObject bsbo = bsbom.newObject();
@ -57,6 +62,7 @@ public class SaveBusinessStatus {
bsbo.setAttributeValue(BUSINESS_STATUS.inputuserid, userid);
bsbo.setAttributeValue(BUSINESS_STATUS.inputorgid, user.getOrgID());
bsbo.setAttributeValue(BUSINESS_STATUS.inputtime, StringFunction.getTodayNow());
bsbo.setAttributeValue(BUSINESS_STATUS.over_days, overDays);
bsbom.saveObject(bsbo);
}
}

View File

@ -62,7 +62,6 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
}
param.clear();
map.put("FLOWUNID", FlowUnid);
System.out.println();
List<Map<String,String>> dataList=DataOperatorUtil.getDataBySql(Sqlca, sql, map);
CreateVoucherServiceImpl vs=new CreateVoucherServiceImpl();

View File

@ -128,7 +128,6 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
param.put("CUSTID",DISTRIBUTOR_ID);
param.put("CUSTNAME",DISTRIBUTOR_NAME);
param.put("CUSTOMERTYPE",CUSTOMERTYPE);
param.put("BUSINESSTYPE",BUSINESSTYPE);
if("1".equals(BUSINESSTYPE)){
param.put("LEASFORMASSET", "04"); // ÈÚ×Ê×âÁÞ×ʲú
@ -139,9 +138,6 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
param.put("LEASINCOMEFORM", "01"); // BË
}
}
//param.put("FUNDTYPE", ""); // Ö÷ÓªÀàÐÍ
param.put("BUSINESSTYPE", "06");
param.put("FlowUnid", FlowUnid);
map.clear();
map.put("PROJ_TYPE", leas_form);

View File

@ -9,13 +9,13 @@ import com.tenwa.voucher.service.VoucherJavaParamService;
public class auxiliaryBusinessType implements VoucherJavaParamService {
@Override
public Map<String, String> getJavaParam(JBOTransaction tx,
Map<String, String> param) throws BusinessException {
Map<String,String>returnValue=new HashMap<String,String>();
String PLAN_LIST=param.get("PLAN_LIST");
returnValue.put("PLAN_LIST",PLAN_LIST);
return returnValue;
}
@Override
public Map<String, String> getJavaParam(JBOTransaction tx,Map<String, String> param) throws BusinessException {
Map<String,String>returnValue=new HashMap<String,String>();
String PLAN_LIST=param.get("PLAN_LIST");
String BUSINESSTYPE=param.get("BUSINESSTYPE");
returnValue.put("PLAN_LIST",PLAN_LIST);
returnValue.put("BUSINESSTYPE",BUSINESSTYPE);
return returnValue;
}
}

View File

@ -21,6 +21,7 @@ import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.lang.DataElement;
import com.amarsoft.are.log.Log;
import com.amarsoft.awe.Configure;
import com.tenwa.comm.exception.BusinessException;
@ -293,6 +294,12 @@ public class CreateVoucherServiceImpl {
subData.put("F6",sub.getAttribute("id").getString());//科目编码
subData.put("F1",dataTemp.get("ACCOUNT_DATE"));//会计处理日
String VOUCHERNO = param.get("VOUCHERNO");
String sort = bo.getAttribute("SORT_NUMBER").getString();
if("1".equals(sort)) {
param.put("BUSINESSTYPE", "9201");
}else if("2".equals(sort)) {
param.put("BUSINESSTYPE", "92");
}
if("1".equals(bo.getAttribute("LOAN_DIRECTION").getString())){//借贷方向
subData.put("F7", dataTemp.get("MONEY"));//借方金额
subData.put("F8", "0");//贷方金额

View File

@ -15,6 +15,8 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
@ -56,10 +58,15 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
Transaction Sqlca = null;
Sqlca = Transaction.createTransaction(tx);
Map<String, String> map = new HashMap<String, String>();
// 获取vi_voucher_v8视图中的数据
List<Map<String, String>> list= getDataList(Sqlca);// 获取所有凭证编号
// 生成凭证信息xml文件
DOM4JcreateToVoucher(Sqlca,list,map);
// 生成客户信息xml文件
DOM4JcreateToCustomer(Sqlca);
// 生成经销商信息xml文件
DOM4JcreateToSupplier(Sqlca);
// 生成辅助合同信息xml文件
DOM4JcreateToDefdoc(Sqlca,list,map);
tx.commit();
} catch (Exception e) {
@ -82,8 +89,6 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
}
/**
* 获取数据库凭证信息表所有的待传F3凭证编号
* @param tx
* @return
* @throws Exception
*/
private static List<Map<String, String>> getDataList(JBOTransaction tx) throws Exception{
@ -97,29 +102,34 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
* @throws Exception
*/
private static void DOM4JcreateToVoucher(Transaction Sqlca,List<Map<String, String>>list, Map<String, String> map) throws Exception {
File file2 = new File("D:\\voucherXml_NC");
if (!file2.exists()) {
file2.mkdirs();
}
Document document=null;
File file=null;
XMLWriter writer=null;
String SUBJECT_ID=null;
String OWNED_COMPANY = null;
String ACC_YEAR = null;
String ACC_MONTH = null;
String VOUCHING_PERSON = null;
Date time = new Date(); // 获取当前时间对象, 并格式化
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMddHHmmss");
String year_month_day = formatter1.format(time); // 年月日
String timeAll = "";
int a = list.size(); // 获取凭证编号的长度
int b=1000; // 设置当前xml生成的条数
int c = (int)(a / b); // 获取循环次数, 最大循环值=c+1
for (int i = 0; i <=c; i++) { // 外围循环/ 决定生成几个xml
document = DocumentHelper.createDocument(); // 生成每个xml的头
Element root = document.addElement("ufinterface");
root.addAttribute("account", "0001");
// 本地xml存放文件夹, 没有就创建
//File file2 = new File("D:\\voucherXml_NC");
//if (!file2.exists()) {file2.mkdirs();}// 判断是否存在, 如果不存在就创建该文件夹
// 定义全局对象
Document document=null; // xml文件头
File file=null; // 生成的xml文件路径
XMLWriter writer=null; // 输出对象
String str=""; // xml主键id
String SUBJECT_ID=null; // 获取科目id
String OWNED_COMPANY = null; // 所属公司
String ACC_YEAR = null; // 会计期间/
String ACC_MONTH = null; // 会计期间/
String tableName="VOUCHER_V8"; // 表名
String flag="V8_FLAG"; // 状态名
String xmlId=""; // xml的id字段名
String updSql=""; // 定义更新语句对象
SqlObject sql; // sqlObject对象
Date time = new Date(); // 获取当前时间对象, 并格式化
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMddHHmmss");// 年月日时分秒
String year_month_day = formatter1.format(time); // 年月日时分秒
String timeAll = ""; // 制单日期
int a = list.size(); // v8视图总数据量/ xml中生成的总条数
int b=1000; // 设置当前xml生成的条数
int c = (int)(a / b); // 获取生成xml文件的数量, 最大循环值=c+1
for (int i = 0; i <=c; i++) {
document = DocumentHelper.createDocument(); // 创建Document对象
Element root = document.addElement("ufinterface"); // 设置xml头
root.addAttribute("account", "0001"); // 设置xml头属性
root.addAttribute("billtype", "vouchergl");
root.addAttribute("businessunitcode", "develop");
root.addAttribute("filename", "");
@ -130,7 +140,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
root.addAttribute("replace", "Y");
root.addAttribute("roottag", "");
root.addAttribute("sender", "001");
for (int x = i * b; x < (i + 1) * b && x < a; x++) {// 决定当前xml生成的数据量
for (int x = i * b; x < (i + 1) * b && x < a; x++) { // 决定当前xml生成的数据量
// 获取凭证编号
String F3=list.get(x).get("F3");
map.clear();
@ -144,18 +154,17 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
// 获取v8表公共信息
for (Map<String, String> map2 : v2) {
OWNED_COMPANY=map2.get("f49");//本方id
ACC_YEAR = map2.get("f51");// 会计期间/
ACC_MONTH =map2.get("f52");// 会计期间/
VOUCHING_PERSON =map2.get("f12");// 制单人
timeAll =map2.get("f15");// 制单时间
OWNED_COMPANY=map2.get("f49"); // 本方id
ACC_YEAR = map2.get("f51"); // 会计期间/
ACC_MONTH =map2.get("f52"); // 会计期间/
timeAll =map2.get("f15"); // 制单时间
}
BizObject own = JBOFactory.createBizObjectQuery(OWN_INFO.CLASS_NAME, "id=:OWNED_COMPANY").setParameter("OWNED_COMPANY", OWNED_COMPANY).getSingleResult(false);
Element voucher = root.addElement("voucher");
Element voucherHead = voucher.addElement("voucher_head");
Element pkVoucher = voucherHead.addElement("pk_voucher");// 凭证主键/非空
//pkVoucher.setText(list.get(x).get("ID").toString());
pkVoucher.setText((x+1)+"凭证主键 如果没有那就是新增,有就是修改 可空");
str=UUID.randomUUID().toString().replace("-", "");
pkVoucher.setText(str);
Element pk_vouchertype = voucherHead.addElement("pk_vouchertype");// 凭证类别, 默认01/非空
pk_vouchertype.setText("1");//----------------------------------------------------------------------
Element year = voucherHead.addElement("year");// 会计年度/非空
@ -405,14 +414,18 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
Element pk_innercorp2 = cashflowitem2.addElement("pk_innercorp");// 内部单位主键,最大长度为64,类型为:String
pk_innercorp2.setText("");
}
// 执行update操作, 将生成的xml标签id存入v8表
/*updSql="UPDATE "+tableName+" SET xmlId='"+str+"' WHERE F3 ='"+F3+"' ";
sql = new SqlObject(updSql);
Sqlca.executeSQL(sql);*/
}
String URL="D:\\voucherXml_NC\\APleasing_VOUCHER_"+year_month_day+".xml";
String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_VOUCHER_"+year_month_day+".xml";
file=new File(URL);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
InterActionToNC(Sqlca,URL);
InterActionToNC(Sqlca,URL,tableName,flag,xmlId);
}
}
/**
@ -421,25 +434,28 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
* @throws Exception
*/
private static void DOM4JcreateToCustomer(Transaction Sqlca) throws Exception{
File file2 = new File("D:\\voucherXml_NC");
if(file2==null || "".equals(file2)) {
file2.mkdirs();//创建父文件夹
}
// 判断该文件夹是否存在, 如果不存在就创建
//File file2 = new File("D:\\voucherXml_NC");
//if(file2.exists()) {file2.mkdirs();}
// 定义全局对象
File file=null;
XMLWriter writer=null;
// 获取当前时间对象, 并格式化
Date time = new Date();
// 生成xml的路劲
File file=null;
// 输出对象
XMLWriter writer=null;
// 表名
String tableName="CUSTOMER_INFO";
// 状态字段
String flag="FLAG";
// xml传输id字段
String xmlId="";
// 获取时间对象, 格式为--年月日时分秒
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMddHHmmss");
// 年月日
String year_month_day = formatter1.format(time);
String cust_id="";
String updateSql="";
String year_month_day = formatter1.format(new Date());
String customer_num="";
String customername="";
String customertype="";
// 查询未传入客户信息
String sql="SELECT customer_num,customername,customertype,customerid FROM CUSTOMER_INFO WHERE (FLAG='' OR FLAG IS NULL)";
String sql="SELECT customer_num,customername,customertype,customerid FROM CUSTOMER_INFO WHERE FLAG <>'1' ";
List<Map<String, String>> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null);
// 客户xml头
Document document= DocumentHelper.createDocument(); // 生成每个xml的头
@ -715,13 +731,13 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
SqlObject updSql=new SqlObject(updateSql);
Sqlca.executeSQL(updSql);*/
}
String URL="D:\\voucherXml_NC\\APleasing_Customer_"+year_month_day+".xml";
String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Customer_"+year_month_day+".xml";
file=new File(URL);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
InterActionToNC(Sqlca,URL);
InterActionToNC(Sqlca,URL,tableName,flag,xmlId);
}
/**
* 供应商信息xml生成, 每1000条生成一个xml
@ -729,12 +745,15 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
* @throws Exception
*/
private static void DOM4JcreateToSupplier(Transaction Sqlca) throws Exception{
File file2 = new File("D:\\voucherXml_NC");
if(file2==null || "".equals(file2)) {
file2.mkdirs();//创建父文件夹
}
//File file2 = new File("D:\\voucherXml_NC");
//if(file2==null || "".equals(file2)) {
// file2.mkdirs();//创建父文件夹
//}
File file = null;
XMLWriter writer = null;
String tableName="DISTRIBUTOR_INFO";// 表名
String flag="FLAG"; // 状态名
String xmlId=""; // xml传输id
String DISTRIBUTOR_NAME = ""; // 经销商名称
String DISTRIBUTOR_CODING = ""; // 经销商id
String DISTRIBUTOR_ADDRESS=""; // 地区编码
@ -770,7 +789,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
root.addAttribute("replace", "Y");
root.addAttribute("roottag", "");
root.addAttribute("sender", "001");
String sql="SELECT DISTRIBUTOR_NAME,DISTRIBUTOR_CODING,DISTRIBUTOR_ADDRESS,FACT_ADDR,PROVINCES,POSTCODE,REGISTERED_ADDR,BUSINESS_SCOPE,SUBSIDIARY_COMPANY,TYPE,BUSINESS_LICENSE_NO,DISTRIBUTOR_STATUS,E_MAIL,FAX_NUMBER,REGISTERED_ASSET,DISTRIBUTORER,MBAFC_EARLYDISBURSEMENT_TYPE,URL,FLAG FROM DISTRIBUTOR_INFO WHERE (FLAG='' OR FLAG IS NULL)";
String sql="SELECT DISTRIBUTOR_NAME,DISTRIBUTOR_CODING,DISTRIBUTOR_ADDRESS,FACT_ADDR,PROVINCES,POSTCODE,REGISTERED_ADDR,BUSINESS_SCOPE,SUBSIDIARY_COMPANY,TYPE,BUSINESS_LICENSE_NO,DISTRIBUTOR_STATUS,E_MAIL,FAX_NUMBER,REGISTERED_ASSET,DISTRIBUTORER,MBAFC_EARLYDISBURSEMENT_TYPE,URL,FLAG FROM DISTRIBUTOR_INFO WHERE FLAG<>'1'";
List<Map<String, String>> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null);
for(int i=0; i<rs.size();i++) {
DISTRIBUTOR_NAME = rs.get(i).get("DISTRIBUTOR_NAME");
@ -919,19 +938,27 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
SqlObject updSql=new SqlObject(updateSql);
Sqlca.executeSQL(updSql);*/
}
String f="D:\\voucherXml_NC\\APleasing_Supplier_"+year_month_day+".xml";
//String f="D:\\voucherXml_NC\\APleasing_Supplier_"+year_month_day+".xml";
String f="//data//files//apzl_leasing//tmp//XZW//APleasing_Supplier_"+year_month_day+".xml";
file=new File(f);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
InterActionToNC(Sqlca,f);
InterActionToNC(Sqlca,f,tableName,flag,xmlId);
}
/**
* 辅助合同xml
* @throws Exception
*/
private static void DOM4JcreateToDefdoc(Transaction Sqlca,List<Map<String, String>>list, Map<String, String> map) throws Exception{
Document document=null;
File file=null;
XMLWriter writer=null;
String tableName="VOUCHER_V8";// 表名
String flag="V8_FLAG"; // 状态名
String xmlId=""; // xml传输id
Date time = new Date(); // 获取当前时间对象, 并格式化
File file2 = new File("D:\\voucherXml_NC");
if(file2==null || "".equals(file2)) {
@ -990,20 +1017,20 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
Element memo = billhead.addElement("memo");// 备注,最大长度为200,类型为:String
memo.setText("");
}
String URL="D:\\voucherXml_NC\\APleasing_Defdoc_"+year_month_day+".xml";
String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Defdoc_"+year_month_day+".xml";
file=new File(URL);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
InterActionToNC(Sqlca,URL);
InterActionToNC(Sqlca,URL,tableName,flag,xmlId);
}
}
/**
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
*/
public static void InterActionToNC(Transaction Sqlca,String OutURL) {
public static void InterActionToNC(Transaction Sqlca,String inputURL,String tableName,String flag,String xmlId) {
try {
// 定义全局变量
String sql="";
@ -1022,7 +1049,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
/**
* 读取本地生成的xml, 传输到NC
*/
File file = new File(OutURL);
File file = new File(inputURL);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
int length;
@ -1080,7 +1107,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
}else if(resSuc.equals("Y")){
System.out.println("导入成功");
//接下来的代码修改状态
sql="UPDATE 表名 set 字段 = '1' WHERE 状态字段 <> '1'";
sql="UPDATE tableName set flag = '1' WHERE flag <> '1'";
updSql = new SqlObject(sql);
Sqlca.executeSQL(updSql);
List<Element> list1 = root.elements();
@ -1090,7 +1117,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
resultcode = el.element("resultcode").getStringValue();
if(!"1".equals(resultcode)) {
bdocid = el.element("bdocid").getStringValue();
sql=" UPDATE 表名 SET 字段='"+resultcode+"' WHERE 标签id='"+bdocid+"' ";
sql=" UPDATE tableName SET flag='"+resultcode+"' WHERE xmlId='"+bdocid+"' ";
updSql = new SqlObject(sql);
Sqlca.executeSQL(updSql);
}

View File

@ -16,6 +16,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.util.DataConvert;
import com.amarsoft.awe.Configure;
import com.tenwa.util.SecurityUtil;
@ -30,6 +33,19 @@ public class InvoiceDownloadServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String customerName = "";
String sid = "";
try {
BizObject invoiceResult = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LI_INVOICE_RESULT", "localFile=:localFile").setParameter("localFile", request.getParameter("path")).getSingleResult(false);
sid = invoiceResult.getAttribute("sid").toString();
BizObject invoiceConfirm = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LI_INVOICE_CONFIRM", "sid=:sid").setParameter("sid",sid).getSingleResult(false);
if(invoiceConfirm !=null){
customerName = invoiceConfirm.getAttribute("ghdwmc").toString();
}
} catch (JBOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
HttpSession session = request.getSession(true);
if ((session == null) || (session.getAttributeNames() == null)) {
@ -43,14 +59,16 @@ public class InvoiceDownloadServlet extends HttpServlet {
String path = DataConvert.toString(request.getParameter("path"));
path = SecurityUtil.detrypt(path, "invoice");
localFile = localFile + path;
File file = new File(localFile);
if (!file.exists())
throw new Exception("Îļþ²»´æÔÚ");
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYYMMddHHmmss");
String filename = dateFormat.format(new Date()) + ".pdf";
//String filename = dateFormat.format(new Date()) + ".pdf";
String filename = customerName + ".pdf";
//response.setContentType("text/html;charset=UTF-8");
response.setContentType(getServletContext().getMimeType(filename));
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
response.setHeader("Content-Disposition", "attachment;filename=" + new String( filename.getBytes("gb2312"), "ISO8859-1" ) );
InputStream in = new FileInputStream(localFile);
OutputStream out = response.getOutputStream();
int b;

View File

@ -0,0 +1,136 @@
package com.tenwa.app.invoice.servlet;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.util.DataConvert;
import com.amarsoft.awe.Configure;
import com.tenwa.app.invoice.utils.FileCopy;
import com.tenwa.app.invoice.utils.FilesToZipUtils;
import com.tenwa.util.SecurityUtil;
public class InvoiceLotDownloadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public InvoiceLotDownloadServlet() {
super();
}
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String files = request.getParameter("files");
String[] arr = files.split("@");
String str = "";
String sid ="";
String customerName = "";
String zipLocalPath = "";
List<File> filess = new ArrayList<>();
for (int i = 0; i < arr.length; i++) {
str = arr[i];
try {
BizObject invoiceResult = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LI_INVOICE_RESULT", "localFile=:localFile").setParameter("localFile", str).getSingleResult(false);
if(invoiceResult !=null){
sid = invoiceResult.getAttribute("sid").toString();
}
BizObject invoiceConfirm = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LI_INVOICE_CONFIRM", "sid=:sid").setParameter("sid", sid).getSingleResult(false);
if(invoiceConfirm !=null){
customerName = invoiceConfirm.getAttribute("ghdwmc").toString();
}
} catch (JBOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
HttpSession session = request.getSession(true);
if ((session == null) || (session.getAttributeNames() == null)) {
throw new Exception("------Timeout------");
}
Configure CurConfig = Configure.getInstance(session.getServletContext());
if (CurConfig == null) {
throw new ServletException("读取配置文件错误!请检查配置文件。");
}
String localFile = CurConfig.getConfigure("INVOICE_LOCAL_PATH");
String copyLocalPath = CurConfig.getConfigure("COPY_LOCAL_PATH");
zipLocalPath = CurConfig.getConfigure("ZIP_LOCAL_PATH");
String path = DataConvert.toString(str);
path = SecurityUtil.detrypt(path, "invoice");
localFile = localFile + path;
File file = new File(localFile);
if (!file.exists())
throw new Exception("文件不存在");
//复制文件
File from = new File(localFile);
String pdfname = customerName + ".pdf";
//String name ="E:/liuzhaoPDF/"+pdfname;
String name =copyLocalPath+pdfname;
File to = new File(name);
FileCopy.copyFile(from, to);
//filess.add(new File(localFile));
filess.add(to);
} catch (Exception e) {
ARE.getLog().error("AttachmentView SQL Error:", e);
}
}
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYYMMddHHmmss");
String filename = dateFormat.format(new Date()) + ".zip";
//String zipFilename ="E:/liuzhaoCopyPDF/"+filename;
String zipFilename =zipLocalPath+filename;
try {
FilesToZipUtils.toZipFiles(filess, zipFilename);
} catch (Exception e) {
e.printStackTrace();
//error
}
File localZipFile = new File(zipFilename);
try {
if (localZipFile.exists() && localZipFile.isFile() && localZipFile.length() > 0) {
response.setContentType(getServletContext().getMimeType(filename));
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
InputStream in = new FileInputStream(localZipFile);
OutputStream out = response.getOutputStream();
int b;
while ((b = in.read()) != -1) {
out.write(b);
}
in.close();
out.close();
}else{
throw new Exception("压缩包不存在!");
}} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,21 @@
package com.tenwa.app.invoice.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileCopy {
public static void copyFile(File fromFile,File toFile) throws IOException{
FileInputStream ins = new FileInputStream(fromFile);
FileOutputStream out = new FileOutputStream(toFile);
byte[] b = new byte[1024];
int n=0;
while((n=ins.read(b))!=-1){
out.write(b, 0, n);
}
ins.close();
out.close();
}
}

View File

@ -0,0 +1,128 @@
package com.tenwa.app.invoice.utils;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
//import org.apache.logging.log4j.LogManager;
//import org.apache.logging.log4j.Logger;
import org.apache.tomcat.util.http.fileupload.FileUtils;
public class FilesToZipUtils {
private static final Logger log = LogManager.getLogger(FilesToZipUtils.class);
public static void delZipFile(String zipFilename) {
File file = new File(zipFilename);
if (file.exists()) {
file.delete();
try {
File localZipParentFile= file.getParentFile() ;
File[] listFiles = localZipParentFile.listFiles();
if(listFiles!=null && listFiles.length==0)
FileUtils.deleteDirectory(localZipParentFile);
} catch (IOException e) {
log.error(">>>>>>>>[error] file parent is not deleted>>>>>>>>" + e.getMessage());
}
}
}
public static void delZipFiles(List<File> files) {
if(files!=null && files.size()>0)
for(File file :files){
if (file.exists()) {
file.delete();
try {
File localZipParentFile= file.getParentFile() ;
File[] listFiles = localZipParentFile.listFiles();
if(listFiles!=null && listFiles.length==0)
FileUtils.deleteDirectory(localZipParentFile);
} catch (IOException e) {
log.error(">>>>>>>>[error] file parent is not deleted>>>>>>>>" + e.getMessage());
}
}else {
log.error(">>>>>>>>[error] file is not exists>>>>>>>>" + file);
}
}
}
public static void toZipFiles(List<File> files, String zipFilename) throws Exception {
try {
File file = new File(zipFilename);
if (!file.exists()) {
String path = zipFilename.substring(0, zipFilename.lastIndexOf("/")) ;
if(!new File(path).exists()) {
new File(path).mkdirs();
}
file.createNewFile();
}
FileOutputStream fous = new FileOutputStream(file);
ZipOutputStream zipOut = new ZipOutputStream(fous);
zipFile(files, zipOut);
zipOut.close();
fous.close();
if (file.exists()) {
log.info(">>>>>>>>[success] zip file is generated success>>>>>>>>" + file);
log.info(">>>>>>>>fils will be delete>>>>>>>>" );
log.info(">>>>>>>>fils is deleting>>>>>>>>" );
delZipFiles(files);
}else {
log.error(">>>>>>>>[error] zip file is not generated success>>>>>>>>" + file);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void zipFile(List<File> files, ZipOutputStream outputStream) {
int size = files.size();
for (int i = 0; i < size; i++) {
File file = (File) files.get(i);
if (file.exists()) {
zipFile(file, outputStream);
}
}
}
public static void zipFile(File inputFile, ZipOutputStream ouputStream) {
try {
if (inputFile.exists()) {
if (inputFile.isFile()) {
FileInputStream IN = new FileInputStream(inputFile);
BufferedInputStream bins = new BufferedInputStream(IN, 512);
ZipEntry entry = new ZipEntry(inputFile.getName());
ouputStream.putNextEntry(entry);
// 向压缩文件中输出数据
int nNumber;
byte[] buffer = new byte[512];
while ((nNumber = bins.read(buffer)) != -1) {
ouputStream.write(buffer, 0, nNumber);
}
// 关闭创建的流对象
bins.close();
IN.close();
} else {
try {
File[] files = inputFile.listFiles();
for (int i = 0; i < files.length; i++) {
zipFile(files[i], ouputStream);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -100,10 +100,10 @@ public class rentPlanInvoiceDirectManager extends BaseTable{
BizObjectManager viInvoiceRentManager = JBOFactory.getBizObjectManager(VI_LI_INVOICE_RENT_DIRECT.CLASS_NAME);
tx.join(lriiManager);
tx.join(viInvoiceRentManager);
//tx.join(viInvoiceRentManager);
String[] planIds = this.getPlanIds().split("@");
String invoice_status = "1";
String bill_type = "invoice";
String bill_type = "special";
String invoice_money = "";
String tax_type = "";
String plan_id = "";