发票
This commit is contained in:
parent
41cc6ae96d
commit
a0d7ffcf8e
@ -49,8 +49,10 @@
|
||||
</body>
|
||||
</html>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sObjectInfo = "";
|
||||
function submitInvoice(){
|
||||
debugger;
|
||||
frames["ObjectList"].returnValue();
|
||||
var plist=sObjectInfo.replace(/\@~/g,'@');
|
||||
plist = plist.substr(0,plist.length-1);
|
||||
@ -58,6 +60,7 @@
|
||||
alert("请选择开票数据!");
|
||||
return ;
|
||||
}
|
||||
alert(plist);
|
||||
spara = "PlanIncomeList="+plist+",CurUserID=<%=CurUser.getUserID()%>";
|
||||
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.lease.app.invoicemanager.InvoiceManagerController","confirmInvoice",spara);
|
||||
alert(returnValue);
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2018-08-06
|
||||
Content:
|
||||
History Log:
|
||||
*/
|
||||
ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmDetailList");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="1"; //--设置为Grid风格--
|
||||
dwTemp.ReadOnly = "1"; //只读模式
|
||||
dwTemp.setPageSize(10);
|
||||
dwTemp.genHTMLObjectWindow(CurPage.getParameter("invoice_confirm_id"));
|
||||
|
||||
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
|
||||
String sButtons[][] = {
|
||||
//{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
|
||||
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
|
||||
//{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
|
||||
};
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function newRecord(){
|
||||
var sUrl = "";
|
||||
AsControl.OpenView(sUrl,'','_self','');
|
||||
}
|
||||
function viewAndEdit(){
|
||||
var sUrl = "/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmInfo.jsp";
|
||||
var sPara = getItemValue(0,getRow(0),'ID');
|
||||
if(typeof(sPara)=="undefined" || sPara.length==0 ){
|
||||
alert("参数不能为空!");
|
||||
return ;
|
||||
}
|
||||
AsControl.OpenView(sUrl,'ID=' +sPara ,'_self','');
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -0,0 +1,30 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2018-08-06
|
||||
Content: 示例详情页面
|
||||
History Log:
|
||||
*/
|
||||
String sPrevUrl = CurPage.getParameter("PrevUrl");
|
||||
if(sPrevUrl == null) sPrevUrl = "";
|
||||
|
||||
String sTempletNo = "InvoiceConfirmInfo";//--模板号--
|
||||
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
|
||||
//doTemp.setColTips("", "测试");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
|
||||
dwTemp.Style = "2";//freeform
|
||||
//dwTemp.ReadOnly = "-2";//只读模式
|
||||
dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID"));
|
||||
|
||||
String sButtons[][] = {
|
||||
{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
|
||||
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""}
|
||||
};
|
||||
sButtonPosition = "south";
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function returnList(){
|
||||
AsControl.OpenView("<%=sPrevUrl%>", "","_self","");
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -0,0 +1,68 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2018-08-06
|
||||
Content:
|
||||
History Log:
|
||||
*/
|
||||
ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmList");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="1"; //--设置为Grid风格--
|
||||
dwTemp.ReadOnly = "1"; //只读模式
|
||||
dwTemp.setPageSize(10);
|
||||
dwTemp.genHTMLObjectWindow("");
|
||||
|
||||
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
|
||||
String sButtons[][] = {
|
||||
//{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
|
||||
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
|
||||
{"true","","Button","查询","查询","selectInvoice()","","","","",""}
|
||||
//{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
|
||||
};
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function afterSearch(){
|
||||
for(var i=0;i<getRowCount(0);i++){
|
||||
if(getObj(0,i,"localFile")!=null){
|
||||
|
||||
var localFile=getItemValue(0,i,"localFile");
|
||||
if(localFile)
|
||||
getObj(0,i,"localFile").innerHTML="<a onclick=downloadFile('"+localFile+"')><font color='blue'>下载</font></a>";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function downloadFile(path){
|
||||
alert(path);
|
||||
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
|
||||
window.open(sWebRootPath+"/servlet/view/invoiceDownloadServlet?CompClientID=<%=sCompClientID%>&path="+path, "downloadTemplate");
|
||||
}
|
||||
|
||||
function selectInvoice(){
|
||||
var sid = getItemValue(0,getRow(0),"sid");
|
||||
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);
|
||||
alert(returnValue);
|
||||
reloadSelf();
|
||||
}
|
||||
function newRecord(){
|
||||
var sUrl = "";
|
||||
AsControl.OpenView(sUrl,'','_self','');
|
||||
}
|
||||
function viewAndEdit(){
|
||||
var sUrl = "/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList.jsp";
|
||||
|
||||
var sPara = getItemValue(0,getRow(0),'ID');
|
||||
if(typeof(sPara)=="undefined" || sPara.length==0 ){
|
||||
alert("参数不能为空!");
|
||||
return ;
|
||||
}
|
||||
AsControl.OpenView(sUrl,'invoice_confirm_id=' +sPara ,'_self','');
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -9,8 +9,8 @@
|
||||
<MYSQL>
|
||||
<table_sql>
|
||||
<![CDATA[
|
||||
SELECT fr.id,fr.contractnumber,fr.paymentnumber,fr.customername,fr.planlist,fr.plandate,fr.planmoney,fr.factdate,fr.factmoney,fr.invoicemoney,fr.feetype,fr.invoiceobject,fr.taxregcode,fr.taxbank,fr.taxacc,fr.invoicephone,fr.invoiceadd,fr.invoicestatus,fr.leaseform,fr.feetypecode,ii.appid,ii.sid,ii.yylxdm,ii.fplxdm,ii.kplx,ii.tspz,ii.xhdwdzdh,ii.xhdwyhzh,ii.ghdwsbh,ii.ghdwmc,ii.ghdwdzdh,ii.ghdwyhzh,ii.hsslbs,ii.fyxm,ii.fphxz,ii.spmc,ii.spsm,ii.ggxh,ii.dw,ii.spsl,ii.dj,ii.je,ii.sl,ii.se,ii.hsbz,ii.spbm,ii.zxbm,ii.yhzcbs,ii.slbs,ii.zzstsgl,ii.zhsl,ii.hjje,ii.hjse,ii.jshj,ii.bz,ii.skr,ii.fhr,ii.kpr,ii.zyspmc,ii.ssyf,ii.tzdbh,ii.yfphm,ii.yfpdm,ii.GMF_DZYX,ii.GMF_SJHM,ii.GMF_SJOPENID FROM
|
||||
(SELECT id,contractnumber,paymentnumber,customername,planlist,plandate,planmoney,factdate,factmoney,invoicemoney,feetype,invoiceobject,taxregcode,taxbank,taxacc,invoicephone,invoiceadd,invoicestatus,leaseform,feetypecode FROM (
|
||||
|
||||
SELECT id,contractnumber,paymentnumber,customername,planlist,plandate,planmoney,factdate,factmoney,invoicemoney,feetype,invoiceobject,taxregcode,taxbank,taxacc,invoicephone,invoiceadd,invoicestatus,leaseform,feetypecode FROM (
|
||||
SELECT
|
||||
lfii.id AS id,
|
||||
lci.contract_number AS contractnumber,
|
||||
@ -174,8 +174,7 @@
|
||||
LEFT JOIN code_library leasecode ON leasecode.itemno=lci.lease_form AND leasecode.codeno='leas_form'
|
||||
LEFT JOIN code_library invoicecode ON invoicecode.itemno=lrii.invoice_type AND invoicecode.codeno='invoice_type'
|
||||
WHERE lrii.income_id IS NULL AND lrii.plan_id IS NULL AND lrii.payment_number IS NOT NULL AND lrii.bill_type='invoice'
|
||||
) tab WHERE 1=1 AND tab.invoicestatus IN ('已申请') ORDER BY paymentnumber) fr
|
||||
LEFT JOIN invoice_interface ii ON fr.id=ii.invoice_id
|
||||
) tab WHERE 1=1 AND tab.invoicestatus IN ('已申请') ORDER BY paymentnumber
|
||||
]]>
|
||||
</table_sql>
|
||||
</MYSQL>
|
||||
|
||||
@ -79,8 +79,8 @@
|
||||
<!--ClassifyObjectType Remark BusinessDueBill:五级分类按借据,BusinessContract:五级分类按合同 -->
|
||||
<ClassifyObjectType>BusinessDueBill</ClassifyObjectType>
|
||||
<!-- =========================================业务配置 - end ========================================= -->
|
||||
<ReportServer>http://localhost:8080/report</ReportServer>
|
||||
<ReportOutServer>http://localhost:8080/report</ReportOutServer>
|
||||
<ReportServer>http://47.93.34.101/report</ReportServer>
|
||||
<ReportOutServer>http://47.93.34.101/report</ReportOutServer>
|
||||
|
||||
<!-- =========================================APP推送配置 - begin ========================================= -->
|
||||
<IS_PUSH>true</IS_PUSH>
|
||||
@ -117,4 +117,9 @@
|
||||
<!-- =======招商银行网银经办接口===== -->
|
||||
<SDK_CMB_URL>http://172.16.20.242:65188</SDK_CMB_URL>
|
||||
<SDK_CMB_TIME_OUT>30000</SDK_CMB_TIME_OUT>
|
||||
<!-- =======¿ªÆ±½Ó¿Ú===== -->
|
||||
<INVOICE_URL>http://fpfw2.aiee.fun:8899/fpfw2/api/kpbusiness</INVOICE_URL>
|
||||
<INVOICE_APPID>77c61651-f40e-4536-9991-bba64bd3521e</INVOICE_APPID>
|
||||
<INVOICE_SPBM>3060109010000000000</INVOICE_SPBM>
|
||||
<INVOICE_LOCAL_PATH>E:\\pdf</INVOICE_LOCAL_PATH>
|
||||
</Domain>
|
||||
@ -3362,15 +3362,17 @@
|
||||
<attributes>
|
||||
<attribute name="ID" label="标识" type="STRING" length="32"/>
|
||||
<attribute name="sid" label="交易流水id" type="STRING" length="100"/>
|
||||
<attribute name="fplxdm" label="发票类型代码" type="STRING" length="2"/>
|
||||
<attribute name="fpdm" label="发票代码" type="STRING" length="10"/>
|
||||
<attribute name="fplxdm" label="发票类型代码" type="STRING" length="3"/>
|
||||
<attribute name="fpdm" label="发票代码" type="STRING" length="20"/>
|
||||
<attribute name="fphm" label="发票号码" type="STRING" length="8"/>
|
||||
<attribute name="kprq" label="开票日期" type="STRING" length="14"/>
|
||||
<attribute name="hjje" label="合计金额" type="STRING" length="32"/>
|
||||
<attribute name="skm" label="税控码" type="STRING" length="112"/>
|
||||
<attribute name="jym" label="校验码" type="STRING" length="22"/>
|
||||
<attribute name="skm" label="税控码" type="STRING" length="200"/>
|
||||
<attribute name="jym" label="校验码" type="STRING" length="30"/>
|
||||
<attribute name="pdfurl" label="电子票PDF文件下载地址" type="STRING" length="500"/>
|
||||
<attribute name="localFile" label="电子票PDF文件本地地址" type="STRING" length="500"/>
|
||||
<attribute name="localFile" label="电子票PDF文件本地地址" type="STRING" length="500"/>
|
||||
<attribute name="returncode" label="结果状态码" type="STRING" length="1"/>
|
||||
<attribute name="returnmsg" label="结果描述" type="STRING" length="20"/>
|
||||
<attribute name="FIELD1" label="FIELD1" type="STRING" length="32"/>
|
||||
<attribute name="FIELD2" label="FIELD2" type="STRING" length="32"/>
|
||||
<attribute name="FIELD3" label="FIELD3" type="STRING" length="32"/>
|
||||
|
||||
@ -178,6 +178,10 @@
|
||||
<servlet-name>FileTemplateViewServlet</servlet-name>
|
||||
<servlet-class>com.amarsoft.filetemplate.servlet.FileTemplateViewServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>InvoiceDownloadServlet</servlet-name>
|
||||
<servlet-class>com.tenwa.app.invoice.servlet.InvoiceDownloadServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>DocDownloadServlet</servlet-name>
|
||||
<servlet-class>com.tenwa.doc.servlet.DocDownloadServlet</servlet-class>
|
||||
@ -262,6 +266,10 @@
|
||||
<servlet-name>FileTemplateViewServlet</servlet-name>
|
||||
<url-pattern>/servlet/view/fileTemplateView</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>InvoiceDownloadServlet</servlet-name>
|
||||
<url-pattern>/servlet/view/invoiceDownloadServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>DocDownloadServlet</servlet-name>
|
||||
<url-pattern>/servlet/view/docDownloadServlet</url-pattern>
|
||||
|
||||
183
src_invoice/com/tenwa/app/invoice/action/InvoiceRequest.java
Normal file
183
src_invoice/com/tenwa/app/invoice/action/InvoiceRequest.java
Normal file
@ -0,0 +1,183 @@
|
||||
package com.tenwa.app.invoice.action;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.awe.Configure;
|
||||
import com.tenwa.app.invoice.data.ResponseEnum;
|
||||
import com.tenwa.app.invoice.pojo.ResultPojo;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestBase;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestBody;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestFyxm;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestGroup;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestHead;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestInput;
|
||||
import com.tenwa.app.invoice.utils.JaxbUtil;
|
||||
import com.tenwa.app.invoice.utils.PasswordGenerateUtil;
|
||||
import com.tenwa.app.invoice.utils.ResultUtil;
|
||||
|
||||
public class InvoiceRequest {
|
||||
|
||||
private String url ="" ;
|
||||
private String appId="" ;
|
||||
private String fplxdm="026";
|
||||
|
||||
public InvoiceRequest(String fplxdm) {
|
||||
this.fplxdm = fplxdm;
|
||||
}
|
||||
public InvoiceRequest() {
|
||||
}
|
||||
public ResultPojo send(BizObject confirmBizObject,List<BizObject> confirmDetailList) throws JBOException{
|
||||
Configure config = Configure.getInstance();
|
||||
try {
|
||||
url = config.getConfigure("INVOICE_URL") ;
|
||||
appId = config.getConfigure("INVOICE_APPID") ;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error("读取a3web的开票接口配置文件失败");
|
||||
}
|
||||
|
||||
InvoiceRequestBase base = new InvoiceRequestBase();
|
||||
|
||||
base.setComment("发票开具");
|
||||
base.setId("FPKJ");
|
||||
base.setVersion("2.0");
|
||||
|
||||
InvoiceRequestHead head = new InvoiceRequestHead();
|
||||
head.setAppid(this.appId);
|
||||
head.setSid(confirmBizObject.getAttribute("sid").toString());
|
||||
base.setHead(head);
|
||||
|
||||
InvoiceRequestBody body = new InvoiceRequestBody();
|
||||
|
||||
InvoiceRequestInput input = new InvoiceRequestInput();
|
||||
input.setFplxdm(this.fplxdm);
|
||||
input.setKplx("0");
|
||||
input.setTspz("00");
|
||||
input.setXhdwdzdh(confirmBizObject.getAttribute("xhdwdzdh").toString());
|
||||
input.setXhdwyhzh(confirmBizObject.getAttribute("Xhdwyhzh").toString());
|
||||
input.setGhdwsbh(confirmBizObject.getAttribute("ghdwsbh").toString());
|
||||
input.setGhdwmc(confirmBizObject.getAttribute("ghdwmc").toString());
|
||||
input.setGhdwdzdh(confirmBizObject.getAttribute("ghdwdzdh").toString());
|
||||
input.setGhdwyhzh(confirmBizObject.getAttribute("ghdwyhzh").toString());
|
||||
input.setHsslbs("0");
|
||||
input.setZhsl(confirmBizObject.getAttribute("zhsl").toString());
|
||||
input.setHjje(confirmBizObject.getAttribute("hjje").toString());
|
||||
input.setHjse(confirmBizObject.getAttribute("hjse").toString());
|
||||
input.setJshj(confirmBizObject.getAttribute("jshj").toString());
|
||||
input.setBz("");
|
||||
input.setSkr("");
|
||||
input.setFhr("");
|
||||
input.setKpr(confirmBizObject.getAttribute("kpr").toString());
|
||||
input.setZyspmc(confirmBizObject.getAttribute("zyspmc").toString());
|
||||
input.setSpsm("");
|
||||
input.setSsyf("");
|
||||
input.setTzdbh("");
|
||||
input.setYfpdm("");
|
||||
input.setYfphm("");
|
||||
input.setGMF_DZYX("");
|
||||
input.setGMF_SJHM(confirmBizObject.getAttribute("GMF_SJHM").toString());
|
||||
input.setGMF_OPENID("");
|
||||
|
||||
InvoiceRequestFyxm fyxm = new InvoiceRequestFyxm();
|
||||
|
||||
List<InvoiceRequestGroup> groupList = new ArrayList<InvoiceRequestGroup>();
|
||||
int index=1;
|
||||
for(BizObject confirmDetailBizObject :confirmDetailList){
|
||||
InvoiceRequestGroup group = new InvoiceRequestGroup();
|
||||
group.setXh(String.valueOf(index));
|
||||
group.setFphxz(confirmDetailBizObject.getAttribute("fphxz").toString());
|
||||
group.setSpmc(confirmDetailBizObject.getAttribute("spmc").toString());
|
||||
group.setSpsm(confirmDetailBizObject.getAttribute("spsm").toString());
|
||||
group.setGgxh(confirmDetailBizObject.getAttribute("ggxh").toString());
|
||||
group.setDw(confirmDetailBizObject.getAttribute("dw").toString());
|
||||
group.setSpsl(confirmDetailBizObject.getAttribute("spsl").toString());
|
||||
group.setDj(confirmDetailBizObject.getAttribute("dj").toString());
|
||||
group.setJe(confirmDetailBizObject.getAttribute("je").toString());
|
||||
group.setSl(confirmDetailBizObject.getAttribute("sl").toString());
|
||||
group.setSe(confirmDetailBizObject.getAttribute("Se").toString());
|
||||
group.setHsbz(confirmDetailBizObject.getAttribute("hsbz").toString());
|
||||
group.setSpbm(confirmDetailBizObject.getAttribute("spbm").toString());
|
||||
group.setZxbm(confirmDetailBizObject.getAttribute("zxbm").toString());
|
||||
group.setYhzcbs(confirmDetailBizObject.getAttribute("yhzcbs").toString());
|
||||
group.setSlbs(confirmDetailBizObject.getAttribute("slbs").toString());
|
||||
group.setZzstsgl(confirmDetailBizObject.getAttribute("zzstsgl").toString());
|
||||
|
||||
groupList.add(group);
|
||||
++index;
|
||||
}
|
||||
|
||||
|
||||
fyxm.setGroupList(groupList);
|
||||
fyxm.setCount(String.valueOf( groupList.size() ));
|
||||
input.setFyxm(fyxm);
|
||||
|
||||
|
||||
body.setYylxdm("1");
|
||||
body.setInput(input);
|
||||
base.setBody(body);
|
||||
|
||||
String xml = JaxbUtil.convertToXml(base);
|
||||
System.out.println(xml);
|
||||
ResultPojo result= doPost(xml);
|
||||
|
||||
return result;
|
||||
//return ResultUtil.error("ERROR[01]");
|
||||
}
|
||||
|
||||
public ResultPojo findResult(String sid) throws JBOException{
|
||||
Configure config = Configure.getInstance();
|
||||
try {
|
||||
url = config.getConfigure("INVOICE_URL") ;
|
||||
appId = config.getConfigure("INVOICE_APPID") ;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error("读取a3web的开票接口配置文件失败");
|
||||
}
|
||||
|
||||
InvoiceRequestBase invoiceRequestBase = new InvoiceRequestBase();
|
||||
InvoiceRequestHead invoiceRequestHead = new InvoiceRequestHead();
|
||||
invoiceRequestHead.setAppid(this.appId);
|
||||
invoiceRequestHead.setSid(sid);
|
||||
|
||||
invoiceRequestBase.setHead(invoiceRequestHead);
|
||||
invoiceRequestBase.setComment("查询开票结果");
|
||||
invoiceRequestBase.setId("CXKPJG");
|
||||
invoiceRequestBase.setVersion("1.0");
|
||||
|
||||
String xml = JaxbUtil.convertToXml(invoiceRequestBase);
|
||||
ResultPojo result = doPost(xml);
|
||||
return result;
|
||||
}
|
||||
public ResultPojo doPost(String xml){
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
param.add("bw",xml) ;
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(param, httpHeaders);
|
||||
ResponseEntity<String> response = null ;
|
||||
try {
|
||||
response = restTemplate.exchange(this.url, HttpMethod.POST, entity, String.class);
|
||||
}catch (Exception e){
|
||||
return ResultUtil.error(ResponseEnum.NETWORK.getMsg());
|
||||
}
|
||||
System.out.println(response.getBody());
|
||||
InvoiceRequestBase r = JaxbUtil.converyToJavaBean(response.getBody(), InvoiceRequestBase.class);
|
||||
return ResultUtil.success(r);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
38
src_invoice/com/tenwa/app/invoice/data/ResponseEnum.java
Normal file
38
src_invoice/com/tenwa/app/invoice/data/ResponseEnum.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.tenwa.app.invoice.data;
|
||||
|
||||
public enum ResponseEnum {
|
||||
|
||||
SUCCESS(0,"³É¹¦"),
|
||||
NETWORK(-3,"ÍøÂç³ö´í"),
|
||||
ERROR(-1,"ʧ°Ü");
|
||||
|
||||
|
||||
|
||||
private Integer code ;
|
||||
private String msg;
|
||||
|
||||
|
||||
ResponseEnum() {
|
||||
}
|
||||
|
||||
ResponseEnum(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.tenwa.app.invoice.exception;
|
||||
|
||||
public class InvoiceException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer errorCode ;
|
||||
private String errorMsg ;
|
||||
|
||||
public Integer getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(Integer errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getErrorMsg() {
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
public void setErrorMsg(String errorMsg) {
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public InvoiceException(String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorMsg = errorMsg ;
|
||||
}
|
||||
public InvoiceException(Integer errorCode , String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = errorCode ;
|
||||
this.errorMsg = errorMsg ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
31
src_invoice/com/tenwa/app/invoice/pojo/ResultPojo.java
Normal file
31
src_invoice/com/tenwa/app/invoice/pojo/ResultPojo.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.tenwa.app.invoice.pojo;
|
||||
|
||||
public class ResultPojo {
|
||||
private Integer code;
|
||||
private String msg ;
|
||||
private Object data;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.tenwa.app.invoice.request;
|
||||
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "business")
|
||||
public class InvoiceRequestBase {
|
||||
|
||||
@XmlAttribute
|
||||
private String comment ;
|
||||
@XmlAttribute
|
||||
private String id ;
|
||||
@XmlAttribute
|
||||
private String version ;
|
||||
|
||||
@XmlElement
|
||||
private InvoiceRequestHead head ;
|
||||
@XmlElement
|
||||
private InvoiceRequestBody body ;
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public InvoiceRequestHead getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public void setHead(InvoiceRequestHead head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public InvoiceRequestBody getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(InvoiceRequestBody body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.tenwa.app.invoice.request;
|
||||
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "body")
|
||||
public class InvoiceRequestBody {
|
||||
@XmlElement
|
||||
private String returncode ;
|
||||
@XmlElement
|
||||
private String returnmsg ;
|
||||
@XmlElement
|
||||
private String fplxdm ;
|
||||
@XmlElement
|
||||
private String fpdm ;
|
||||
@XmlElement
|
||||
private String fphm ;
|
||||
@XmlElement
|
||||
private String kprq ;
|
||||
@XmlElement
|
||||
private String hjje ;
|
||||
@XmlElement
|
||||
private String skm ;
|
||||
@XmlElement
|
||||
private String jym ;
|
||||
@XmlElement
|
||||
private String pdfurl ;
|
||||
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
private String yylxdm ;
|
||||
|
||||
@XmlElement
|
||||
private InvoiceRequestInput input ;
|
||||
|
||||
public String getYylxdm() {
|
||||
return yylxdm;
|
||||
}
|
||||
|
||||
public void setYylxdm(String yylxdm) {
|
||||
this.yylxdm = yylxdm;
|
||||
}
|
||||
|
||||
public InvoiceRequestInput getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public void setInput(InvoiceRequestInput input) {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
public String getReturncode() {
|
||||
return returncode;
|
||||
}
|
||||
|
||||
public void setReturncode(String returncode) {
|
||||
this.returncode = returncode;
|
||||
}
|
||||
|
||||
public String getReturnmsg() {
|
||||
return returnmsg;
|
||||
}
|
||||
|
||||
public void setReturnmsg(String returnmsg) {
|
||||
this.returnmsg = returnmsg;
|
||||
}
|
||||
|
||||
public String getFplxdm() {
|
||||
return fplxdm;
|
||||
}
|
||||
|
||||
public void setFplxdm(String fplxdm) {
|
||||
this.fplxdm = fplxdm;
|
||||
}
|
||||
|
||||
public String getFpdm() {
|
||||
return fpdm;
|
||||
}
|
||||
|
||||
public void setFpdm(String fpdm) {
|
||||
this.fpdm = fpdm;
|
||||
}
|
||||
|
||||
public String getFphm() {
|
||||
return fphm;
|
||||
}
|
||||
|
||||
public void setFphm(String fphm) {
|
||||
this.fphm = fphm;
|
||||
}
|
||||
|
||||
public String getKprq() {
|
||||
return kprq;
|
||||
}
|
||||
|
||||
public void setKprq(String kprq) {
|
||||
this.kprq = kprq;
|
||||
}
|
||||
|
||||
public String getHjje() {
|
||||
return hjje;
|
||||
}
|
||||
|
||||
public void setHjje(String hjje) {
|
||||
this.hjje = hjje;
|
||||
}
|
||||
|
||||
public String getSkm() {
|
||||
return skm;
|
||||
}
|
||||
|
||||
public void setSkm(String skm) {
|
||||
this.skm = skm;
|
||||
}
|
||||
|
||||
public String getJym() {
|
||||
return jym;
|
||||
}
|
||||
|
||||
public void setJym(String jym) {
|
||||
this.jym = jym;
|
||||
}
|
||||
|
||||
public String getPdfurl() {
|
||||
return pdfurl;
|
||||
}
|
||||
|
||||
public void setPdfurl(String pdfurl) {
|
||||
this.pdfurl = pdfurl;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.tenwa.app.invoice.request;
|
||||
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "fyxm")
|
||||
public class InvoiceRequestFyxm {
|
||||
@XmlAttribute
|
||||
private String count ;
|
||||
|
||||
@XmlElement(name="group")
|
||||
private List<InvoiceRequestGroup> groupList ;
|
||||
|
||||
public String getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(String count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public List<InvoiceRequestGroup> getGroupList() {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public void setGroupList(List<InvoiceRequestGroup> groupList) {
|
||||
this.groupList = groupList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,181 @@
|
||||
package com.tenwa.app.invoice.request;
|
||||
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "group")
|
||||
public class InvoiceRequestGroup {
|
||||
@XmlAttribute
|
||||
private String xh ;
|
||||
|
||||
@XmlElement
|
||||
private String fphxz;
|
||||
@XmlElement
|
||||
private String spmc;
|
||||
@XmlElement
|
||||
private String spsm;
|
||||
@XmlElement
|
||||
private String ggxh;
|
||||
@XmlElement
|
||||
private String dw;
|
||||
@XmlElement
|
||||
private String spsl;
|
||||
@XmlElement
|
||||
private String dj;
|
||||
@XmlElement
|
||||
private String je;
|
||||
@XmlElement
|
||||
private String sl;
|
||||
@XmlElement
|
||||
private String se;
|
||||
@XmlElement
|
||||
private String hsbz;
|
||||
@XmlElement
|
||||
private String spbm;
|
||||
@XmlElement
|
||||
private String zxbm;
|
||||
@XmlElement
|
||||
private String yhzcbs;
|
||||
@XmlElement
|
||||
private String slbs;
|
||||
@XmlElement
|
||||
private String zzstsgl;
|
||||
|
||||
|
||||
public String getXh() {
|
||||
return xh;
|
||||
}
|
||||
|
||||
public void setXh(String xh) {
|
||||
this.xh = xh;
|
||||
}
|
||||
|
||||
public String getFphxz() {
|
||||
return fphxz;
|
||||
}
|
||||
|
||||
public void setFphxz(String fphxz) {
|
||||
this.fphxz = fphxz;
|
||||
}
|
||||
|
||||
public String getSpmc() {
|
||||
return spmc;
|
||||
}
|
||||
|
||||
public void setSpmc(String spmc) {
|
||||
this.spmc = spmc;
|
||||
}
|
||||
|
||||
public String getSpsm() {
|
||||
return spsm;
|
||||
}
|
||||
|
||||
public void setSpsm(String spsm) {
|
||||
this.spsm = spsm;
|
||||
}
|
||||
|
||||
public String getGgxh() {
|
||||
return ggxh;
|
||||
}
|
||||
|
||||
public void setGgxh(String ggxh) {
|
||||
this.ggxh = ggxh;
|
||||
}
|
||||
|
||||
public String getDw() {
|
||||
return dw;
|
||||
}
|
||||
|
||||
public void setDw(String dw) {
|
||||
this.dw = dw;
|
||||
}
|
||||
|
||||
public String getSpsl() {
|
||||
return spsl;
|
||||
}
|
||||
|
||||
public void setSpsl(String spsl) {
|
||||
this.spsl = spsl;
|
||||
}
|
||||
|
||||
public String getDj() {
|
||||
return dj;
|
||||
}
|
||||
|
||||
public void setDj(String dj) {
|
||||
this.dj = dj;
|
||||
}
|
||||
|
||||
public String getJe() {
|
||||
return je;
|
||||
}
|
||||
|
||||
public void setJe(String je) {
|
||||
this.je = je;
|
||||
}
|
||||
|
||||
public String getSl() {
|
||||
return sl;
|
||||
}
|
||||
|
||||
public void setSl(String sl) {
|
||||
this.sl = sl;
|
||||
}
|
||||
|
||||
public String getSe() {
|
||||
return se;
|
||||
}
|
||||
|
||||
public void setSe(String se) {
|
||||
this.se = se;
|
||||
}
|
||||
|
||||
public String getHsbz() {
|
||||
return hsbz;
|
||||
}
|
||||
|
||||
public void setHsbz(String hsbz) {
|
||||
this.hsbz = hsbz;
|
||||
}
|
||||
|
||||
public String getSpbm() {
|
||||
return spbm;
|
||||
}
|
||||
|
||||
public void setSpbm(String spbm) {
|
||||
this.spbm = spbm;
|
||||
}
|
||||
|
||||
public String getZxbm() {
|
||||
return zxbm;
|
||||
}
|
||||
|
||||
public void setZxbm(String zxbm) {
|
||||
this.zxbm = zxbm;
|
||||
}
|
||||
|
||||
public String getYhzcbs() {
|
||||
return yhzcbs;
|
||||
}
|
||||
|
||||
public void setYhzcbs(String yhzcbs) {
|
||||
this.yhzcbs = yhzcbs;
|
||||
}
|
||||
|
||||
public String getSlbs() {
|
||||
return slbs;
|
||||
}
|
||||
|
||||
public void setSlbs(String slbs) {
|
||||
this.slbs = slbs;
|
||||
}
|
||||
|
||||
public String getZzstsgl() {
|
||||
return zzstsgl;
|
||||
}
|
||||
|
||||
public void setZzstsgl(String zzstsgl) {
|
||||
this.zzstsgl = zzstsgl;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.tenwa.app.invoice.request;
|
||||
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "head")
|
||||
public class InvoiceRequestHead {
|
||||
@XmlElement
|
||||
private String appid ;
|
||||
@XmlElement
|
||||
private String sid ;
|
||||
|
||||
public String getAppid() {
|
||||
return appid;
|
||||
}
|
||||
|
||||
public void setAppid(String appid) {
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,307 @@
|
||||
package com.tenwa.app.invoice.request;
|
||||
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "input")
|
||||
public class InvoiceRequestInput {
|
||||
@XmlElement
|
||||
private String fplxdm ;
|
||||
@XmlElement
|
||||
private String kplx ;
|
||||
@XmlElement
|
||||
private String tspz ;
|
||||
@XmlElement
|
||||
private String xhdwdzdh ;
|
||||
@XmlElement
|
||||
private String xhdwyhzh ;
|
||||
@XmlElement
|
||||
private String ghdwsbh ;
|
||||
@XmlElement
|
||||
private String ghdwmc ;
|
||||
@XmlElement
|
||||
private String ghdwdzdh ;
|
||||
@XmlElement
|
||||
private String ghdwyhzh ;
|
||||
@XmlElement
|
||||
private String hsslbs ;
|
||||
|
||||
|
||||
@XmlElement
|
||||
private InvoiceRequestFyxm fyxm ;
|
||||
|
||||
|
||||
@XmlElement
|
||||
private String zhsl ;
|
||||
@XmlElement
|
||||
private String isMutiRate;
|
||||
@XmlElement
|
||||
private String hjje ;
|
||||
@XmlElement
|
||||
private String hjse ;
|
||||
@XmlElement
|
||||
private String jshj ;
|
||||
@XmlElement
|
||||
private String bz ;
|
||||
@XmlElement
|
||||
private String skr ;
|
||||
@XmlElement
|
||||
private String fhr ;
|
||||
@XmlElement
|
||||
private String kpr ;
|
||||
@XmlElement
|
||||
private String zyspmc ;
|
||||
@XmlElement
|
||||
private String spsm ;
|
||||
@XmlElement
|
||||
private String ssyf ;
|
||||
@XmlElement
|
||||
private String tzdbh ;
|
||||
@XmlElement
|
||||
private String yfpdm ;
|
||||
@XmlElement
|
||||
private String yfphm ;
|
||||
@XmlElement
|
||||
private String GMF_DZYX ;
|
||||
@XmlElement
|
||||
private String GMF_SJHM ;
|
||||
@XmlElement
|
||||
private String GMF_OPENID ;
|
||||
|
||||
|
||||
public String getFplxdm() {
|
||||
return fplxdm;
|
||||
}
|
||||
|
||||
public void setFplxdm(String fplxdm) {
|
||||
this.fplxdm = fplxdm;
|
||||
}
|
||||
|
||||
public String getKplx() {
|
||||
return kplx;
|
||||
}
|
||||
|
||||
public void setKplx(String kplx) {
|
||||
this.kplx = kplx;
|
||||
}
|
||||
|
||||
public String getTspz() {
|
||||
return tspz;
|
||||
}
|
||||
|
||||
public void setTspz(String tspz) {
|
||||
this.tspz = tspz;
|
||||
}
|
||||
|
||||
public String getXhdwdzdh() {
|
||||
return xhdwdzdh;
|
||||
}
|
||||
|
||||
public void setXhdwdzdh(String xhdwdzdh) {
|
||||
this.xhdwdzdh = xhdwdzdh;
|
||||
}
|
||||
|
||||
public String getXhdwyhzh() {
|
||||
return xhdwyhzh;
|
||||
}
|
||||
|
||||
public void setXhdwyhzh(String xhdwyhzh) {
|
||||
this.xhdwyhzh = xhdwyhzh;
|
||||
}
|
||||
|
||||
public String getGhdwsbh() {
|
||||
return ghdwsbh;
|
||||
}
|
||||
|
||||
public void setGhdwsbh(String ghdwsbh) {
|
||||
this.ghdwsbh = ghdwsbh;
|
||||
}
|
||||
|
||||
public String getGhdwmc() {
|
||||
return ghdwmc;
|
||||
}
|
||||
|
||||
public void setGhdwmc(String ghdwmc) {
|
||||
this.ghdwmc = ghdwmc;
|
||||
}
|
||||
|
||||
public String getGhdwdzdh() {
|
||||
return ghdwdzdh;
|
||||
}
|
||||
|
||||
public void setGhdwdzdh(String ghdwdzdh) {
|
||||
this.ghdwdzdh = ghdwdzdh;
|
||||
}
|
||||
|
||||
public String getGhdwyhzh() {
|
||||
return ghdwyhzh;
|
||||
}
|
||||
|
||||
public void setGhdwyhzh(String ghdwyhzh) {
|
||||
this.ghdwyhzh = ghdwyhzh;
|
||||
}
|
||||
|
||||
public String getHsslbs() {
|
||||
return hsslbs;
|
||||
}
|
||||
|
||||
public void setHsslbs(String hsslbs) {
|
||||
this.hsslbs = hsslbs;
|
||||
}
|
||||
|
||||
public InvoiceRequestFyxm getFyxm() {
|
||||
return fyxm;
|
||||
}
|
||||
|
||||
public void setFyxm(InvoiceRequestFyxm fyxm) {
|
||||
this.fyxm = fyxm;
|
||||
}
|
||||
|
||||
public String getZhsl() {
|
||||
return zhsl;
|
||||
}
|
||||
|
||||
public void setZhsl(String zhsl) {
|
||||
this.zhsl = zhsl;
|
||||
}
|
||||
|
||||
public String getIsMutiRate() {
|
||||
return isMutiRate;
|
||||
}
|
||||
|
||||
public void setIsMutiRate(String isMutiRate) {
|
||||
this.isMutiRate = isMutiRate;
|
||||
}
|
||||
|
||||
public String getHjje() {
|
||||
return hjje;
|
||||
}
|
||||
|
||||
public void setHjje(String hjje) {
|
||||
this.hjje = hjje;
|
||||
}
|
||||
|
||||
public String getHjse() {
|
||||
return hjse;
|
||||
}
|
||||
|
||||
public void setHjse(String hjse) {
|
||||
this.hjse = hjse;
|
||||
}
|
||||
|
||||
public String getJshj() {
|
||||
return jshj;
|
||||
}
|
||||
|
||||
public void setJshj(String jshj) {
|
||||
this.jshj = jshj;
|
||||
}
|
||||
|
||||
public String getBz() {
|
||||
return bz;
|
||||
}
|
||||
|
||||
public void setBz(String bz) {
|
||||
this.bz = bz;
|
||||
}
|
||||
|
||||
public String getSkr() {
|
||||
return skr;
|
||||
}
|
||||
|
||||
public void setSkr(String skr) {
|
||||
this.skr = skr;
|
||||
}
|
||||
|
||||
public String getFhr() {
|
||||
return fhr;
|
||||
}
|
||||
|
||||
public void setFhr(String fhr) {
|
||||
this.fhr = fhr;
|
||||
}
|
||||
|
||||
public String getKpr() {
|
||||
return kpr;
|
||||
}
|
||||
|
||||
public void setKpr(String kpr) {
|
||||
this.kpr = kpr;
|
||||
}
|
||||
|
||||
public String getZyspmc() {
|
||||
return zyspmc;
|
||||
}
|
||||
|
||||
public void setZyspmc(String zyspmc) {
|
||||
this.zyspmc = zyspmc;
|
||||
}
|
||||
|
||||
public String getSpsm() {
|
||||
return spsm;
|
||||
}
|
||||
|
||||
public void setSpsm(String spsm) {
|
||||
this.spsm = spsm;
|
||||
}
|
||||
|
||||
public String getSsyf() {
|
||||
return ssyf;
|
||||
}
|
||||
|
||||
public void setSsyf(String ssyf) {
|
||||
this.ssyf = ssyf;
|
||||
}
|
||||
|
||||
public String getTzdbh() {
|
||||
return tzdbh;
|
||||
}
|
||||
|
||||
public void setTzdbh(String tzdbh) {
|
||||
this.tzdbh = tzdbh;
|
||||
}
|
||||
|
||||
public String getYfpdm() {
|
||||
return yfpdm;
|
||||
}
|
||||
|
||||
public void setYfpdm(String yfpdm) {
|
||||
this.yfpdm = yfpdm;
|
||||
}
|
||||
|
||||
public String getYfphm() {
|
||||
return yfphm;
|
||||
}
|
||||
|
||||
public void setYfphm(String yfphm) {
|
||||
this.yfphm = yfphm;
|
||||
}
|
||||
|
||||
public String getGMF_DZYX() {
|
||||
return GMF_DZYX;
|
||||
}
|
||||
|
||||
public void setGMF_DZYX(String GMF_DZYX) {
|
||||
this.GMF_DZYX = GMF_DZYX;
|
||||
}
|
||||
|
||||
public String getGMF_SJHM() {
|
||||
return GMF_SJHM;
|
||||
}
|
||||
|
||||
public void setGMF_SJHM(String GMF_SJHM) {
|
||||
this.GMF_SJHM = GMF_SJHM;
|
||||
}
|
||||
|
||||
public String getGMF_OPENID() {
|
||||
return GMF_OPENID;
|
||||
}
|
||||
|
||||
public void setGMF_OPENID(String GMF_OPENID) {
|
||||
this.GMF_OPENID = GMF_OPENID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
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.net.URLDecoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
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.util.DataConvert;
|
||||
import com.amarsoft.awe.Configure;
|
||||
import com.tenwa.util.SecurityUtil;
|
||||
|
||||
public class InvoiceDownloadServlet extends HttpServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvoiceDownloadServlet() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
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 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";
|
||||
response.setContentType(getServletContext().getMimeType(filename));
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
|
||||
InputStream in = new FileInputStream(localFile);
|
||||
OutputStream out = response.getOutputStream();
|
||||
int b;
|
||||
while ((b = in.read()) != -1) {
|
||||
out.write(b);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
ARE.getLog().error("AttachmentView SQL Error:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
59
src_invoice/com/tenwa/app/invoice/utils/DownloadPdfUtil.java
Normal file
59
src_invoice/com/tenwa/app/invoice/utils/DownloadPdfUtil.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.tenwa.app.invoice.utils;
|
||||
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
|
||||
public class DownloadPdfUtil {
|
||||
public static void go(String url,String localUrl) throws Exception {
|
||||
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
|
||||
|
||||
URI uri = builder.build(true).toUri();
|
||||
|
||||
String filePath = localUrl ;
|
||||
File file = new File(filePath);
|
||||
File parentFile = file.getParentFile();
|
||||
if(!parentFile.exists()){
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
|
||||
|
||||
try {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
ResponseEntity<byte[]> response = restTemplate.exchange(uri, HttpMethod.GET, new HttpEntity<byte[]>(headers), byte[].class);
|
||||
byte[] result = response.getBody();
|
||||
inputStream = new ByteArrayInputStream(result);
|
||||
|
||||
outputStream = new FileOutputStream(new File(filePath));
|
||||
|
||||
int len = 0;
|
||||
byte[] buf = new byte[1024];
|
||||
while ((len = inputStream.read(buf, 0, 1024)) != -1) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Exception(e);
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) inputStream.close();
|
||||
if (outputStream != null) outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
src_invoice/com/tenwa/app/invoice/utils/JaxbUtil.java
Normal file
63
src_invoice/com/tenwa/app/invoice/utils/JaxbUtil.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.tenwa.app.invoice.utils;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* Jaxb2工具籿 * @author zhuc
|
||||
* @create 2013-3-29 下午2:40:14
|
||||
*/
|
||||
public class JaxbUtil {
|
||||
/**
|
||||
* JavaBean转换成xml
|
||||
* 默认编码UTF-8
|
||||
* @param obj
|
||||
* @param writer
|
||||
* @return
|
||||
*/
|
||||
public static String convertToXml(Object obj) {
|
||||
return convertToXml(obj, "UTF-8");
|
||||
}
|
||||
/**
|
||||
* JavaBean转换成xml
|
||||
* @param obj
|
||||
* @param encoding
|
||||
* @return
|
||||
*/
|
||||
public static String convertToXml(Object obj, String encoding) {
|
||||
String result = null;
|
||||
try {
|
||||
JAXBContext context = JAXBContext.newInstance(obj.getClass());
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||
marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding);
|
||||
StringWriter writer = new StringWriter();
|
||||
marshaller.marshal(obj, writer);
|
||||
result = writer.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* xml转换成JavaBean
|
||||
* @param xml
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T converyToJavaBean(String xml, Class<T> c) {
|
||||
T t = null;
|
||||
try {
|
||||
JAXBContext context = JAXBContext.newInstance(c);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
t = (T) unmarshaller.unmarshal(new StringReader(xml));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
61
src_invoice/com/tenwa/app/invoice/utils/MathUtil.java
Normal file
61
src_invoice/com/tenwa/app/invoice/utils/MathUtil.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.tenwa.app.invoice.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MathUtil {
|
||||
|
||||
/**
|
||||
* 加法运算
|
||||
* @param m1
|
||||
* @param m2
|
||||
* @return
|
||||
*/
|
||||
public static double add(double m1, double m2) {
|
||||
BigDecimal p1 = new BigDecimal(Double.toString(m1));
|
||||
BigDecimal p2 = new BigDecimal(Double.toString(m2));
|
||||
return p1.add(p2).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 减法运算
|
||||
* @param m1
|
||||
* @param m2
|
||||
* @return
|
||||
*/
|
||||
public static double sub(double m1, double m2) {
|
||||
BigDecimal p1 = new BigDecimal(Double.toString(m1));
|
||||
BigDecimal p2 = new BigDecimal(Double.toString(m2));
|
||||
return p1.subtract(p2).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 乘法运算
|
||||
* @param m1
|
||||
* @param m2
|
||||
* @return
|
||||
*/
|
||||
public static double mul(double m1, double m2) {
|
||||
BigDecimal p1 = new BigDecimal(Double.toString(m1));
|
||||
BigDecimal p2 = new BigDecimal(Double.toString(m2));
|
||||
return p1.multiply(p2).doubleValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 除法运算
|
||||
* @param m1
|
||||
* @param m2
|
||||
* @param scale
|
||||
* @return
|
||||
*/
|
||||
public static double div(double m1, double m2, int scale) {
|
||||
if (scale < 0) {
|
||||
throw new IllegalArgumentException("Parameter error");
|
||||
}
|
||||
BigDecimal p1 = new BigDecimal(Double.toString(m1));
|
||||
BigDecimal p2 = new BigDecimal(Double.toString(m2));
|
||||
return p1.divide(p2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
24
src_invoice/com/tenwa/app/invoice/utils/Num2ChineseUtil.java
Normal file
24
src_invoice/com/tenwa/app/invoice/utils/Num2ChineseUtil.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.tenwa.app.invoice.utils;
|
||||
|
||||
public class Num2ChineseUtil {
|
||||
public static String format(String string) {
|
||||
String[] s1 = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
|
||||
String[] s2 = { "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千" };
|
||||
|
||||
String result = "";
|
||||
|
||||
int n = string.length();
|
||||
for (int i = 0; i < n; i++) {
|
||||
|
||||
int num = string.charAt(i) - '0';
|
||||
|
||||
if (i != n - 1 && num != 0) {
|
||||
result += s1[num] + s2[n - 2 - i];
|
||||
} else {
|
||||
result += s1[num];
|
||||
}
|
||||
}
|
||||
return "第"+result+"期";
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package com.tenwa.app.invoice.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
public class PasswordGenerateUtil {
|
||||
/**
|
||||
* 密码类型枚举
|
||||
* @author ASUS
|
||||
*/
|
||||
public static enum TYPE {
|
||||
/**
|
||||
* 字符型
|
||||
*/
|
||||
LETTER,
|
||||
/**
|
||||
* 大写字符型
|
||||
*/
|
||||
CAPITAL,
|
||||
/**
|
||||
* 数字型
|
||||
*/
|
||||
NUMBER,
|
||||
/**
|
||||
* 符号型
|
||||
*/
|
||||
SIGN,
|
||||
/**
|
||||
* 大+小字符 型
|
||||
*/
|
||||
LETTER_CAPITAL,
|
||||
/**
|
||||
* 小字符+数字 型
|
||||
*/
|
||||
LETTER_NUMBER,
|
||||
/**
|
||||
* 大+小字符+数字 型
|
||||
*/
|
||||
LETTER_CAPITAL_NUMBER,
|
||||
/**
|
||||
* 大+小字符+数字+符号 型
|
||||
*/
|
||||
LETTER_CAPITAL_NUMBER_SIGN
|
||||
}
|
||||
|
||||
private static String[] lowercase = {
|
||||
"a","b","c","d","e","f","g","h","i","j","k",
|
||||
"l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
|
||||
|
||||
private static String[] capital = {
|
||||
"A","B","C","D","E","F","G","H","I","J","K",
|
||||
"L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
|
||||
|
||||
private static String[] number = {
|
||||
"1","2","3","4","5","6","7","8","9","0"};
|
||||
|
||||
private static String[] sign = {
|
||||
"~","!","@","#","$","%","^","&","*","(",")","_","+","`","-","=",
|
||||
"{","}","|",":","\"","<",">","?",
|
||||
"[","]","\\",";","'",",",".","/"};
|
||||
|
||||
/**
|
||||
* 静态随机数
|
||||
*/
|
||||
private static Random random = new Random();
|
||||
|
||||
/**
|
||||
* 获取随机组合码
|
||||
* @param num 位数
|
||||
* @param type 类型
|
||||
* @type
|
||||
* <br>字符型 LETTER,
|
||||
* <br>大写字符型 CAPITAL,
|
||||
* <br>数字型 NUMBER,
|
||||
* <br>符号型 SIGN,
|
||||
* <br>大+小字符型 LETTER_CAPITAL,
|
||||
* <br>小字符+数字 型 LETTER_NUMBER,
|
||||
* <br>大+小字符+数字 型 LETTER_CAPITAL_NUMBER,
|
||||
* <br>大+小字符+数字+符号 型 LETTER_CAPITAL_NUMBER_SIGN
|
||||
*/
|
||||
public static String getRandom(int num,TYPE type){
|
||||
ArrayList<String> temp = new ArrayList<String>();
|
||||
StringBuffer code = new StringBuffer();
|
||||
if(type == TYPE.LETTER){
|
||||
temp.addAll(Arrays.asList(lowercase));
|
||||
}else if(type == TYPE.CAPITAL){
|
||||
temp.addAll(Arrays.asList(capital));
|
||||
}else if(type == TYPE.NUMBER){
|
||||
temp.addAll(Arrays.asList(number));
|
||||
}else if(type == TYPE.SIGN){
|
||||
temp.addAll(Arrays.asList(sign));
|
||||
}else if(type == TYPE.LETTER_CAPITAL){
|
||||
temp.addAll(Arrays.asList(lowercase));
|
||||
temp.addAll(Arrays.asList(capital));
|
||||
}else if(type == TYPE.LETTER_NUMBER){
|
||||
temp.addAll(Arrays.asList(lowercase));
|
||||
temp.addAll(Arrays.asList(number));
|
||||
}else if(type == TYPE.LETTER_CAPITAL_NUMBER){
|
||||
temp.addAll(Arrays.asList(lowercase));
|
||||
temp.addAll(Arrays.asList(capital));
|
||||
temp.addAll(Arrays.asList(number));
|
||||
}else if(type == TYPE.LETTER_CAPITAL_NUMBER_SIGN){
|
||||
temp.addAll(Arrays.asList(lowercase));
|
||||
temp.addAll(Arrays.asList(capital));
|
||||
temp.addAll(Arrays.asList(number));
|
||||
temp.addAll(Arrays.asList(sign));
|
||||
}
|
||||
for (int i = 0; i < num; i++) {
|
||||
code.append(temp.get(random.nextInt(temp.size())));
|
||||
}
|
||||
return code.toString();
|
||||
}
|
||||
}
|
||||
47
src_invoice/com/tenwa/app/invoice/utils/ResultUtil.java
Normal file
47
src_invoice/com/tenwa/app/invoice/utils/ResultUtil.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.tenwa.app.invoice.utils;
|
||||
|
||||
|
||||
import com.tenwa.app.invoice.data.ResponseEnum;
|
||||
import com.tenwa.app.invoice.pojo.ResultPojo;
|
||||
|
||||
public class ResultUtil {
|
||||
public static ResultPojo success(Object data){
|
||||
ResultPojo resultPojo = new ResultPojo();
|
||||
resultPojo.setCode(ResponseEnum.SUCCESS.getCode());
|
||||
resultPojo.setMsg(ResponseEnum.SUCCESS.getMsg());
|
||||
resultPojo.setData(data);
|
||||
return resultPojo;
|
||||
}
|
||||
public static ResultPojo success(){
|
||||
ResultPojo resultPojo = new ResultPojo();
|
||||
resultPojo.setCode(ResponseEnum.SUCCESS.getCode());
|
||||
resultPojo.setMsg(ResponseEnum.SUCCESS.getMsg());
|
||||
resultPojo.setData(null);
|
||||
return resultPojo;
|
||||
}
|
||||
public static ResultPojo error(String msg){
|
||||
ResultPojo resultPojo = new ResultPojo();
|
||||
resultPojo.setCode(ResponseEnum.ERROR.getCode());
|
||||
resultPojo.setMsg(msg);
|
||||
resultPojo.setData(null);
|
||||
return resultPojo;
|
||||
}
|
||||
public static ResultPojo error(ResponseEnum responseEnum){
|
||||
ResultPojo resultPojo = new ResultPojo();
|
||||
resultPojo.setCode(responseEnum.getCode());
|
||||
resultPojo.setMsg(responseEnum.getMsg());
|
||||
resultPojo.setData(null);
|
||||
return resultPojo;
|
||||
}
|
||||
public static ResultPojo error(){
|
||||
ResultPojo resultPojo = new ResultPojo();
|
||||
resultPojo.setCode(ResponseEnum.ERROR.getCode());
|
||||
resultPojo.setMsg(ResponseEnum.ERROR.getMsg());
|
||||
resultPojo.setData(null);
|
||||
return resultPojo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,30 +1,73 @@
|
||||
package com.tenwa.lease.app.invoicemanager;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
|
||||
import jbo.app.tenwa.calc.LC_FUND_INCOME;
|
||||
import jbo.app.tenwa.calc.LC_FUND_PLAN;
|
||||
import jbo.app.tenwa.calc.LC_RENT_INCOME;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||||
import jbo.app.tenwa.calc.LI_INVOICE_CONFIRM;
|
||||
import jbo.app.tenwa.calc.LI_INVOICE_CONFIRM_DETAIL;
|
||||
import jbo.app.tenwa.calc.LI_INVOICE_RESULT;
|
||||
import jbo.app.tenwa.calc.VI_LI_INVOICE;
|
||||
import jbo.app.tenwa.customer.CUSTOMER_COMPANY;
|
||||
import jbo.app.tenwa.customer.CUSTOMER_PERSON;
|
||||
import jbo.awe.USER_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_FUND_INVOICE_DOWNLOAD_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_FUND_INVOICE_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_RENT_INVOICE_DOWNLOAD_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_RENT_INVOICE_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_TAX_FUND_UPLOAD_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_TAX_RENT_UPLOAD_INFO;
|
||||
import jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT;
|
||||
import jbo.com.tenwa.entity.comm.own.OWN_INFO;
|
||||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
|
||||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INVOICE_TYPE;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bouncycastle.util.encoders.Base64Encoder;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.alibaba.fastjson.util.Base64;
|
||||
import com.amarsoft.app.lc.util.DateAssistant;
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectKey;
|
||||
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.awe.Configure;
|
||||
import com.tenwa.app.invoice.action.InvoiceRequest;
|
||||
import com.tenwa.app.invoice.data.ResponseEnum;
|
||||
import com.tenwa.app.invoice.pojo.ResultPojo;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestBase;
|
||||
import com.tenwa.app.invoice.request.InvoiceRequestHead;
|
||||
import com.tenwa.app.invoice.utils.DownloadPdfUtil;
|
||||
import com.tenwa.app.invoice.utils.JaxbUtil;
|
||||
import com.tenwa.app.invoice.utils.MathUtil;
|
||||
import com.tenwa.app.invoice.utils.Num2ChineseUtil;
|
||||
import com.tenwa.app.invoice.utils.PasswordGenerateUtil;
|
||||
import com.tenwa.app.invoice.utils.ResultUtil;
|
||||
import com.tenwa.flow.action.comm.BaseTable;
|
||||
import com.tenwa.util.SecurityUtil;
|
||||
import com.tenwa.util.SerialNumberUtil;
|
||||
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*
|
||||
@ -42,6 +85,31 @@ public class InvoiceManagerController extends BaseTable{
|
||||
private String ContractId;
|
||||
private String ContractInvoiceStatus;
|
||||
private String ReceiptList;
|
||||
private String sid;
|
||||
private String url = "http://fpfw2.aiee.fun:8899/fpfw2/api/kpbusiness";
|
||||
private String appId = "77c61651-f40e-4536-9991-bba64bd3521e";
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
public String getInvoiceStatus() {
|
||||
return InvoiceStatus;
|
||||
}
|
||||
@ -402,13 +470,14 @@ public class InvoiceManagerController extends BaseTable{
|
||||
}
|
||||
return "操作成功!";
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认开票申请
|
||||
* @param tx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String confirmInvoice(JBOTransaction tx) throws Exception{
|
||||
public String confirmInvoiceBak(JBOTransaction tx) throws Exception{
|
||||
BizObjectManager lridiManager = JBOFactory.getBizObjectManager(LI_RENT_INVOICE_DOWNLOAD_INFO.CLASS_NAME);
|
||||
BizObjectManager lriiManager = JBOFactory.getBizObjectManager(LI_RENT_INVOICE_INFO.CLASS_NAME);
|
||||
BizObjectManager lfidiManager = JBOFactory.getBizObjectManager(LI_FUND_INVOICE_DOWNLOAD_INFO.CLASS_NAME);
|
||||
@ -473,6 +542,394 @@ public class InvoiceManagerController extends BaseTable{
|
||||
}
|
||||
return "操作成功!";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 确认开票申请
|
||||
* @param tx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String confirmInvoice(JBOTransaction tx) throws Exception{
|
||||
|
||||
BizObjectManager ownAccountManager = JBOFactory.getBizObjectManager(OWN_ACCOUNT.CLASS_NAME);
|
||||
BizObject ownAccount = ownAccountManager.createQuery("state_=:state and acc_type=:acc_type and money_type=:money_type and account_type=:account_type")
|
||||
.setParameter("state", "0010").setParameter("acc_type", "0010")
|
||||
.setParameter("money_type", "01").setParameter("account_type", "invoice").getSingleResult(false);
|
||||
if(ownAccount==null){
|
||||
return "您的本方银行账户为空!";
|
||||
}
|
||||
|
||||
String[] planIncomeIds = PlanIncomeList.split("@");
|
||||
List<String> planIncomeIdList = new ArrayList<String>();
|
||||
for(int i=0;i<planIncomeIds.length;i+=2){
|
||||
planIncomeIdList.add("'"+planIncomeIds[i]+"'");
|
||||
}
|
||||
String customerid="";
|
||||
String customerName="";
|
||||
String planIncomeIdStr =StringUtils.join(planIncomeIdList.toArray(), ",");
|
||||
BizObjectManager invoiceManager = JBOFactory.getBizObjectManager(VI_LI_INVOICE.CLASS_NAME);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BizObject> checkInvoiceList= (List<BizObject>)invoiceManager.createQuery("SELECT DISTINCT O.customername,O.customer_id FROM O WHERE O.id IN ("+planIncomeIdStr+")").getResultList(false);
|
||||
if(checkInvoiceList!=null &&checkInvoiceList.size()>1){
|
||||
return "选择的不是同一个客户!";
|
||||
}else if(checkInvoiceList!=null &&checkInvoiceList.size()==1){
|
||||
customerid = checkInvoiceList.get(0).getAttribute("customer_id").toString();
|
||||
customerName = checkInvoiceList.get(0).getAttribute("customername").toString();
|
||||
}else{
|
||||
return "ERROR[02]";
|
||||
}
|
||||
|
||||
String confirmId=UUID.randomUUID().toString().replaceAll("-", "");
|
||||
Double hjje =0.00;
|
||||
Double hjse = 0.00;
|
||||
Double jshj = 0.00;
|
||||
List<BizObject> confirmDetailList = new ArrayList<BizObject>();
|
||||
|
||||
DecimalFormat df2 = new DecimalFormat(".00");
|
||||
DecimalFormat df6 = new DecimalFormat(".000000");
|
||||
|
||||
BizObjectManager invoiceFundManager = JBOFactory.getBizObjectManager(LI_FUND_INVOICE_INFO.CLASS_NAME);
|
||||
BizObjectManager invoiceRentManager = JBOFactory.getBizObjectManager(LI_RENT_INVOICE_INFO.CLASS_NAME);
|
||||
Double sl = 0.06;
|
||||
for(int i=0;i<planIncomeIds.length;i+=2){
|
||||
String invoiceType = planIncomeIds[i+1];
|
||||
String invoiceId = planIncomeIds[i];
|
||||
BizObjectManager confirmDetailManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM_DETAIL.CLASS_NAME);
|
||||
tx.join(confirmDetailManager);
|
||||
BizObject confirmDetailBizObject = confirmDetailManager.newObject();
|
||||
Double invoiceMoney = 0.00;
|
||||
String planid="";
|
||||
String planList="1";
|
||||
if(planIncomeIds[i+1].equals("fund")){
|
||||
BizObject invoiceFundBizObject = invoiceFundManager.createQuery("ID=:id ").setParameter("id",invoiceId).getSingleResult(false);
|
||||
invoiceMoney = new BigDecimal(invoiceFundBizObject.getAttribute("INVOICE_MONEY").getString()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
planid = invoiceFundBizObject.getAttribute("plan_id").toString();
|
||||
BizObjectManager fundPlanManager = JBOFactory.getBizObjectManager(LC_FUND_PLAN.CLASS_NAME);
|
||||
BizObject fundPlan = fundPlanManager.createQuery("id=:plan_id").setParameter("plan_id", planid).getSingleResult(false);
|
||||
planList = fundPlan.getAttribute("plan_list").toString();
|
||||
}else{
|
||||
BizObject invoiceRentBizObject = invoiceRentManager.createQuery("ID=:id ").setParameter("id",invoiceId).getSingleResult(false);
|
||||
invoiceMoney = new BigDecimal(invoiceRentBizObject.getAttribute("INVOICE_MONEY").getString()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
planid = invoiceRentBizObject.getAttribute("plan_id").toString();
|
||||
BizObjectManager rentPlanManager = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME);
|
||||
BizObject rentPlan = rentPlanManager.createQuery("id=:plan_id").setParameter("plan_id", planid).getSingleResult(false);
|
||||
planList = rentPlan.getAttribute("plan_list").toString();
|
||||
}
|
||||
planList = Num2ChineseUtil.format(planList);
|
||||
Double se = Double.valueOf( df2.format(invoiceMoney*sl ));
|
||||
|
||||
confirmDetailBizObject.setAttributeValue("dj","");
|
||||
confirmDetailBizObject.setAttributeValue("je",invoiceMoney);
|
||||
|
||||
hjje=MathUtil.add(hjje, invoiceMoney);
|
||||
hjse=MathUtil.add(hjse, se);
|
||||
|
||||
confirmDetailBizObject.setAttributeValue("invoice_type",invoiceType);
|
||||
confirmDetailBizObject.setAttributeValue("invoice_id",invoiceId);
|
||||
confirmDetailBizObject.setAttributeValue("spsl","");
|
||||
confirmDetailBizObject.setAttributeValue("dw","");
|
||||
confirmDetailBizObject.setAttributeValue("fphxz","0");
|
||||
confirmDetailBizObject.setAttributeValue("spmc","租金计划");
|
||||
confirmDetailBizObject.setAttributeValue("spsm","");
|
||||
confirmDetailBizObject.setAttributeValue("ggxh",planList);
|
||||
confirmDetailBizObject.setAttributeValue("invoice_confirm_id",confirmId);
|
||||
confirmDetailBizObject.setAttributeValue("sl",sl);
|
||||
confirmDetailBizObject.setAttributeValue("se",se);
|
||||
confirmDetailBizObject.setAttributeValue("hsbz","0");
|
||||
confirmDetailBizObject.setAttributeValue("spbm","3060109010000000000");
|
||||
confirmDetailBizObject.setAttributeValue("zxbm","");
|
||||
confirmDetailBizObject.setAttributeValue("yhzcbs","0");
|
||||
confirmDetailBizObject.setAttributeValue("slbs","");
|
||||
confirmDetailBizObject.setAttributeValue("zzstsgl","");
|
||||
|
||||
|
||||
confirmDetailBizObject = this.initTabeUserInfo(confirmDetailBizObject);
|
||||
confirmDetailManager.saveObject(confirmDetailBizObject);
|
||||
|
||||
confirmDetailList.add(confirmDetailBizObject);
|
||||
}
|
||||
|
||||
if(confirmDetailList.size()>0){
|
||||
BizObjectManager confirmManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM.CLASS_NAME);
|
||||
tx.join(confirmManager);
|
||||
BizObject confirmBizObject = confirmManager.newObject();
|
||||
|
||||
String ownId = ownAccount.getAttribute("own_id").toString();
|
||||
BizObjectManager ownInfoManager = JBOFactory.getBizObjectManager(OWN_INFO.CLASS_NAME);
|
||||
BizObject ownInfo = ownInfoManager.createQuery("OWN_NUMBER=:OWN_NUMBER").setParameter("OWN_NUMBER", ownId).getSingleResult(false);
|
||||
String xhdwdzdh = ownInfo.getAttribute("LEASE_TEL").toString();
|
||||
|
||||
BizObjectManager customerPersonManager = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME);
|
||||
BizObjectManager customerCompanyManager = JBOFactory.getBizObjectManager(CUSTOMER_COMPANY.CLASS_NAME);
|
||||
|
||||
BizObject customerPerson = customerPersonManager.createQuery("SELECT o.certid,caa.fulladdress,o.mobile,ca.acc_number,ca.bank_name from o JOIN jbo.app.tenwa.customer.CUSTOMER_ACCOUNT ca ON ca.customerid=o.customerid JOIN jbo.app.tenwa.customer.CUSTOMER_ADDRESS caa ON caa.customerid=ca.customerid where o.customerid=:customerid")
|
||||
.setParameter("customerid", customerid).getSingleResult(false);
|
||||
|
||||
BizObject customerCompany = customerCompanyManager.createQuery("customerid=:customerid").setParameter("customerid", customerid).getSingleResult(false);
|
||||
String companyTel="";
|
||||
if(customerCompany!=null){
|
||||
companyTel = customerCompany.getAttribute("company_tel").toString();
|
||||
}
|
||||
String certid="";
|
||||
String fulladdress="";
|
||||
String mobile="";
|
||||
String acc_number="";
|
||||
String bank_name="";
|
||||
String acc_bank="";
|
||||
String address_tel="";
|
||||
if(customerPerson!=null){
|
||||
certid=customerPerson.getAttribute("certid").toString();
|
||||
fulladdress=customerPerson.getAttribute("fulladdress").toString();
|
||||
mobile=customerPerson.getAttribute("mobile").toString();
|
||||
acc_number=customerPerson.getAttribute("acc_number").toString();
|
||||
bank_name=customerPerson.getAttribute("bank_name").toString();
|
||||
|
||||
acc_bank = "["+bank_name+"]["+acc_number+"]";
|
||||
address_tel = "["+mobile+"]["+fulladdress+"]";
|
||||
|
||||
}
|
||||
BizObjectManager contractInfoManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME);
|
||||
BizObject contractInfo = contractInfoManager.createQuery("SELECT o.leas_form,lul.customer_id FROM o JOIN jbo.com.tenwa.lease.comm.LB_UNION_LESSEE lul ON o.id=lul.contract_id WHERE lul.customer_id=:customerid").setParameter("customerid",customerid).getSingleResult(false);
|
||||
String leas_form = contractInfo.getAttribute("leas_form").toString();
|
||||
|
||||
|
||||
BizObjectManager userInfoManager = JBOFactory.getBizObjectManager(USER_INFO.CLASS_NAME);
|
||||
BizObject userInfo = userInfoManager.createQuery("userid=:userid").setParameter("userid", CurUserID).getSingleResult(false);
|
||||
String username=userInfo.getAttribute("username").toString();
|
||||
|
||||
confirmBizObject.setAttributeValue("id", confirmId);
|
||||
confirmBizObject.setAttributeValue("sid", PasswordGenerateUtil.getRandom(64, PasswordGenerateUtil.TYPE.LETTER_CAPITAL));
|
||||
confirmBizObject.setAttributeValue("yylxdm", "1");
|
||||
confirmBizObject.setAttributeValue("fplxdm", "026");
|
||||
confirmBizObject.setAttributeValue("kplx", "0");
|
||||
confirmBizObject.setAttributeValue("tspz", "00");
|
||||
confirmBizObject.setAttributeValue("xhdwdzdh", xhdwdzdh);
|
||||
confirmBizObject.setAttributeValue("xhdwyhzh", ownAccount.getAttribute("acc_number").toString());
|
||||
confirmBizObject.setAttributeValue("ghdwsbh", certid);
|
||||
confirmBizObject.setAttributeValue("ghdwmc", customerName);
|
||||
confirmBizObject.setAttributeValue("ghdwdzdh", address_tel);
|
||||
confirmBizObject.setAttributeValue("ghdwyhzh", acc_bank);
|
||||
confirmBizObject.setAttributeValue("hsslbs", "0");
|
||||
confirmBizObject.setAttributeValue("zhsl", "");
|
||||
confirmBizObject.setAttributeValue("hjje", hjje);
|
||||
confirmBizObject.setAttributeValue("hjse", hjse);
|
||||
confirmBizObject.setAttributeValue("jshj", MathUtil.add( hjje,hjse ));
|
||||
confirmBizObject.setAttributeValue("fhr", "");
|
||||
confirmBizObject.setAttributeValue("kpr", username);
|
||||
confirmBizObject.setAttributeValue("zyspmc", "");
|
||||
confirmBizObject.setAttributeValue("spsm", "");
|
||||
confirmBizObject.setAttributeValue("ssyf", "");
|
||||
confirmBizObject.setAttributeValue("tzdbh", "");
|
||||
confirmBizObject.setAttributeValue("yfpdm", "");
|
||||
confirmBizObject.setAttributeValue("yfphm", "");
|
||||
confirmBizObject.setAttributeValue("GMF_DZYX", "");
|
||||
if(leas_form=="01"){
|
||||
confirmBizObject.setAttributeValue("GMF_SJHM", companyTel);
|
||||
}else{
|
||||
confirmBizObject.setAttributeValue("GMF_SJHM", mobile);
|
||||
}
|
||||
confirmBizObject.setAttributeValue("GMF_OPENID", "");
|
||||
|
||||
|
||||
confirmBizObject = this.initTabeUserInfo(confirmBizObject);
|
||||
confirmManager.saveObject(confirmBizObject);
|
||||
InvoiceRequest invoiceRequest = new InvoiceRequest();
|
||||
|
||||
ResultPojo result = invoiceRequest.send(confirmBizObject,confirmDetailList);
|
||||
if(result.getCode()==0){
|
||||
InvoiceRequestBase responseBase = (InvoiceRequestBase) result.getData();
|
||||
String returncode = responseBase.getBody().getReturncode();
|
||||
String returnmsg = responseBase.getBody().getReturnmsg();
|
||||
|
||||
System.out.println("[OK][returncode]=>>>"+returncode);
|
||||
System.out.println("[OK][returnmsg]=>>>"+returnmsg);
|
||||
if("0".equals(returncode)){
|
||||
System.out.println("[OK][SUCCESS]");
|
||||
for(BizObject confirmDetailBizObject : confirmDetailList){
|
||||
String invoiceId = confirmDetailBizObject.getAttribute("invoice_id").toString();
|
||||
String invoice_type = confirmDetailBizObject.getAttribute("invoice_type").toString();
|
||||
if("fund".equals(invoice_type)){
|
||||
//invoiceFundManager.createQuery("update o set INVOICE_STATUS=:invoicestatus where ID=:id ").setParameter("id",invoiceId).setParameter("invoicestatus","3").executeUpdate();
|
||||
}else{
|
||||
//invoiceRentManager.createQuery("update o set INVOICE_STATUS=:invoicestatus where ID=:id ").setParameter("id",invoiceId).setParameter("invoicestatus","3").executeUpdate();
|
||||
}
|
||||
}
|
||||
return "开票申请成功";
|
||||
}else{
|
||||
return returnmsg;
|
||||
}
|
||||
}else{
|
||||
System.out.println("[FAIL]=>>>"+result.getMsg());
|
||||
return result.getMsg();
|
||||
}
|
||||
|
||||
}else{
|
||||
return "操作失败!";
|
||||
}
|
||||
}
|
||||
public String selectConfirm(JBOTransaction tx) throws JBOException{
|
||||
|
||||
Configure config = Configure.getInstance();
|
||||
String INVOICE_LOCAL_PATH="";
|
||||
try {
|
||||
INVOICE_LOCAL_PATH = config.getConfigure("INVOICE_LOCAL_PATH");
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return "a3web->[INVOICE_LOCAL_PATH]不存在";
|
||||
}
|
||||
|
||||
String sid = this.getSid();
|
||||
InvoiceRequestBase invoiceRequestBase = new InvoiceRequestBase();
|
||||
InvoiceRequestHead invoiceRequestHead = new InvoiceRequestHead();
|
||||
invoiceRequestHead.setAppid(this.appId);
|
||||
invoiceRequestHead.setSid(sid);
|
||||
|
||||
invoiceRequestBase.setHead(invoiceRequestHead);
|
||||
invoiceRequestBase.setComment("查询开票结果");
|
||||
invoiceRequestBase.setId("CXKPJG");
|
||||
invoiceRequestBase.setVersion("1.0");
|
||||
|
||||
String xml = JaxbUtil.convertToXml(invoiceRequestBase);
|
||||
ResultPojo result = doPost(xml);
|
||||
|
||||
BizObjectManager confirmManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM.CLASS_NAME);
|
||||
BizObject confirm = confirmManager.createQuery("sid=:sid").setParameter("sid", sid).getSingleResult(false);
|
||||
String invoice_confirm_id = confirm.getAttribute("id").toString();
|
||||
String id=UUID.randomUUID().toString().replaceAll("-", "");
|
||||
if(result.getCode()==0){
|
||||
InvoiceRequestBase responseBase = (InvoiceRequestBase) result.getData();
|
||||
String returncode = responseBase.getBody().getReturncode();
|
||||
String returnmsg = responseBase.getBody().getReturnmsg();
|
||||
|
||||
String fplxdm = responseBase.getBody().getFplxdm();
|
||||
String fpdm = responseBase.getBody().getFpdm();
|
||||
String fphm = responseBase.getBody().getFphm();
|
||||
String kprq = responseBase.getBody().getKprq();
|
||||
String hjje = responseBase.getBody().getHjje();
|
||||
String skm = responseBase.getBody().getSkm();
|
||||
String jym = responseBase.getBody().getJym();
|
||||
String pdfurl = "";
|
||||
String localFile = "";
|
||||
String path="";
|
||||
if("0".equals(returncode)){
|
||||
pdfurl = responseBase.getBody().getPdfurl();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYYMMdd");
|
||||
String ydm = dateFormat.format(new Date());
|
||||
|
||||
path = File.separator + ydm.substring(0, 4)+File.separator + ydm.substring(4, 6)+File.separator + ydm.substring(6, 8);
|
||||
path = path+File.separator+PasswordGenerateUtil.getRandom(50, PasswordGenerateUtil.TYPE.LETTER_CAPITAL)+".pdf";
|
||||
localFile = INVOICE_LOCAL_PATH+path;
|
||||
try {
|
||||
DownloadPdfUtil.go(pdfurl,localFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "下载PDF失败";
|
||||
}
|
||||
}
|
||||
try {
|
||||
path = SecurityUtil.encrypt(path, "invoice");
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
BizObjectManager confirmResultManager = JBOFactory.getBizObjectManager(LI_INVOICE_RESULT.CLASS_NAME);
|
||||
BizObject confirmResult = confirmResultManager.createQuery("sid=:sid").setParameter("sid", sid).getSingleResult(false);
|
||||
if(confirmResult==null){
|
||||
BizObject confirmResultNew = confirmResultManager.newObject();
|
||||
confirmResultNew.setAttributeValue("ID",id);
|
||||
confirmResultNew.setAttributeValue("sid",sid);
|
||||
confirmResultNew.setAttributeValue("fplxdm",fplxdm);
|
||||
confirmResultNew.setAttributeValue("fpdm",fpdm );
|
||||
confirmResultNew.setAttributeValue("fphm",fphm);
|
||||
confirmResultNew.setAttributeValue("kprq",kprq);
|
||||
confirmResultNew.setAttributeValue("hjje",hjje);
|
||||
confirmResultNew.setAttributeValue("skm",skm);
|
||||
confirmResultNew.setAttributeValue("jym",jym);
|
||||
confirmResultNew.setAttributeValue("pdfurl",pdfurl);
|
||||
confirmResultNew.setAttributeValue("localFile",path );
|
||||
confirmResultNew.setAttributeValue("returncode",returncode);
|
||||
confirmResultNew.setAttributeValue("returnmsg",returnmsg);
|
||||
confirmResultManager.saveObject(confirmResultNew);
|
||||
}else{
|
||||
confirmResultManager.createQuery("update o set fplxdm=:fplxdm,fpdm=:fpdm,fphm=:fphm,kprq=:kprq,hjje=:hjje,skm=:skm,jym=:jym,pdfurl=:pdfurl,localFile=:localFile,returncode=:returncode,returnmsg=:returnmsg where sid=:sid ")
|
||||
.setParameter("sid",sid).setParameter("fplxdm","fplxdm")
|
||||
.setParameter("fpdm",fpdm).setParameter("fphm","fphm")
|
||||
.setParameter("kprq",kprq).setParameter("hjje","hjje")
|
||||
.setParameter("skm",skm).setParameter("jym","jym")
|
||||
.setParameter("pdfurl",pdfurl).setParameter("localFile","localFile")
|
||||
.setParameter("returncode",returncode).setParameter("returnmsg","returnmsg")
|
||||
.executeUpdate();
|
||||
|
||||
}
|
||||
System.out.println("[OK][returncode]=>>>"+returncode);
|
||||
System.out.println("[OK][returnmsg]=>>>"+returnmsg);
|
||||
if("0".equals(returncode)){
|
||||
/*System.out.println("[OK][SUCCESS]");
|
||||
BizObjectManager confirmDetailManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM_DETAIL.CLASS_NAME);
|
||||
BizObject confirmDetail = confirmDetailManager.createQuery("invoice_confirm_id=:invoice_confirm_id").setParameter("invoice_confirm_id", invoice_confirm_id).getSingleResult(false);
|
||||
String invoiceId = confirmDetail.getAttribute("invoice_id").toString();
|
||||
String invoice_type = confirmDetail.getAttribute("invoice_type").toString();
|
||||
if("fund".equals(invoice_type)){
|
||||
//invoiceFundManager.createQuery("update o set INVOICE_STATUS=:invoicestatus where ID=:id ").setParameter("id",invoiceId).setParameter("invoicestatus","5").executeUpdate();
|
||||
}else{
|
||||
//invoiceRentManager.createQuery("update o set INVOICE_STATUS=:invoicestatus where ID=:id ").setParameter("id",invoiceId).setParameter("invoicestatus","5").executeUpdate();
|
||||
}
|
||||
*/
|
||||
return "开票申请成功";
|
||||
}else{
|
||||
return returnmsg;
|
||||
}
|
||||
}else{
|
||||
System.out.println("[FAIL]=>>>"+result.getMsg());
|
||||
return result.getMsg();
|
||||
}
|
||||
/*
|
||||
if(result.getCode().toString()!="0"){
|
||||
return "查询失败";
|
||||
}
|
||||
|
||||
System.out.println("result=>>>"+JSONObject.toJSONString(result));
|
||||
showResult(result);
|
||||
return "查询成功";*/
|
||||
|
||||
|
||||
}
|
||||
public ResultPojo doPost(String xml){
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
param.add("bw",xml) ;
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(param, httpHeaders);
|
||||
ResponseEntity<String> response = null ;
|
||||
try {
|
||||
response = restTemplate.exchange(this.url, HttpMethod.POST, entity, String.class);
|
||||
}catch (Exception e){
|
||||
return ResultUtil.error(ResponseEnum.NETWORK.getMsg());
|
||||
}
|
||||
System.out.println(response.getBody());
|
||||
InvoiceRequestBase r = JaxbUtil.converyToJavaBean(response.getBody(), InvoiceRequestBase.class);
|
||||
return ResultUtil.success(r);
|
||||
}
|
||||
private void showResult(ResultPojo result) {
|
||||
if(result.getCode()==0){
|
||||
InvoiceRequestBase responseBase = (InvoiceRequestBase) result.getData();
|
||||
String returncode = responseBase.getBody().getReturncode();
|
||||
String returnmsg = responseBase.getBody().getReturnmsg();
|
||||
|
||||
System.out.println("[OK][returncode]=>>>"+returncode);
|
||||
System.out.println("[OK][returnmsg]=>>>"+returnmsg);
|
||||
if("0".equals(returncode)){
|
||||
System.out.println("[OK][SUCCESS]");
|
||||
}
|
||||
}else{
|
||||
System.out.println("[FAIL]=>>>"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 退回开票申请
|
||||
* @param tx
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user