杜洪波
2024-08-22 305dc0c57b588f15dd53e5c6c01c3210292a3e9d
src/main/java/com/product/file/controller/DocumentDirectoryConstoller.java
@@ -15,6 +15,8 @@
import com.product.module.sys.config.SystemErrorCode;
import com.product.module.sys.entity.SystemUser;
import com.product.module.sys.version.ApiVersion;
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -34,16 +36,43 @@
@RequestMapping("/api/directory")
@RestController
public class DocumentDirectoryConstoller extends AbstractBaseController {
  @Autowired
  public DocumentDirectoryService documentDirectoryService;
   DocumentDirectoryService documentDirectoryService;
  /**
   * 数据权限验证
   */
  @Autowired
  PermissionService permissionService;
  /**
   * 新增文件夹数据
    *
    * @param request
    * @return
    */
   @RequestMapping(value = "/all-directory-tree/{version}", method = RequestMethod.POST)
   @ApiVersion(1)
   public String allDirectoryTree(HttpServletRequest request) {
      try {
         // 获取参数
         FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_OA_DIRECTORY);
         return com.product.util.ResultInfo.success(BaseUtil.dataTableEntityToJson(documentDirectoryService.allDirectoryTree()));
      } catch (BaseException e) {
         SpringMVCContextHolder.getSystemLogger().error(e);
         return this.error(e);
      } catch (Exception e) {
         e.printStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
         return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
      }
   }
   /**
    * 新增文件夹数据
    *
   * @param request
   * @return
   */
@@ -60,8 +89,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
      IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService);
      return OK_Add(service.addDocumentDirectory(fse));
@@ -71,12 +102,14 @@
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
    }
  }
  /**
   * 修改文件夹
    *
   * @param request
   * @return
   */
@@ -93,9 +126,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder
            .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
      String uuid = fse.getString(CmnConst.UUID);//表uuid
      //超级管理员为1   普通单位管理员2
@@ -107,27 +141,32 @@
        type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER;
      }
      //数据操作的权限验证
      if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) {
        SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
        return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
         if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) {
            SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
            return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
      }
      IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService);
      if(service.upDocumentDirectory(fse)) {
        return OK();
      }
      return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
    } catch (BaseException e) {
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(e);
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText());
    }
  }
  /**
   * 个人文件夹重命名
    *
   * @param request
   * @return
   */
@@ -144,9 +183,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder
                .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
      String uuid = fse.getString(CmnConst.UUID);//表uuid
      //超级管理员为1   普通单位管理员2
@@ -158,27 +198,32 @@
        type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER;
      }
      //数据操作的权限验证
      if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) {
        SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
        return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
         if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) {
            SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
            return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
      }
      IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService);
      if(service.upDocumentDirectoryName(fse)) {
        return OK();
      }
      return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(), DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(),
               DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText());
    } catch (BaseException e) {
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(e);
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(), DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(),
               DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText());
    }
  }
  /**
   * 删除文件夹
    *
   * @param request
   * @return
   */
@@ -195,9 +240,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder
            .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
      String uuid = fse.getString(CmnConst.UUID);//表uuid
      //超级管理员为1   普通单位管理员2
@@ -209,28 +255,32 @@
        type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER;
      }
      //数据操作的权限验证
      if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) {
        SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
        return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
         if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) {
            SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
            return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
      }
      IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService);
      if(service.delDocumentDirectory(fse)){
        return OK();
      }
      return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText());
    } catch (BaseException e) {
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(e);
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText());
    }
  }
  /**
   * 文件目录列表展示
    *
   * @param request
   * @return
   */
@@ -247,9 +297,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder
                .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
      return OK_List(documentDirectoryService.moveToList(fse));
    } catch (BaseException e) {
@@ -258,13 +309,14 @@
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText());
    }
  }
  /**
   * 获取文档目录树形列表
    *
   * @param request
   * @return
   */
@@ -281,9 +333,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder
            .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
        return ResultInfo.success(documentDirectoryService.treeListAll(fse));
    } catch (BaseException e) {
@@ -292,11 +345,14 @@
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getText());
    }
  }
  /**
   * 获取文档目录详情
    *
   * @param request
   * @return
   */
@@ -313,9 +369,10 @@
      }
      //判断参数是否为空
      if (fse == null) {
        SpringMVCContextHolder
            .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
        return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText());
            SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
            return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(),
                  DocumentCode.DOCUMENT_FORM_NODATA.getText());
      }
      String uuid = fse.getString(CmnConst.UUID);//表uuid
      //超级管理员为1   普通单位管理员2
@@ -327,9 +384,11 @@
        type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER;
      }
      //数据操作的权限验证
      if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) {
        SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
        return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
         if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) {
            SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
            return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                  SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
      }
      return OK_List(documentDirectoryService.documentDirectoryInfo(fse));
    } catch (BaseException e) {
@@ -338,7 +397,8 @@
    }catch (Exception e) {
      e.printStackTrace();
      SpringMVCContextHolder.getSystemLogger().error(e);
      return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText());
         return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(),
               DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText());
    }
  }
}