liusheng
2023-08-25 7cdc66043ad8c484b8eb4597e281a5d8d33e4794
代码提交
已修改4个文件
99 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -83,8 +83,10 @@
            String fileName = FileUploadUtils.upload(filePath, file);
            String url1 = serverConfig.getUrl();
            log.info("url1的值old :{}", url1);
            //这里的8032不是tomcat的,所以要转成tomcat的
            url1 = url1.replace("8032", "8099");
            if (url1.contains("8032")) {
                //这里的8032不是tomcat的,所以要转成tomcat的
                url1 = url1.replace("8032", "8099");
            }
            log.info("url1的值new :{}", url1);
            String url = url1 + fileName;
            AjaxResult ajax = AjaxResult.success();
@@ -97,6 +99,27 @@
    }
//    private static void parseUTF(int[] bits) {
//        int index = 0;//这个指针指向每一行循环时列下标的位置,下一行开始时重新置位0
//        int count = 0;
//        ;//这个变量记录每个UTF-8字符的字节数,至少1字节
//        for (int j = ; j < bits.length; ) {
//            //循环每一行数组数据-从头去读--先读这个字符是几个字节组成的
//            // 然后按utf-8的编码格式组合字符串,转换为字符即可
//            if (bits[j] == 1) {
//                count++;
//                index++;
//            } else {
//                index++;//这一位是1后面跟的那一个o
//                //不为1,则说明已经解析完字节数,count里面存的如果是@表示是单字节数据
//                //如果不是o则表示是多字节数据
//                String str = "";
//            }
//        }
//    }
//
//}
    /**
     * 本地资源通用下载
     */
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -516,7 +516,11 @@
            serviceFundflow.setFundtype(2);
            serviceFundflow.setApplytype(serviceFund.getApplytype());
            serviceFundflow.setFlowconclusion(CheckFlag);
            serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
            if (org.apache.commons.lang.StringUtils.isNotBlank(checkFundVO.getFlowcontent())) {
                serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
            } else {
                serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "通过" : "不通过");
            }
            serviceFundflow.setFlowlevel(OriginalFlowLevel + 1);
            serviceFundflowService.save(serviceFundflow);
            serviceFundService.updateById(serviceFund);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
@@ -591,7 +591,11 @@
            serviceFundflow.setFundtype(1);
            serviceFundflow.setApplytype("0");
            serviceFundflow.setFlowconclusion(CheckFlag);
            serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
            if (StringUtils.isNotBlank(checkFundVO.getFlowcontent())) {
                serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
            } else {
                serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "通过" : "不通过");
            }
            serviceFundflow.setFlowlevel(OriginalFlowLevel + 1);
            serviceFundflowService.save(serviceFundflow);
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
@@ -137,6 +137,7 @@
        ServiceFundShared serviceFundShared = DtoConversionUtils.sourceToTarget(serviceFund, ServiceFundShared.class);
        serviceFundShared.setSerfunid(serviceFundShared.getId());
        serviceFundShared.setId(null);
        log.info("数据都插进去了吗? {}", serviceFundShared);
        sharedService.save(serviceFundShared);
        //fundId为主表的ID
@@ -774,40 +775,41 @@
        String strFUrl = "http://129.88.242.39:8899/seeyon/rest/attachment?token=" + strRes;
        List<RbDetailFile> parseArray2 = new ArrayList<>();
        List<RbDetailFile> parseArray = JSON.parseArray(remShare.getAnnexfiles(), RbDetailFile.class);
        log.info("parseArray的值 : {}",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());
        log.info("parseArray的值 : {}", parseArray);
        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("fund服务的filePath + substring: " + filePath + substring);
            File filetest = new File(filePath + substring);
                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.info("HttpClientKit.sendPostWithFile 请求为空了 filetest:{},  strFUrl:{} ", filetest, strFUrl);
                    return 0;
                try {
                    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();
                }
                //获取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();
                parseArray2.add(rbDetailFile);
            }
            parseArray2.add(rbDetailFile);
            remShare.setAnnexfiles(JSON.toJSONString(parseArray2));
            log.info("ServiceReimbursementdetailShared 是否加上了fileid : {}", remShare);
        }
        remShare.setAnnexfiles(JSON.toJSONString(parseArray2));
        log.info("ServiceReimbursementdetailShared 是否加上了fileid : {}", remShare);
        return 0;
    }