| | |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.boying.common.ReturnData; |
| | | import com.boying.common.SystemConfigProperties; |
| | | import com.boying.entity.ApplyTicket; |
| | | import com.boying.entity.EticketFile; |
| | | import com.boying.entity.FileInfo; |
| | | import com.boying.entity.Mkoteinvoice; |
| | | import com.boying.entity.*; |
| | | import com.boying.util.FileUtil; |
| | | import com.boying.util.HTTPEntityUtil; |
| | | import com.boying.util.ObjectToMapUtil; |
| | |
| | | /** |
| | | * 电子票据制作流程一 : 开具电子缴款书->发开具电子票据申请->获取电子票据文件 |
| | | */ |
| | | |
| | | |
| | | public static void main9(String[] args) { |
| | | //直接开票 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("hh:mm:ss"); |
| | | String format = sdf.format(new Date()); |
| | | String format2 = sdf2.format(new Date()); |
| | | String idStr = 25238+""; |
| | | String dateStr = DateUtil.currentSeconds()+""; |
| | | String l = idStr + dateStr; |
| | | |
| | | List< DirectTicket.info> infos = new ArrayList<>(); |
| | | //开票申请 |
| | | DirectTicket.info info = new DirectTicket.info(); |
| | | info.setOrdernum(1); |
| | | info.setAmt(3); |
| | | info.setAmount(1); |
| | | info.setIncitemcode("072101"); |
| | | info.setIncitemname("停车泊位及公共停车场等有偿使用收入"); |
| | | infos.add(info); |
| | | //list转json |
| | | Gson gson = new Gson(); |
| | | String json = gson.toJson(infos); |
| | | |
| | | DirectTicket directTicket = new DirectTicket(); |
| | | directTicket.setBizcode(l); |
| | | directTicket.setIssuedate(format); |
| | | directTicket.setIssuetime(format2); |
| | | directTicket.setPayerpartytype("1"); |
| | | directTicket.setPayer("冀DM118N"); |
| | | directTicket.setAmt(3); |
| | | directTicket.setUsername("张娇"); |
| | | directTicket.setChecker("乔宁"); |
| | | directTicket.setPayinfo(json); |
| | | directTicket.setState(1); |
| | | directTicket.setBilltypeid("1252"); |
| | | |
| | | String jsonStr = JSON.toJSONString(directTicket, SerializerFeature.WriteDateUseDateFormat); |
| | | Map<String, Object> map = JSON.parseObject(jsonStr, new TypeReference<Map<String, Object>>() {}); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | ResponseEntity<ReturnData> entity = restTemplate.postForEntity("http://10.255.200.204:7991/directmkoteinvoice", HTTPEntityUtil.setEntity(map), ReturnData.class); |
| | | SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss"); |
| | | String txt = sdf3.format(new Date())+"申请开票实体为:"+directTicket+",\n"; |
| | | txt += map+",\n"; |
| | | if(entity.getBody().getCode() ==1 ){ |
| | | //申请成功,去获取开票文件 |
| | | System.out.println(entity.getBody()); |
| | | Object o = entity.getBody().getData().get(0); |
| | | String s = JSON.toJSONString(o); |
| | | Map<String,Object> mapTypes = (Map)JSON.parse(s); |
| | | System.out.println("bizcode:"+l); |
| | | System.out.println("einvoicecode:"+(String) mapTypes.get("einvoicecode")); |
| | | System.out.println("einvoicenumber:"+(String) mapTypes.get("einvoicenumber")); |
| | | System.out.println("randomnumber:"+(String) mapTypes.get("randomnumber")); |
| | | System.out.println("einvoiceid:"+(String) mapTypes.get("einvoiceid")); |
| | | System.out.println("einvoicefilename:"+(String) mapTypes.get("einvoicefilename")); |
| | | }else { |
| | | System.out.println(entity.getBody()); |
| | | } |
| | | |
| | | /** |
| | | * ReturnData(code=1, msg=获取成功, total=0, data=[{randomnumber=859719, einvoicefilename=130113230001813560, einvoiceid=0653181000-32311031, einvoicenumber=0001813560, eticketnum=252381686303715, state=1, einvoicecode=13011323}], singleData=null) |
| | | * bizcode:252381686303715 |
| | | * einvoicecode:13011323 |
| | | * einvoicenumber:0001813560 |
| | | * randomnumber:859719 |
| | | * einvoiceid:0653181000-32311031 |
| | | * einvoicefilename:130113230001813560 |
| | | */ |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | Map<String,Object> map1 = new HashMap<>(); |
| | | map1.put("bizcode","252381686303715"); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | ResponseEntity<ReturnData> entity = restTemplate.postForEntity("http://10.255.200.204:7991/search/meinvoicestatus", HTTPEntityUtil.setEntity(map1), ReturnData.class); |
| | | System.out.println(entity.getBody()); |
| | | //ReturnData(code=1, msg=查询成功, total=0, data=[{filldate=2022-12-22, payeeaccount=13001645408050002448, bankaffirm=13061890816FPJZDGVS, eticketnum=13040622000000640564, amt=1.0, bankstation=130618908, payway=2, admdivcode=130406, payinfo=[{"incitemname":"停车泊位及公共停车场等有偿使用收入","amount":1,"incitemcode":"072101","amt":1,"ordernum":1}], payer=峰峰智慧停车, paybankdt=2022-12-22 15:14:59, payeebank=建行邯郸市峰峰支行, payee=峰峰矿区非税收入服务中心, payerbank=, payeraccount=, invoicingpartyname=邯郸市峰峰矿区综合行政执法局, invoicingpartycode=506002}], singleData=null) |
| | | // payinfo=[{"incitemname":"停车泊位及公共停车场等有偿使用收入","amount":1,"incitemcode":"072101","amt":1,"ordernum":1}] |
| | | } |
| | | |
| | | |
| | | public static void main91(String[] args) { |
| | | Map<String,Object> map1 = new HashMap<>(); |
| | | map1.put("einvoicecode", "13011323"); |
| | | map1.put("einvoicenumber","0001813560"); |
| | | map1.put("bizcode", "252381686303715"); |
| | | map1.put("randomnumber","859719"); |
| | | map1.put("billfiletype",1); |
| | | SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss"); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | ResponseEntity<ReturnData> entity = restTemplate.postForEntity("http://10.255.200.204:7991/geteinvoicebybizcode", HTTPEntityUtil.setEntity(map1), ReturnData.class); |
| | | System.out.println(entity.getBody()); |
| | | if(entity.getBody().getCode() == 1){ |
| | | Object o1 = entity.getBody().getData().get(0); |
| | | String s1 = JSON.toJSONString(o1); |
| | | EticketFile eticketFile = JSONObject.parseObject(s1, EticketFile.class); |
| | | System.out.println(eticketFile); |
| | | FileInfo fileInfo = FileUtil.generateBase64StringToFile(eticketFile.getEinvoicefile(), 1,1); |
| | | if(fileInfo != null){ |
| | | System.out.println(fileInfo); |
| | | } |
| | | }else { |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main4(String[] args) { |
| | | long l = DateUtil.currentSeconds(); |
| | |
| | | //ReturnData(code=1, msg=申请成功, total=0, data=[{filldate=2022-12-20, eticketnum=13040622000000000049, amt=0.1, payurl=, payinfo=[{"incitemname":"停车泊位及公共停车场等有偿使用收入","amount":1,"incitemcode":"072101","amt":0.1,"ordernum":1}], payer=峰峰智慧停车, payee=河北省财政厅, businum=1671548968, payerbank=, payeraccount=, writedate=2022-12-20 23:10:24, paybankname=农业银行、中国银行、建设银行、河北省农村信用社联合社、邮政储蓄银行, id=6de66ef8-8078-11ed-b059-52540035b66d, sn=e0a682dc-a95e-46ab-810f-850fc7fc9c41}], singleData=null) |
| | | } |
| | | |
| | | public static void main(String[] args) throws IllegalAccessException { |
| | | public static void main8(String[] args) throws IllegalAccessException { |
| | | long l = DateUtil.currentSeconds(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("hh:mm:ss"); |
| | |
| | | //ReturnData(code=1, msg=查询成功, total=0, data=[{randomnumber=264640, einvoicefilename=130112220011112124, einvoiceid=4212111100-22211031, einvoicenumber=0011112124, eticketnum=13040622000000640564, state=1, einvoicecode=13011222, info=开票成功}], singleData=null) |
| | | } |
| | | |
| | | public static void main5(String[] args) { |
| | | Map<String,Object> map1 = new HashMap<>(); |
| | | map1.put("eticketnum","13040622000000640564"); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | ResponseEntity<ReturnData> entity = restTemplate.postForEntity("http://10.255.200.204:7991/search/eticket", HTTPEntityUtil.setEntity(map1), ReturnData.class); |
| | | System.out.println(entity.getBody()); |
| | | //ReturnData(code=1, msg=查询成功, total=0, data=[{filldate=2022-12-22, payeeaccount=13001645408050002448, bankaffirm=13061890816FPJZDGVS, eticketnum=13040622000000640564, amt=1.0, bankstation=130618908, payway=2, admdivcode=130406, payinfo=[{"incitemname":"停车泊位及公共停车场等有偿使用收入","amount":1,"incitemcode":"072101","amt":1,"ordernum":1}], payer=峰峰智慧停车, paybankdt=2022-12-22 15:14:59, payeebank=建行邯郸市峰峰支行, payee=峰峰矿区非税收入服务中心, payerbank=, payeraccount=, invoicingpartyname=邯郸市峰峰矿区综合行政执法局, invoicingpartycode=506002}], singleData=null) |
| | | // payinfo=[{"incitemname":"停车泊位及公共停车场等有偿使用收入","amount":1,"incitemcode":"072101","amt":1,"ordernum":1}] |
| | | } |
| | | |
| | | //获取缴款书 |
| | | public void getAPPLYETCKETNUM(ApplyTicket applyTicket) throws IllegalAccessException { |