6c
8 小时以前 2f1913cbfd84fe580cdd48b810251fdf2ad29112
src/main/java/com/product/file/controller/FileManagerController.java
@@ -294,7 +294,7 @@
            fse=new FieldSetEntity();
            fse.setTableName("product_sys_attachments");
            fse.setValue("uuid",uuid);
            fse.setValue("needOnlineView", 0);
            fse.setValue("needOnlineView", 0);
            SpringMVCContextHolder.getSystemLogger().error(FileCode.FORM_NODATA.getValue(), FileCode.FORM_NODATA.getText());
//            return this.error(FileCode.FORM_NODATA.getValue(), FileCode.FORM_NODATA.getText());
         }
@@ -360,7 +360,7 @@
         // 正式代码
         fileManagerService.getFileContent(fse, response);
         /*===test-start===*/
//            String tempPath = fse.getString("tempPath");
//            String tempPath = "";
//            File file = new File(tempPath);
//            OutputStream sos = new FileOutputStream(file);
//            fileManagerService.getFileContent(fse, sos);
@@ -415,4 +415,88 @@
         return error(FileCode.GET_FILE_CONTENT_FAIL.getValue(), FileCode.GET_FILE_CONTENT_FAIL.getText());
      }
   }
    /**
     * 集群文件同步方法-接收
     *
     * @return 结果
     */
    @RequestMapping(value = "/cluster-file-sync/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String clusterFileSync(HttpServletRequest request, HttpServletResponse response) {
        try {
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            RequestParameterEntity rpe = (RequestParameterEntity) bean;
            fileManagerService.clusterFileSyncAccept(rpe);
            return OK();
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(e.getCode(), e.getMessage());
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(FileCode.CLUSTER_FILE_SYNC_ACCEPT_FAIL.getValue(), FileCode.CLUSTER_FILE_SYNC_ACCEPT_FAIL.getText() + ":" + BaseUtil.getErrorInfo(e).substring(0, 500));
        }
    }
    /**
     * 预览验证
     * @return 结果
     */
    @RequestMapping(value = "/check-preview/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String checkPreview(HttpServletRequest request, HttpServletResponse response) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            RequestParameterEntity rpe = (RequestParameterEntity) bean;
            if (null != rpe && null != rpe.getFormData()) {
                fse = rpe.getFormData();
            }
            if (fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(FileCode.FORM_NODATA.getValue(), FileCode.FORM_NODATA.getText());
                return this.error(FileCode.FORM_NODATA.getValue(), FileCode.FORM_NODATA.getText());
            }
            return OK(fileManagerService.checkPreview(fse));
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(e.getCode(), e.getMessage());
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(FileCode.CHECK_PREVIEW_FAIL);
        }
    }
    /**
     * 预览验证
     * @return 结果
     */
    @RequestMapping(value = "/get-signature/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String getSignature(HttpServletRequest request, HttpServletResponse response) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            RequestParameterEntity rpe = (RequestParameterEntity) bean;
            if (null != rpe && null != rpe.getFormData()) {
                fse = rpe.getFormData();
            }
            if (fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(FileCode.FORM_NODATA.getValue(), FileCode.FORM_NODATA.getText());
                return this.error(FileCode.FORM_NODATA.getValue(), FileCode.FORM_NODATA.getText());
            }
            return OK(fileManagerService.getSignature(fse));
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(e.getCode(), e.getMessage());
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(FileCode.GET_USER_SIGNATURE_FAIL);
        }
    }
}