| 
					
				 | 
			
			
				@@ -42,7 +42,8 @@ public class ThOCRAction extends AbstractNCAction{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * OCR识别
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private static final long serialVersionUID = -5178574564280732585L;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//获取发票附件地址
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private String noauth = "https://api.mypiaojia.com/api/invoiceApi/file/download?id=";
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private IUAPQueryBS iuap= (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private ThFileContentPanel parentpanel ;
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -125,7 +126,7 @@ public class ThOCRAction extends AbstractNCAction{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						,"ocr返回数据校验:\n"+e.getMessage());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//发票的url地址
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			String url = JSONObject.parseObject(idjson).getJSONObject("data").getString("url");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//String url = JSONObject.parseObject(idjson).getJSONObject("data").getString("url");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			JSONObject data = json.getJSONObject("data");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			JSONArray infos = data.getJSONArray("infos");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			for(int j = 0;j < infos.size();j++){
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -158,6 +159,7 @@ public class ThOCRAction extends AbstractNCAction{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				//添加描述
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				newvo.setFiledesc(message);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				// 修改人
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -207,6 +209,11 @@ public class ThOCRAction extends AbstractNCAction{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				String ext = info.getString("ext");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				JSONObject extobj = JSONObject.parseObject(ext);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				String trate = extobj.getString("trate");//税率
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//多行明细存在税率不一致的情况,外部税率字段会为空,转取明细第一行税率
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(trate == null || "".equals(trate)) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					JSONArray products = extobj.getJSONArray("products");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					trate = products.getJSONObject(0).getString("trate");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				JSONObject comm_info = info.getJSONObject("comm_info");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				JSONObject pro = comm_info.getJSONObject("pro");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				String date = pro.getString("date");//发票日期
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -234,7 +241,13 @@ public class ThOCRAction extends AbstractNCAction{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				JSONObject payer = comm_info.getJSONObject("payer");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				String name3 = payer.getString("tcode");//销售方纳税人识别号
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				String name4 = payer.getString("company");//购买方公司名称
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				JSONObject modify_info = info.getJSONObject("modify_info");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String furl = modify_info.getString("furl");//发票图片id 或者链接
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if (furl == null) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				    String pdf = modify_info.getString("pdf");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				    String pi = pro.getString("pi");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				    furl = pdf != null ? pdf : pi;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				IDefdocService idefservice = NCLocator.getInstance().lookup(IDefdocService.class);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				DefdocVO[] vos = new DefdocVO[1];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				DefdocVO defvo = new DefdocVO();
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -268,10 +281,10 @@ public class ThOCRAction extends AbstractNCAction{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					idefservice.insertDefdocs(pk_group, vos);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					Map<String,String> map = new HashMap<String,String>();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					map.put("KYHSJE", "~");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					map.put("KYWSJE", "~");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					map.put("JYSE", "~");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					map.put("FPXZ", url);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					map.put("KYHSJE", total);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					map.put("KYWSJE", amount);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					map.put("JYSE", ttax);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					map.put("FPXZ", noauth+furl);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					map.put("VDEF17",vdef17);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					map.put("NUMBERID",code);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					ocrservice.addORC(map);
 
			 |