Class SysEmployeeService

java.lang.Object
cn.herodotus.engine.data.core.service.BaseService<SysEmployee,String>
cn.herodotus.engine.supplier.upms.logic.service.hr.SysEmployeeService
All Implemented Interfaces:
cn.herodotus.engine.data.core.service.ReadableService<SysEmployee,String>, cn.herodotus.engine.data.core.service.WriteableService<SysEmployee,String>

@Service public class SysEmployeeService extends cn.herodotus.engine.data.core.service.BaseService<SysEmployee,String>

Description: 人员 服务

Author:
: gengwei.zheng
Date:
: 2020/1/20 11:54
  • Constructor Details

  • Method Details

    • getRepository

      public cn.herodotus.engine.data.core.repository.BaseRepository<SysEmployee,String> getRepository()
    • findByCondition

      public org.springframework.data.domain.Page<SysEmployee> findByCondition(int pageNumber, int pageSize, String employeeName, String mobilePhoneNumber, String officePhoneNumber, String email, String pkiEmail, Gender gender, Identity identity)
      根据动态条件分页查询人员信息

      Predicate类:一个简单或复杂的谓词类型,用来拼接条件。 Criteria 查询是以元模型的概念为基础的,元模型是为具体持久化单元的受管实体定义的,这些实体可以是实体类,嵌入类或者映射的父类。 Root接口:代表Criteria查询的根对象,能够提供查询用到的数据库字段。 CriteriaQuery接口:代表一个specific的顶层查询对象,用来执行最后的操作,它包含着查询的各个部分,比如:select 、from、where、group by、order by等注意:CriteriaQuery对象只对实体类型或嵌入式类型的Criteria查询起作用。 CriteriaBuilder接口:表示具体的比较条件。

      Parameters:
      pageNumber - 当前页码
      pageSize - 每页显示数据条目
      employeeName - 人员姓名
      mobilePhoneNumber - 手机号码
      officePhoneNumber - 办公电话
      email - 电子邮件
      pkiEmail - PKI电子邮件
      gender - 性别 Gender
      identity - 身份 Identity
      Returns:
      人员你的分页数据
    • findAllocatable

      public org.springframework.data.domain.Page<SysEmployee> findAllocatable(int pageNumber, int pageSize, String organizationId, String departmentId, String employeeName, String mobilePhoneNumber, String email, Gender gender, Identity identity)
      根据单位ID和部门ID,查找当前部门下未被设置人员归属的人员。

      业务描述: 目前采用人事归属的方式设置单位、部门、人员的关系,而不采用传统的:用人员关联单位ID、部门ID的方式进行机构人员关系的创建。 人事归属的方式解决了什么问题,主要的考虑是: (1)使用人事归属的方式,可以支持一般的组织机构、党组机构、团组机构等多种机构类型,而人员始终就是一套人员。 (2)传统MIS中用人员关联单位ID、部门ID的方式创建关系,只能支持一种组织机构。如果同一套系统或者从灵活度的角度要支持多种机构,那么只能通过每种机构关系创建一个人员信息,而每个人员信息又对应一个用户。同一个人员有多套信息和多个用户信息,导致维护起来非常混乱。 (3)这种结构与Camunda或者Flowable、Activity等工作流结构对应,便于信息的同步与管理。 organization --> tenant department --> group employee --> user

      当然有更好的设计方式,可以告诉我进行修改

      实现描述: 因为涉及到Page问题,所以采用Specification的方式,如果不涉及分页,按照如下的优先级和方式可能更好。 (1) 在repository中,定义JPQL (2) 在repository中,定义原生SQL (3) 在数据库中编写SQL View,然后进行ORM映射

      Parameters:
      pageNumber - 当前页码
      pageSize - 每页显示数据条目
      organizationId - 单位ID:如果所有部门的ID都是唯一的,那么单位ID可以为空
      departmentId - 部门ID
      Returns:
      当前部门下可以进行人事归属设置的人员分页信息,排除已设置过的人员信息
    • findByDepartmentId

      public org.springframework.data.domain.Page<SysEmployee> findByDepartmentId(int pageNumber, int pageSize, String departmentId)
    • authorize

      @Transactional(rollbackFor=cn.herodotus.engine.assistant.core.exception.transaction.TransactionalRollbackException.class) public SysEmployee authorize(String employeeId)
    • deleteById

      @Transactional(rollbackFor=cn.herodotus.engine.assistant.core.exception.transaction.TransactionalRollbackException.class) public void deleteById(String employeeId)
    • deployAllocatable

      @Transactional(rollbackFor=cn.herodotus.engine.assistant.core.exception.transaction.TransactionalRollbackException.class) public boolean deployAllocatable(List<SysEmployee> sysEmployees, List<SysOwnership> sysOwnerships)
    • removeAllocatable

      @Transactional(rollbackFor=cn.herodotus.engine.assistant.core.exception.transaction.TransactionalRollbackException.class) public boolean removeAllocatable(String organizationId, String departmentId, String employeeId)
    • findByEmployeeName

      public SysEmployee findByEmployeeName(String employeeName)