jiangping
2025-04-17 456a06d365dcc73d2d0e2d2a4b177d875152380b
代码初始化
已修改3个文件
76 ■■■■■ 文件已修改
admin/src/views/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/api/common/PublicCloudController.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/api/web/WebCategoryController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/index.vue
@@ -42,7 +42,7 @@
          <div class="card">
            <div class="header">
              <div class="left">
                <div class="fs15">DCA今日提交数量</div>
                <div class="fs15">DCA今日上报次数</div>
                <div class="num">{{ headerData.todayDcaNum ||0 }}</div>
              </div>
<!--              <img src="@/assets/icons/home_icon3.png" alt="" />-->
@@ -50,7 +50,7 @@
            <div class="content">
              <div>符合项:{{ headerData.dcaYesNum || 0}}</div>
              <div>不符合项:{{ headerData.dcaNoNum || 0}}</div>
              <div>总提交量:{{ headerData.dcaNum || 0}}</div>
              <div>总上报次数:{{ headerData.dcaNum || 0}}</div>
            </div>
          </div>
          <div class="card">
server/src/main/java/com/doumee/api/common/PublicCloudController.java
@@ -66,7 +66,76 @@
    @ApiOperation(value = "批量上传文件到FTP")
    @RequestMapping(method= RequestMethod.POST,value="/uploadBatch")
    @ResponseBody
    public void uploadBatch(HttpServletRequest request, HttpServletResponse response, String folder) throws Exception {
    public void uploadBatch(@RequestParam("files") MultipartFile[] fileList,HttpServletRequest request, HttpServletResponse response, String folder) throws Exception {
        if(Objects.isNull(folder)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        if(Objects.isNull(fileList)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        SystemDictData folderData =  systemDictDataBiz.queryByCode(Constants.FTP,folder);
        if(Objects.isNull(folderData)||StringUtils.isBlank(folderData.getCode())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"目标文件夹错误");
        }
        folder = systemDictDataBiz.queryByCode(Constants.FTP,folder).getCode();
        String prefixPath = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode();
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        Map<String, Object> context = new HashMap<>();
        try {
            if(ftp == null){
                ftp = new FtpUtil(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_HOST).getCode(),
                        Integer.parseInt(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PORT).getCode()),
                        systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_USERNAME).getCode(),
                        systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PWD).getCode());
            }else{
                ftp.connect();
            }
            context.put("success", true);
            context.put("code", 200);
            context.put("errno",0);
               JSONArray jsonArray = new JSONArray();
            if (fileList.length > 0) {
                //遍历文件列表
                Integer index = Constants.ONE;
                for (MultipartFile file :fileList) {
                    //获得每一个文件
                    String originname = file.getOriginalFilename();
                    InputStream is = file.getInputStream();
                    String endType = originname.substring(originname.lastIndexOf("."), originname.length());
                    String date = DateUtil.getNowShortDate();
                    String fName = date + "/" + UUID.randomUUID() + endType;
                    String fileName = folder + fName;
                    boolean r = ftp.uploadInputstreamBatch(is, fileName, Constants.equalsInteger(index ,fileList.length),index);
                    if (r) {
                        JSONObject fileJSON = new JSONObject();
                        fileJSON.put("url", prefixPath + fileName);
                        fileJSON.put("imgaddr", fName);
                        fileJSON.put("imgname", fileName);
                        fileJSON.put("originname", originname);
                        jsonArray.add(fileJSON);
                    }
                    index = index + 1;
                }
                context.put("data",jsonArray);
            }
        } catch (Exception e) {
            log.error("【上传FTP失败】======================"+e.getMessage());
            context.put("code", 0);
            context.put("message", "上传失败");
            context.put("errno",0);
            writerJson(response, context);
            return;
        }
        writerJson(response, context);
        return;
    }
    @ApiOperation(value = "批量上传文件到FTP")
    @RequestMapping(method= RequestMethod.POST,value="/uploadBatchOld")
    @ResponseBody
    public void uploadBatchOld( HttpServletRequest request, HttpServletResponse response, String folder) throws Exception {
        if(Objects.isNull(folder)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
server/src/main/java/com/doumee/api/web/WebCategoryController.java
@@ -56,7 +56,6 @@
    @ApiOperation("获取分类类别获取分类列表")
    public ApiResponse<List<CategoryVO>> categoryList(Integer categoryType,Integer isRoot ,@RequestHeader(JwtTokenUtil.HEADER_KEY) String token){
        try {
            jwtTokenUtil.getUserInfoByToken(token);
            return ApiResponse.success(categoryService.getCategoryVOList(categoryType,isRoot));
        }catch (BusinessException e){