| | |
| | | uploadOAFileAndUpdateDb(serviceReimbursementdetailShareds.get(i)); |
| | | } |
| | | |
| | | detailSharedService.saveBatch(serviceReimbursementdetailShareds); |
| | | // detailSharedService.saveBatch(serviceReimbursementdetailShareds); |
| | | for (ServiceReimbursementdetailShared serviceReimbursementdetailShared : serviceReimbursementdetailShareds) { |
| | | if (ObjectUtils.isNotEmpty(serviceReimbursementdetailShared)) { |
| | | detailSharedService.save(serviceReimbursementdetailShared); |
| | | } else { |
| | | log.info("serviceReimbursementdetailShared为空了"); |
| | | } |
| | | } |
| | | |
| | | //将serviceReimbursementpayee表里的id赋值给Rpid; 将serviceReimbursementShared里的ID赋值给RBID,并将serviceReimbursementpayeeShared表里的id置空,由数据库重新生成 |
| | | for (int i = 0; i < serviceReimbursementpayees.size(); i++) { |
| | |
| | | serviceReimbursementpayeeShareds.get(i).setRbid(serviceReimbursementShared.getId()); |
| | | serviceReimbursementpayeeShareds.get(i).setId(null); |
| | | } |
| | | payeeSharedService.saveBatch(serviceReimbursementpayeeShareds); |
| | | |
| | | for (ServiceReimbursementpayeeShared serviceReimbursementpayeeShared : serviceReimbursementpayeeShareds) { |
| | | if (ObjectUtils.isNotEmpty(serviceReimbursementpayeeShared)) { |
| | | payeeSharedService.save(serviceReimbursementpayeeShared); |
| | | } else { |
| | | log.info("serviceReimbursementpayeeShared为空了!"); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | |
| | | List<RbDetailFile> parseArray2 = new ArrayList<>(); |
| | | List<RbDetailFile> parseArray = JSON.parseArray(remShare.getAnnexfiles(), RbDetailFile.class); |
| | | for (int i = 0; i < parseArray.size(); i++) { |
| | | RbDetailFile rbDetailFile = parseArray.get(i); |
| | | if (!CollectionUtils.isEmpty(parseArray)) { |
| | | for (int i = 0; i < parseArray.size(); i++) { |
| | | RbDetailFile rbDetailFile = parseArray.get(i); |
| | | |
| | | log.info("filePath的修改:{}", filePath); |
| | | String url = rbDetailFile.getUrl(); |
| | | //file用的是绝对位置 |
| | | String substring = url.substring(url.indexOf("/profile/upload") + "/profile/upload".length()); |
| | | String strFile = rbDetailFile.getUrl().replace(filePath, "/profile/upload"); |
| | | File filetest = new File(filePath + substring); |
| | | try { |
| | | log.info("请求第三方的入参strFile : {}, strFUrl : {}", strFile, filePath); |
| | | System.out.println("请求第三方的入参:" + filePath + substring); |
| | | String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); |
| | | log.info("第三方传回的数据: {}", struploadResult); |
| | | if (StringUtils.isEmpty(struploadResult)) { |
| | | log.info("HttpClientKit.sendPostWithFile 请求为空了 filetest:{}, strFUrl:{} ", filetest, strFUrl); |
| | | return 0; |
| | | } |
| | | log.info("filePath的修改:{}", filePath); |
| | | String url = rbDetailFile.getUrl(); |
| | | //file用的是绝对位置 |
| | | String substring = url.substring(url.indexOf("/profile/upload") + "/profile/upload".length()); |
| | | String strFile = rbDetailFile.getUrl().replace(filePath, "/profile/upload"); |
| | | System.out.println("reimbursement服务的filePath + substring是乱码吗: " + filePath + substring); |
| | | File filetest = new File(filePath + substring); |
| | | try { |
| | | log.info("请求第三方的入参strFile : {}, strFUrl : {}", strFile, filePath); |
| | | String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); |
| | | log.info("第三方传回的数据: {}", struploadResult); |
| | | if (StringUtils.isEmpty(struploadResult)) { |
| | | log.info("HttpClientKit.sendPostWithFile 请求为空了 filetest:{}, strFUrl:{} ", filetest, strFUrl); |
| | | return 0; |
| | | } |
| | | |
| | | //获取fileid |
| | | JSONObject jsonR = JSONObject.parseObject(struploadResult); |
| | | JSONArray jsonArr = jsonR.getJSONArray("atts"); |
| | | log.info("第三方传回的数据获取的atts : {}", jsonArr); |
| | | for (int j = 0; j < jsonArr.size(); j++) { |
| | | JSONObject jsonRet = jsonArr.getJSONObject(j); |
| | | rbDetailFile.setFileid(jsonRet.get("fileUrl").toString()); |
| | | //获取fileid |
| | | JSONObject jsonR = JSONObject.parseObject(struploadResult); |
| | | JSONArray jsonArr = jsonR.getJSONArray("atts"); |
| | | log.info("第三方传回的数据获取的atts : {}", jsonArr); |
| | | for (int j = 0; j < jsonArr.size(); j++) { |
| | | JSONObject jsonRet = jsonArr.getJSONObject(j); |
| | | rbDetailFile.setFileid(jsonRet.get("fileUrl").toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("HttpClientKit.sendPostWithFile 报错了 : " + e.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("HttpClientKit.sendPostWithFile 报错了 : " + e.getMessage()); |
| | | parseArray2.add(rbDetailFile); |
| | | } |
| | | parseArray2.add(rbDetailFile); |
| | | } |
| | | remShare.setAnnexfiles(JSON.toJSONString(parseArray2)); |
| | | log.info("ServiceReimbursementdetailShared 是否加上了fileid : {}", remShare); |