| | |
| | | for (int j = 0; j < rbDetailList.size(); j++) { |
| | | ServiceReimbursementdetail serviceReimbursementdetail = rbDetailList.get(j); |
| | | String annexfiles = serviceReimbursementdetail.getAnnexfiles(); |
| | | String invoicefiles = serviceReimbursementdetail.getInvoicefiles(); |
| | | ServiceReimbursementdetailVO serviceReimbursementdetailVO = DtoConversionUtils.sourceToTarget(serviceReimbursementdetail, ServiceReimbursementdetailVO.class); |
| | | if (StringUtils.isNotBlank(annexfiles)) { |
| | | try { |
| | |
| | | } catch (Exception e) { |
| | | if (e.getMessage().equals("invalid comment")) { |
| | | log.error("报异常了,老大不让我处理"); |
| | | } |
| | | } |
| | | } |
| | | if (StringUtils.isNotBlank(invoicefiles)) { |
| | | try { |
| | | serviceReimbursementdetailVO.setInvoicefilesList(JSON.parseArray(invoicefiles)); |
| | | } catch (Exception e) { |
| | | if (e.getMessage().equals("invalid comment")) { |
| | | } |
| | | } |
| | | } |
| | |
| | | @Transactional |
| | | public Boolean addSharedData(Long id) { |
| | | log.info("addSharedData方法的入参id :{}", id); |
| | | //先判断一下share表是否已经插入 |
| | | ServiceReimbursementShared reimbursementShared1 = new ServiceReimbursementShared(); |
| | | reimbursementShared1.setReimid(id); |
| | | reimbursementShared1.setDelFlag(0L); |
| | | List<ServiceReimbursementShared> serviceReimbursementShareds = sharedService.queryList(reimbursementShared1); |
| | | if (!CollectionUtils.isEmpty(serviceReimbursementShareds)) { |
| | | return true; |
| | | } |
| | | |
| | | //如果没有插入,则走下面的流程 |
| | | ServiceReimbursement serviceReimbursement = serviceReimbursementMapper.selectById(id); |
| | | Map<String, Object> columnMap = new HashMap<>(); |
| | | columnMap.put("rbid", id); |
| | | //获取详情数据 |
| | | List<ServiceReimbursementdetail> details = serviceReimbursementdetailMapper.selectByMap(columnMap); |
| | | List<ServiceReimbursementdetail> details = serviceReimbursementdetailMapper.selectByMap(columnMap); |
| | | log.info("serviceReimbursementdetailMapper.selectByMap方法的返参参 :{}", CollectionUtils.isEmpty(details) ? null : details.size()); |
| | | //获取支付数据 |
| | | List<ServiceReimbursementpayee> serviceReimbursementpayees = reimbursementpayeeMapper.selectByMap(columnMap); |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SpFinancialExpensesReimbursementOut> getListBypower(String PAUSERNO, Integer PAFUNDTYPE, String PAAPPLICANT, String PAAPPLICATIONBEGTIME, String PAAPPLICATIONENDTIME, String PADEPARTMENT, Integer CHECKFLAG, Integer APPLYTYPE) { |
| | | return serviceReimbursementMapper.getListBypower(PAUSERNO, PAFUNDTYPE, PAAPPLICANT, PAAPPLICATIONBEGTIME, PAAPPLICATIONENDTIME, PADEPARTMENT, CHECKFLAG, APPLYTYPE); |
| | | public List<SpFinancialExpensesReimbursementOut> getListBypower(String PAUSERNO, Integer PAFUNDTYPE, String PAAPPLICANT, String PAAPPLICATIONBEGTIME, String PAAPPLICATIONENDTIME, String PADEPARTMENT, Integer CHECKFLAG, Integer APPLYTYPE, Integer CHECKSTATUS, String donorname) { |
| | | return serviceReimbursementMapper.getListBypower(PAUSERNO, PAFUNDTYPE, PAAPPLICANT, PAAPPLICATIONBEGTIME, PAAPPLICATIONENDTIME, PADEPARTMENT, CHECKFLAG, APPLYTYPE, CHECKSTATUS, donorname); |
| | | } |
| | | |
| | | @Override |
| | |
| | | String strFUrl = "http://129.88.242.39:8899/seeyon/rest/attachment?token=" + strRes; |
| | | |
| | | List<RbDetailFile> parseArray2 = new ArrayList<>(); |
| | | List<RbDetailFile> invoicefilesList = new ArrayList<>(); |
| | | |
| | | //普通文件上传 |
| | | List<RbDetailFile> parseArray = JSON.parseArray(remShare.getAnnexfiles(), RbDetailFile.class); |
| | | for (int i = 0; i < parseArray.size(); i++) { |
| | | RbDetailFile rbDetailFile = parseArray.get(i); |
| | | //发票文件上传 |
| | | List<RbDetailFile> invoicefilesArray = JSON.parseArray(remShare.getInvoicefiles(), RbDetailFile.class); |
| | | //普通附件 |
| | | uploadFile(filePath, strFUrl, parseArray2, parseArray, remShare, "1"); |
| | | |
| | | 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; |
| | | } |
| | | //发票附件 |
| | | uploadFile(filePath, strFUrl, invoicefilesList, invoicefilesArray, remShare, "2"); |
| | | 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()); |
| | | private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceReimbursementdetailShared remShare, String flag) { |
| | | 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"); |
| | | 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()); |
| | | } |
| | | } 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)); |
| | | if (flag.equals("1")) { |
| | | //如果flag为1,则是普通 |
| | | remShare.setAnnexfiles(JSON.toJSONString(parseArray2)); |
| | | |
| | | } else if (flag.equals("2")) { |
| | | //如果flag为2,则是发票 |
| | | remShare.setInvoicefiles(JSON.toJSONString(parseArray2)); |
| | | } |
| | | log.info("ServiceReimbursementdetailShared 是否加上了fileid : {}", remShare); |
| | | return 0; |
| | | } |