ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceFundSharedMapper.java
@@ -25,5 +25,5 @@ List<ServiceFundShared> getFundShareInfoById(Long fundid); Boolean delfundsharedInfoById(Long fundId); Boolean delfundsharedInfoById(Long fundId,Long serfunid); } ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceFundSharedService.java
@@ -26,5 +26,5 @@ List<ServiceFundShared> getFundShareInfoById(Long fundid); Boolean delfundsharedInfoById(Long fundId); Boolean delfundsharedInfoById(Long fundId,Long serfunid); } ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
@@ -186,7 +186,16 @@ serviceFunddetailShareds.get(i).setFundid(serviceFundShared.getId()); serviceFunddetailShareds.get(i).setId(null); //数据发送给财务 uploadOAFileAndUpdateDb(serviceFunddetailShareds.get(i)); try { uploadOAFileAndUpdateDb(serviceFunddetailShareds.get(i)); } catch (Exception e) { log.error("Exception中入参的ID为:{}", id); if (id != null) { Boolean aBoolean = sharedService.delfundsharedInfoById(null, id); log.error("fund2分享表里的数据是否删除成功:{}", aBoolean); } return false; } } boolean result = false; for (ServiceFunddetailShared serviceFunddetailShared : serviceFunddetailShareds) { @@ -941,7 +950,7 @@ } int uploadOAFileAndUpdateDb(ServiceFunddetailShared remShare) { int uploadOAFileAndUpdateDb(ServiceFunddetailShared remShare) throws Exception { //上传OA文件 //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3"; String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; @@ -981,7 +990,7 @@ } private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceFunddetailShared remShare, String flag) { private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceFunddetailShared remShare, String flag) throws Exception { if (!CollectionUtils.isEmpty(parseArray)) { for (int i = 0; i < parseArray.size(); i++) { RbDetailFile rbDetailFile = parseArray.get(i); @@ -993,24 +1002,21 @@ System.out.println("fund服务的filePath + substring: " + filePath + substring); File filetest = new File(filePath + substring); try { String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); log.info("第三方传回的数据: {}", struploadResult); if (StringUtils.isEmpty(struploadResult)) { log.error("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(); String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); log.info("第三方传回的数据: {}", struploadResult); if (StringUtils.isEmpty(struploadResult)) { log.error("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()); } parseArray2.add(rbDetailFile); } if (flag.equals("1")) { ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundSharedServiceImpl.java
@@ -15,12 +15,12 @@ /** * 费用申请主Service业务层处理 * * * @author ruoyi * @date 2023-03-27 */ @Service public class ServiceFundSharedServiceImpl extends ServiceImpl<ServiceFundSharedMapper, ServiceFundShared> implements IServiceFundSharedService public class ServiceFundSharedServiceImpl extends ServiceImpl<ServiceFundSharedMapper, ServiceFundShared> implements IServiceFundSharedService { @@ -29,7 +29,7 @@ /** * 查询费用申请主列表 * * * @param serviceFundShared 费用申请主 * @return 费用申请主 */ @@ -191,8 +191,8 @@ } @Override public Boolean delfundsharedInfoById(Long fundId) { return serviceFundSharedMapper.delfundsharedInfoById(fundId); public Boolean delfundsharedInfoById(Long fundId,Long serfunid) { return serviceFundSharedMapper.delfundsharedInfoById(fundId,serfunid); } } ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java
@@ -196,7 +196,17 @@ 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中reimShare的入参id为:{}", serviceReimbursementShared.getId()); if (serviceReimbursementShared.getId() != null) { Boolean aBoolean = sharedService.delResharedInfoById(serviceReimbursementShared.getId()); log.error("文件上传失败,将分享表数据回滚:{}", aBoolean); } return false; } } // detailSharedService.saveBatch(serviceReimbursementdetailShareds); @@ -251,7 +261,7 @@ } public int uploadOAFileAndUpdateDb(ServiceReimbursementdetailShared remShare) { public int uploadOAFileAndUpdateDb(ServiceReimbursementdetailShared remShare) throws Exception { log.info("uploadOAFileAndUpdate方法的入参:{}", remShare); System.out.println("uploadOAFileAndUpdate方法的入参:" + remShare); //上传OA文件 @@ -285,13 +295,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); @@ -303,26 +312,21 @@ 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; } 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()); //获取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()); } parseArray2.add(rbDetailFile); } ruoyi-project/src/main/resources/mapper/project/ServiceFundSharedMapper.xml
@@ -191,7 +191,11 @@ <update id="delfundsharedInfoById"> UPDATE service_fund_shared SET del_flag = 1 WHERE ID = #{fundId} and del_flag != 1 WHERE del_flag != 1 <if test="fundId != null"> and ID = #{fundId}</if> <if test="serfunid != null"> and serfunid = #{serfunid}</if> </update> </mapper> </mapper> ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -81,8 +81,9 @@ } String phone = serviceFundShared.getPhone(); //将分享里的该数据删除 serviceFundSharedService.delfundsharedInfoById(serviceFundShared.getId()); log.info("checkReportInfo中入参ID为:{}", serviceFundShared.getId()); Boolean aBoolean = serviceFundSharedService.delfundsharedInfoById(serviceFundShared.getId(), null); log.info("fund分享表里的数据是否删除成功:{}", aBoolean); ServiceFund serviceFund = new ServiceFund(); serviceFund.setId(serviceFundShared.getSerfunid()); List<ServiceFund> serviceFunds = serviceFundService.queryInfoById(serviceFund); @@ -309,7 +310,7 @@ //将分享里的该数据删除 Boolean aBoolean = serviceReimbursementSharedService.delResharedInfoById(serviceReimbursementShared.getId()); log.info("将分享里的该数据删除: {}",aBoolean); log.info("将分享里的该数据删除: {}", aBoolean); //将Flowlevel 设置为0; ServiceReimbursement serviceReimbursement = new ServiceReimbursement(); serviceReimbursement.setId(serviceReimbursementShared.getReimid());