huanghongfa
2021-01-15 e16706765bb47e37038f24a18130d177b6046475
下载修改
2个文件已修改
170 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java 115 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml
@@ -22,7 +22,10 @@
    <select />
  </component>
  <component name="ChangeListManager">
    <list default="true" id="8ba27629-3e5d-4f42-993e-d0c055bc9371" name="Default Changelist" comment="" />
    <list default="true" id="8ba27629-3e5d-4f42-993e-d0c055bc9371" name="Default Changelist" comment="">
      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java" afterDir="false" />
    </list>
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -395,7 +398,7 @@
      <workItem from="1610326930387" duration="5497000" />
      <workItem from="1610368400707" duration="771000" />
      <workItem from="1610415637750" duration="6485000" />
      <workItem from="1610499071420" duration="64465000" />
      <workItem from="1610499071420" duration="66775000" />
    </task>
    <servers />
  </component>
@@ -447,54 +450,54 @@
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state x="549" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1610606590056" />
    <state width="1031" height="544" key="GridCell.Tab.0.bottom" timestamp="1610693390069">
    <state width="1031" height="252" key="GridCell.Tab.0.bottom" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1610693390069" />
    <state width="1031" height="544" key="GridCell.Tab.0.center" timestamp="1610693390067">
    <state width="1031" height="252" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.0.center" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1610693390067" />
    <state width="1031" height="544" key="GridCell.Tab.0.left" timestamp="1610693390065">
    <state width="1031" height="252" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.0.left" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1610693390065" />
    <state width="1031" height="544" key="GridCell.Tab.0.right" timestamp="1610693390067">
    <state width="1031" height="252" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.0.right" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1610693390067" />
    <state width="1031" height="544" key="GridCell.Tab.1.bottom" timestamp="1610693390071">
    <state width="1031" height="252" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.1.bottom" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1610693390071" />
    <state width="1031" height="544" key="GridCell.Tab.1.center" timestamp="1610693390071">
    <state width="1031" height="252" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.1.center" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1610693390071" />
    <state width="1031" height="544" key="GridCell.Tab.1.left" timestamp="1610693390070">
    <state width="1031" height="252" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.1.left" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1610693390070" />
    <state width="1031" height="544" key="GridCell.Tab.1.right" timestamp="1610693390071">
    <state width="1031" height="252" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.1.right" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1610693390071" />
    <state width="1031" height="544" key="GridCell.Tab.2.bottom" timestamp="1610693390072">
    <state width="1031" height="252" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.2.bottom" timestamp="1610703591478">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.2.bottom/0.0.1536.824@0.0.1536.824" timestamp="1610693390072" />
    <state width="1031" height="544" key="GridCell.Tab.2.center" timestamp="1610693390072">
    <state width="1031" height="252" key="GridCell.Tab.2.bottom/0.0.1536.824@0.0.1536.824" timestamp="1610703591478" />
    <state width="1031" height="252" key="GridCell.Tab.2.center" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.2.center/0.0.1536.824@0.0.1536.824" timestamp="1610693390072" />
    <state width="1031" height="544" key="GridCell.Tab.2.left" timestamp="1610693390072">
    <state width="1031" height="252" key="GridCell.Tab.2.center/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.2.left" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.2.left/0.0.1536.824@0.0.1536.824" timestamp="1610693390072" />
    <state width="1031" height="544" key="GridCell.Tab.2.right" timestamp="1610693390072">
    <state width="1031" height="252" key="GridCell.Tab.2.left/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state width="1031" height="252" key="GridCell.Tab.2.right" timestamp="1610703591477">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
    <state width="1031" height="544" key="GridCell.Tab.2.right/0.0.1536.824@0.0.1536.824" timestamp="1610693390072" />
    <state width="1031" height="252" key="GridCell.Tab.2.right/0.0.1536.824@0.0.1536.824" timestamp="1610703591477" />
    <state x="299" y="67" key="Maven.ArtifactSearchDialog" timestamp="1610611848124">
      <screen x="0" y="0" width="1536" height="824" />
    </state>
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java
@@ -19,6 +19,7 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
@@ -94,39 +95,50 @@
    }
    @ApiOperation(value = "下载模板-导入党员")
    @GetMapping(value = "downloadtemplate", headers = "Accept=application/octet-stream")
    public R downloadTemplate(HttpServletResponse response) throws IOException, SftpException {
    @GetMapping(value = "downloadtemplate")
    public R downloadTemplate() throws IOException, SftpException {
        SFTPUtil sftp = new SFTPUtil();
        sftp.login();
        InputStream inputStream = sftp.downloadInputStream(FtpConstants.FTPFILEPATH_MUBAN, UPLOAD_EXCEL);
        // 配置文件下载
        response.setHeader("content-type", "application/octet-stream");
        response.setContentType("application/octet-stream");
        // 下载文件能正常显示中文
        response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(UPLOAD_EXCEL, "UTF-8"));
        response.setCharacterEncoding("UTF-8");
        // 实现文件下载
        byte[] buffer = new byte[1024];
        BufferedInputStream bis = null;
        try {
            bis = new BufferedInputStream(inputStream);
            OutputStream os = response.getOutputStream();
            int i = bis.read(buffer);
            while (i != -1) {
                os.write(buffer, 0, i);
                i = bis.read(buffer);
            }
        } catch (Exception exception) {
            log.error("下载出错");
            return R.fail();
        } finally {
            if (null != bis) {
                bis.close();
            }
        String filePath="C:\\";
        FileOutputStream fileOut = null;
        //创建不同的文件夹目录
        File file=new File(filePath);
        String fileName = filePath + UPLOAD_EXCEL;
        //判断文件夹是否存在
        if (!file.exists())
        {
            //如果文件夹不存在,则创建新的的文件夹
            file.mkdirs();
        }
        return R.ok();
        try
        {
            BufferedInputStream bis = new BufferedInputStream(inputStream);
            //判断文件的保存路径后面是否以/结尾
            if (!filePath.endsWith("/")) {
                filePath += "/";
            }
            //写入到文件(注意文件保存路径的后面一定要加上文件的名称)
            fileOut = new FileOutputStream(fileName);
            BufferedOutputStream bos = new BufferedOutputStream(fileOut);
            byte[] buf = new byte[4096];
            int length = bis.read(buf);
            //保存文件
            while(length != -1)
            {
                bos.write(buf, 0, length);
                length = bis.read(buf);
            }
            bos.close();
            bis.close();
        } catch (Exception e)
        {
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return R.ok(fileName);
    }
    @ApiOperation(value = "上传照片")
@@ -378,5 +390,52 @@
        return partyBuildingService.deleteDynUser(id);
    }
    /**
     * @功能 下载材料接口
     * @return
     */
    @GetMapping("saveurlas")
    public  void saveUrlAs() throws IOException, SftpException {
        SFTPUtil sftp = new SFTPUtil();
        sftp.login();
        InputStream inputStream = sftp.downloadInputStream(FtpConstants.FTPFILEPATH_MUBAN, UPLOAD_EXCEL);
        String filePath="C:\\";
        FileOutputStream fileOut = null;
        //创建不同的文件夹目录
        File file=new File(filePath);
        //判断文件夹是否存在
        if (!file.exists())
        {
            //如果文件夹不存在,则创建新的的文件夹
            file.mkdirs();
        }
        try
        {
            BufferedInputStream bis = new BufferedInputStream(inputStream);
            //判断文件的保存路径后面是否以/结尾
            if (!filePath.endsWith("/")) {
                filePath += "/";
            }
            //写入到文件(注意文件保存路径的后面一定要加上文件的名称)
            fileOut = new FileOutputStream(filePath+UPLOAD_EXCEL);
            BufferedOutputStream bos = new BufferedOutputStream(fileOut);
            byte[] buf = new byte[4096];
            int length = bis.read(buf);
            //保存文件
            while(length != -1)
            {
                bos.write(buf, 0, length);
                length = bis.read(buf);
            }
            bos.close();
            bis.close();
        } catch (Exception e)
        {
            e.printStackTrace();
            System.out.println("抛出异常!!");
        }
    }
}