From 9e99e7e192c62c2274f8f5362b354cbf55c3d80f Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期一, 22 七月 2024 16:21:32 +0800 Subject: [PATCH] 变更 --- ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java | 79 +++++++++++++++++++++++++-------------- 1 files changed, 50 insertions(+), 29 deletions(-) diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java index d0be9a1..a033262 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java @@ -100,8 +100,14 @@ if (serviceReimbursement.getRecordstatus() != null) { wrappers.eq(ServiceReimbursement::getRecordstatus, serviceReimbursement.getRecordstatus()); } + if (serviceReimbursement.getUploadStates() != null) { + wrappers.eq(ServiceReimbursement::getUploadStates, serviceReimbursement.getUploadStates()); + } if (StringUtils.isNotBlank(serviceReimbursement.getUploadflag())) { wrappers.eq(ServiceReimbursement::getUploadflag, serviceReimbursement.getUploadflag()); + } + if (serviceReimbursement.getFlowlevel() != null) { + wrappers.eq(ServiceReimbursement::getFlowlevel, serviceReimbursement.getFlowlevel()); } /* if (serviceReimbursement.getStarttime()!=null && serviceReimbursement.getEndtime()!=null){ @@ -150,9 +156,20 @@ } @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public Boolean addSharedData(Long id) { log.info("addSharedData鏂规硶鐨勫叆鍙俰d :{}", id); + //鍏堝垽鏂竴涓媠hare琛ㄦ槸鍚﹀凡缁忔彃鍏� + ServiceReimbursementShared reimbursementShared1 = new ServiceReimbursementShared(); + reimbursementShared1.setReimid(id); + reimbursementShared1.setDelFlag(0L); + List<ServiceReimbursementShared> serviceReimbursementShareds = sharedService.queryList(reimbursementShared1); + log.info("serviceReimbursementShareds鐨勬煡璇㈢粨鏋� :{}", serviceReimbursementShareds.size()); + if (!CollectionUtils.isEmpty(serviceReimbursementShareds)) { + return true; + } + + //濡傛灉娌℃湁鎻掑叆锛屽垯璧颁笅闈㈢殑娴佺▼ ServiceReimbursement serviceReimbursement = serviceReimbursementMapper.selectById(id); Map<String, Object> columnMap = new HashMap<>(); columnMap.put("rbid", id); @@ -179,7 +196,18 @@ serviceReimbursementdetailShareds.get(i).setId(null); //涓婁紶OA鏂囦欢 log.info("涓婁紶OA鏂囦欢鏂规硶鐨勫叆鍙�:{}", serviceReimbursementdetailShareds.get(i)); - uploadOAFileAndUpdateDb(serviceReimbursementdetailShareds.get(i)); + try { + uploadOAFileAndUpdateDb(serviceReimbursementdetailShareds.get(i)); + } catch (Exception e) { + log.error("Exception涓璻eimShare鐨勫叆鍙俰d涓猴細{}", serviceReimbursementShared.getId()); + if (serviceReimbursementShared.getId() != null) { + Boolean aBoolean = sharedService.delResharedInfoById(serviceReimbursementShared.getId()); + log.error("鏂囦欢涓婁紶澶辫触锛屽皢鍒嗕韩琛ㄦ暟鎹洖婊氾細{}", aBoolean); + } + e.getMessage(); + return false; + } + } // detailSharedService.saveBatch(serviceReimbursementdetailShareds); @@ -214,8 +242,8 @@ } @Override - 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); + 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 @@ -234,7 +262,7 @@ } - public int uploadOAFileAndUpdateDb(ServiceReimbursementdetailShared remShare) { + public int uploadOAFileAndUpdateDb(ServiceReimbursementdetailShared remShare) throws Exception { log.info("uploadOAFileAndUpdate鏂规硶鐨勫叆鍙�:{}", remShare); System.out.println("uploadOAFileAndUpdate鏂规硶鐨勫叆鍙�:" + remShare); //涓婁紶OA鏂囦欢 @@ -268,13 +296,12 @@ List<RbDetailFile> invoicefilesArray = JSON.parseArray(remShare.getInvoicefiles(), RbDetailFile.class); //鏅�氶檮浠� uploadFile(filePath, strFUrl, parseArray2, parseArray, remShare, "1"); - //鍙戠エ闄勪欢 uploadFile(filePath, strFUrl, invoicefilesList, invoicefilesArray, remShare, "2"); return 0; } - private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceReimbursementdetailShared remShare, String flag) { + private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceReimbursementdetailShared remShare, String flag) throws Exception { if (!CollectionUtils.isEmpty(parseArray)) { for (int i = 0; i < parseArray.size(); i++) { RbDetailFile rbDetailFile = parseArray.get(i); @@ -282,30 +309,24 @@ log.info("filePath鐨勪慨鏀�:{}", filePath); String url = rbDetailFile.getUrl(); //file鐢ㄧ殑鏄粷瀵逛綅缃� - String substring = url.substring(url.indexOf("/profile/upload") + "/profile/upload".length()); + String fileName = url.substring(url.indexOf("/profile/upload") + "/profile/upload".length()); String strFile = rbDetailFile.getUrl().replace(filePath, "/profile/upload"); - System.out.println("reimbursement鏈嶅姟鐨刦ilePath + 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; - } + File fileUpload = new File(filePath + fileName); + log.info("璇锋眰绗笁鏂圭殑鍏ュ弬strFile : {}, strFUrl : {}", strFile, filePath); + String struploadResult = HttpClientKit.sendPostWithFile(fileUpload, strFUrl); + log.info("绗笁鏂逛紶鍥炵殑鏁版嵁: {}", struploadResult); + if (StringUtils.isEmpty(struploadResult)) { + log.info("HttpClientKit.sendPostWithFile 璇锋眰涓虹┖浜� struploadResult:{}, strFUrl:{} ", struploadResult, strFUrl); + return 0; + } - //鑾峰彇fileid - JSONObject jsonR = JSONObject.parseObject(struploadResult); - JSONArray jsonArr = jsonR.getJSONArray("atts"); - log.info("绗笁鏂逛紶鍥炵殑鏁版嵁鑾峰彇鐨刟tts : {}", 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()); + //鑾峰彇fileid + JSONObject jsonR = JSONObject.parseObject(struploadResult); + JSONArray jsonArr = jsonR.getJSONArray("atts"); + log.info("绗笁鏂逛紶鍥炵殑鏁版嵁鑾峰彇鐨刟tts : {}", jsonArr); + for (int j = 0; j < jsonArr.size(); j++) { + JSONObject jsonRet = jsonArr.getJSONObject(j); + rbDetailFile.setFileid(jsonRet.get("fileUrl").toString()); } parseArray2.add(rbDetailFile); } -- Gitblit v1.9.3