税控修复红冲发票bug

This commit is contained in:
zhangbb 2020-11-05 18:33:05 +08:00
parent 4b8a01d2cd
commit 8ebef36da2
4 changed files with 117 additions and 13 deletions

View File

@ -2,12 +2,12 @@
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
ASObjectModel doTemp = new ASObjectModel("Invoice_TJ_Gps_had");
doTemp.appendJboWhere("O.liti_id is not null");
doTemp.appendJboWhere("O.invoice_status='Y'");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(20);
dwTemp.MultiSelect=true;
dwTemp.MultiSelect=false;
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {

View File

@ -77,6 +77,7 @@ public class IAutokpDo {
if(!"".endsWith(responseParam)){
IAutokpUtils.saveFile(responseParam, contract_no+"_rnt");
Map<String,String> responseResult = IAutokpUtils.getResponseResult(responseParam);
insertInvoiceLog(lsm,doc,responseResult);
if("4011".equals(responseResult.get("fl"))){
insertInvoiceTable(lsm,doc,responseResult);
@ -139,6 +140,7 @@ public class IAutokpDo {
IAutokpXML ivoiceXML = new IAutokpXML();
requestParam = ivoiceXML.createInvoiceOthersXML(sid,fpzl,fpdm,fphm);
try {
IAutokpUtils.saveFile(requestParam, fpdm+"-"+fphm);
IAutokpserviceLocator kpl = new IAutokpserviceLocator();
IAutokp autoKP = kpl.getIAutokpPort();
responseParam = autoKP.invoice_fpzf(requestParam);
@ -157,7 +159,7 @@ public class IAutokpDo {
flag_result = "²Ù×÷³É¹¦";
}else{
flag = false;
flag_result = "操作失败";
flag_result = responseResult.get("mess");
}
}
return flag_result;
@ -253,7 +255,6 @@ public class IAutokpDo {
}
public void insertInvoiceTable(Map.Entry<String, List<Map<String, String>>> lsm,Document doc,Map<String,String> responseResult){
String contractNo = lsm.getKey();
String insertSql = "insert into li_invoice_tj_info(id,contract_no,plan_list,fpzl,fpzf,invoice_money,tax_type,tax_ratio,tax_money,sw_spbm,fpdm,fphm,hztzdh,mxxh,status,payee,tax_creator,tax_checker,inputtime,rele_id)values"
+"(REPLACE(UUID(),'-',''),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement ps = null;
@ -291,10 +292,12 @@ public class IAutokpDo {
String planList = "";
String liti_id = "";
String taxType = "";
String contractNo = "";
for(Map<String,String> map :lsm.getValue()){
if(mxxh.equals(map.get("MXXH"))){
planList = map.get("plan_list");
taxType = map.get("tax_no");
contractNo = map.get("contract_no");
if("01".equals(fpzf)){
liti_id = map.get("liti_id");
String usql = "update li_invoice_tj_info O set O.status='R' where id='"+liti_id+"'";
@ -338,7 +341,108 @@ public class IAutokpDo {
ps = null;
System.out.println("==========¿ªÆ±Íê±Ï==========");
} catch (SQLException e) {
ARE.getLog().debug("插入天津发票信息表:"+contractNo+"出错,出错消息"+e.getMessage(),e);
ARE.getLog().debug("插入天津发票信息表出错,出错消息"+e.getMessage(),e);
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
if(ps != null){
try {
ps.close();
ps = null;
} catch (SQLException e) {
ARE.getLog().debug("数据库关闭异常:" + e);
}
}
}
}
public void insertInvoiceLog(Map.Entry<String, List<Map<String, String>>> lsm,Document doc,Map<String,String> responseResult){
String insertSql = "insert into li_invoice_tj_log(id,contract_no,customer_name,plan_list,tax_type,fpzl,fpzf,invoice_money,tax_ratio,tax_money,payee,tax_creator,tax_checker,fpdm,fphm,mxxh,hztzdh,fl,mess,inputtime)values"
+"(REPLACE(UUID(),'-',''),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement ps = null;
Transaction Sqlca = null;
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
Connection con;
try {
con = Sqlca.getConnection();
boolean autoCom = con.getAutoCommit();
if(autoCom){
con.setAutoCommit(false);
}
ps = con.prepareStatement(insertSql);
Element ele_order = doc.getRootElement().element("Data").element("Order");
Element ele_head = ele_order.element("Head");
Element ele_items = ele_order.element("Items");
String payee = ele_head.element("SKR").getText();
String tax_creator = ele_head.element("KJR").getText();
String tax_checker = ele_head.element("FHR").getText();
String hztzdh = "";
String fl = responseResult.get("fl");
String mess = responseResult.get("mess");
String fpdm = responseResult.get("fpdm");
String fphm = responseResult.get("fphm");
if("01".equals(fpzf)){
fpdm = ele_head.element("HCFPDM").getText();
fphm = ele_head.element("HCFPHM").getText();
hztzdh = ele_head.element("HZTZDH").getText();
}
List<Element> listItems = ele_items.elements();
for(Element item : listItems){
String mxxh = item.element("MXXH").getText();
String planList = "";
String taxType = "";
String contractNo = "";
String customerName = "";
for(Map<String,String> map :lsm.getValue()){
if(mxxh.equals(map.get("MXXH"))){
planList = map.get("plan_list");
taxType = map.get("tax_type");
contractNo = map.get("contract_no");
customerName = map.get("customer_name");
break;
}
}
String invoice_money = item.element("JE").getText();
String taxRatio = item.element("SLV").getText();
String taxMoney = item.element("shuier").getText();
String inputtime = StringFunction.getTodayNow();
ps.setString(1,contractNo);
ps.setString(2,customerName);
ps.setString(3,taxType);
ps.setString(4,planList);
ps.setString(5,fpzl);
ps.setString(6,fpzf);
ps.setString(7,invoice_money);
ps.setString(8,taxRatio);
ps.setString(9,taxMoney);
ps.setString(10,payee);
ps.setString(11,tax_creator);
ps.setString(12,tax_checker);
ps.setString(13,fpdm);
ps.setString(14,fphm);
ps.setString(15,mxxh);
ps.setString(16,hztzdh);
ps.setString(17, fl);
ps.setString(18,mess);
ps.setString(19,inputtime);
ps.addBatch();
}
ps.executeBatch();
con.commit();
con.setAutoCommit(autoCom);
ps.close();
ps = null;
System.out.println("==========插入日志表完毕==========");
} catch (SQLException e) {
ARE.getLog().debug("插入天津发票信息日志表出错,出错消息"+e.getMessage(),e);
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block

View File

@ -14,7 +14,7 @@ import org.dom4j.Element;
public class IAutokpUtils {
public static void saveFile(String str,String contractNo){
File file = new File("D:\\tmp\\invoicelog\\"+"invoice"+contractNo+".txt");
File file = new File("D:\\tmp\\invoicelog\\"+"invoice_"+contractNo+".txt");
FileWriter fw = null;
try {
fw = new FileWriter(file);
@ -43,12 +43,11 @@ public class IAutokpUtils {
String mess = rootElement.element("mess").getTextTrim();
String fpdm = rootElement.element("fpdm").getTextTrim();
String fphm = rootElement.element("fphm").getTextTrim();
System.out.println(fl + ": " + mess);
responseResult.put("fl", fl);
responseResult.put("mess", mess);
responseResult.put("fpdm", fpdm);
responseResult.put("fphm", fphm);
System.out.println("解析完成:\n fl:"+fl+"\n mess:"+mess+"\n fpdm:"+fpdm+"\n fphm:"+fphm);
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@ -42,12 +42,13 @@ public class IAutokpXML {
mapi.put("cert_id",obj.getString("cert_id"));
mapi.put("customer_type",obj.getString("customer_type"));
mapi.put("plan_list",obj.getString("plan_list"));
mapi.put("contract_no", obj.getString("contract_no"));
if(map.containsKey(contract_no)){
map.get(contract_no).add(mapi);
}else{
ls.add(mapi);
map.put(contract_no, ls);
ls.clear();
}
}
@ -76,7 +77,7 @@ public class IAutokpXML {
mapi.put("cert_id",obj.getString("cert_id"));
mapi.put("customer_type",obj.getString("customer_type"));
mapi.put("plan_list",obj.getString("plan_list"));
mapi.put("contract_no", obj.getString("contract_no"));
mapi.put("liti_id",obj.getString("liti_id"));
mapi.put("HCFPDM",obj.getString("HCFPDM"));
mapi.put("HCFPHM",obj.getString("HCFPHM"));
@ -250,9 +251,9 @@ public class IAutokpXML {
Element Ele_Data = rootEle.addElement("Data");
Element Ele_Order = Ele_Data.addElement("Order");
Element Ele_Head = Ele_Order.addElement("Head");
Element Ele_FPZL = Ele_Order.addElement("fpzl");
Element Ele_FPDM = Ele_Order.addElement("FPDM");
Element Ele_FPHM = Ele_Order.addElement("FPHM");
Element Ele_FPZL = Ele_Order.addElement("FPZL");
Element Ele_FPDM = Ele_Order.addElement("fpdm");
Element Ele_FPHM = Ele_Order.addElement("fphm");
Ele_FPZL.setText(fpzl);
Ele_FPDM.setText(fpdm);
Ele_FPHM.setText(fphm);