解决发票查询状态报错问题
This commit is contained in:
		
							parent
							
								
									803f6ba915
								
							
						
					
					
						commit
						48f6b832fe
					
				|  | @ -0,0 +1,89 @@ | |||
| package nc.bs.sscivm.ivsale.util; | ||||
| 
 | ||||
| import nc.vo.sscivm.ivmpub.InvoiceTypeEnum; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 发票类型和特殊票种映射工具类 | ||||
|  * @author wangyl7 | ||||
|  * | ||||
|  */ | ||||
| public class InvoiceTypeToTspzUtil { | ||||
|     private final static Map<Integer,String> invoiceMap = new HashMap<Integer,String>(); | ||||
|     private final static Map<Integer,String> tspzMap = new HashMap<Integer,String>(); | ||||
| 	static { | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_JDC.toIntValue(), "4"); | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_KCL.toIntValue(), "1"); | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_DZZYFP_KCL.toIntValue(), "2"); | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_KCL.toIntValue(), "3"); | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_KCL.toIntValue(), "4"); | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_ESCTYFP.toIntValue(), "15");//二手车统一销售与机打重复 | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_NCP.toIntValue(), "1"); | ||||
| 		invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_NCP.toIntValue(), "3"); | ||||
| 		 | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_JDC.toIntValue(), "12"); | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_KCL.toIntValue(), "16"); | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_DZZYFP_KCL.toIntValue(), "16"); | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_KCL.toIntValue(), "16"); | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_KCL.toIntValue(), "16"); | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_NCP.toIntValue(), "9"); | ||||
| 		tspzMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_NCP.toIntValue(), "9"); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * 获取真实的发票类型 | ||||
| 	 * @param fplx 发票类型 | ||||
| 	 * @return 真实的发票类型 | ||||
| 	 */ | ||||
| 	public static String getRealInvoicetype(Integer fplx){ | ||||
| 		if (invoiceMap.containsKey(fplx)){ | ||||
| 			return invoiceMap.get(fplx); | ||||
| 		} | ||||
| 		return String.valueOf(fplx); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * 获取特殊票种 | ||||
| 	 * @param fplx 发票类型 | ||||
| 	 * @return 特殊票种 | ||||
| 	 */ | ||||
| 	public static String getTspz(Integer fplx){ | ||||
| 		if (tspzMap.containsKey(fplx)){ | ||||
| 			return tspzMap.get(fplx); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * 更具发票类型和特殊票种转发票类型 | ||||
| 	 * @param fplx | ||||
| 	 * @param tspz | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String getInvoicetypeByFplxAndTspz(String fplx, String tspz){ | ||||
| 		//非特殊票种 | ||||
| 		if (tspz == null || tspz.startsWith("E")){ | ||||
| 			return fplx; | ||||
| 		} | ||||
| 		//全电发票不拼接 | ||||
| 		if ("31".equals(fplx) || "32".equals(fplx) ||"33".equals(fplx) || "34".equals(fplx)){ | ||||
| 			return fplx; | ||||
| 		} | ||||
| 		//增值税专用发票(机动车) | ||||
| 		if ("412".equals(fplx + tspz)){ | ||||
| 			return InvoiceTypeEnum.INVOICETYPE_ZYFP_JDC.toStringValue(); | ||||
| 		} | ||||
| 		//农产品收购 | ||||
| 		if ("9".equals(tspz)) { | ||||
| 			return fplx + "0" + tspz; | ||||
| 		} | ||||
| 		//数电纸质发票(机动车销售统一发票 | ||||
| 		if ("36".equals(fplx)){ | ||||
| 			return fplx; | ||||
| 		} | ||||
| 		//其他特殊票种发票 | ||||
| 		return fplx + tspz; | ||||
| 	} | ||||
| } | ||||
		Loading…
	
		Reference in New Issue