| | |
| | | throw new ServiceException("公司不存在"); |
| | | } |
| | | String link = companyInfo.getLink(); |
| | | String[] split = link.split("="); |
| | | JSONObject jsonObject=getReport(split[split.length-1]); |
| | | if(link==null){ |
| | | return R.ok(changeVO); |
| | | } |
| | | JSONObject jsonObject=getReport(extractSnFromUrl(link)); |
| | | // JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | if (!"1001".equals(jsonObject.getString("code"))){ |
| | | return R.fail(jsonObject.get("msg")); |
| | |
| | | |
| | | return R.ok(changeVO); |
| | | } |
| | | /** |
| | | * 从URL中提取sn参数 |
| | | * @param url 包含sn参数的URL |
| | | * @return sn参数值 |
| | | */ |
| | | public static String extractSnFromUrl(String url) { |
| | | if (url == null || url.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | // 查找sn参数的位置 |
| | | String snParam = "sn="; |
| | | int startIndex = url.indexOf(snParam); |
| | | |
| | | if (startIndex == -1) { |
| | | return null; // 未找到sn参数 |
| | | } |
| | | |
| | | // 计算sn值的起始位置 |
| | | startIndex += snParam.length(); |
| | | |
| | | // 查找sn值的结束位置(遇到&或字符串结束) |
| | | int endIndex = url.indexOf("&", startIndex); |
| | | if (endIndex == -1) { |
| | | endIndex = url.length(); |
| | | } |
| | | |
| | | // 提取并返回sn值 |
| | | return url.substring(startIndex, endIndex); |
| | | } |
| | | |
| | | @Override |
| | | public R tax(String id) { |
| | |
| | | throw new ServiceException("公司不存在"); |
| | | } |
| | | String link = companyInfo.getLink(); |
| | | String[] split = link.split("="); |
| | | JSONObject jsonObject=getReport(split[split.length-1]); |
| | | if (link == null) { |
| | | return R.ok(taxVO); |
| | | } |
| | | JSONObject jsonObject=getReport(extractSnFromUrl(link)); |
| | | // JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | if (!"1001".equals(jsonObject.getString("code"))){ |
| | | return R.fail(jsonObject.get("msg")); |
| | |
| | | throw new ServiceException("公司不存在"); |
| | | } |
| | | String link = companyInfo.getLink(); |
| | | String[] split = link.split("="); |
| | | JSONObject jsonObject=getReport(split[split.length-1]); |
| | | if(link==null){ |
| | | return R.ok(vo); |
| | | } |
| | | JSONObject jsonObject=getReport(extractSnFromUrl(link)); |
| | | // JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | if (!"1001".equals(jsonObject.getString("code"))){ |
| | | return R.fail(jsonObject.get("msg")); |
| | |
| | | |
| | | //近一个月开票金额(元) |
| | | JSONArray f4yPer1mDownFpInfoList = (JSONArray) invoiceInfo.get("f4yPer1mDownFpInfoList"); |
| | | JSONObject f4yPer1mDownFpInfo1 = (JSONObject) f4yPer1mDownFpInfoList.get(1); |
| | | vo.setHjjeZc1( ObjectToBigDecimal(f4yPer1mDownFpInfo1.get("hjjeZc")) ); |
| | | |
| | | if(f4yPer1mDownFpInfoList!=null){ |
| | | JSONObject f4yPer1mDownFpInfo1 = (JSONObject) f4yPer1mDownFpInfoList.get(1); |
| | | vo.setHjjeZc1( ObjectToBigDecimal(f4yPer1mDownFpInfo1.get("hjjeZc")) ); |
| | | } |
| | | |
| | | JSONObject fpPrevMnMthsDownFpInfoList = (JSONObject) invoiceInfo.get("fpPrevMnMthsDownFpInfoList"); |
| | | JSONObject fpPrev3mthsDownFpInfoList = (JSONObject) fpPrevMnMthsDownFpInfoList.get("fpPrev3mthsDownFpInfoList"); |