Ver código fonte

离职人员

njs 3 anos atrás
pai
commit
9404df7fef

+ 7 - 0
suishenbang-quartz/src/main/java/com/dgtly/quartz/task/RyTask.java

@@ -79,4 +79,11 @@ public class RyTask
     public void initUserAuthor() throws Exception {
         sysUserOrderAuthorService.initUserAuthor();
     }
+    /**
+     *
+     * 离职用户标识
+     * **/
+    public void quitUser()throws Exception {
+        sysUserOrderAuthorService.quitUser();
+    }
 }

+ 5 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/SysUser.java

@@ -135,7 +135,12 @@ public class SysUser extends BaseEntity
 
     /** 用户权限 TUC*/
     private String  authorType;
+    //2离职authorType
+    private String quit;
 
+    public String getQuit(){return  quit;}
+
+    public  void setQuit(String quit){this.quit=quit;}
     public String getAuthorType() {
         return authorType;
     }

+ 196 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/SysUserQuit.java

@@ -0,0 +1,196 @@
+package com.dgtly.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.dgtly.common.annotation.Excel;
+import com.dgtly.common.core.domain.BaseEntity;
+
+/**
+ * 离职人员对象 sys_user_quit
+ * 
+ * @author dgtly
+ * @date 2022-06-16
+ */
+public class SysUserQuit extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 是否删除 */
+    @Excel(name = "是否删除")
+    private Long isDelete;
+
+    /** 人员名称 */
+    @Excel(name = "人员名称")
+    private String name;
+
+    /** 登陆账号 */
+    @Excel(name = "登陆账号")
+    private String loginname;
+
+    /** 邮件 */
+    @Excel(name = "邮件")
+    private String email;
+
+    /** 电话 */
+    @Excel(name = "电话")
+    private String mobile;
+
+    /** 雇员id */
+    @Excel(name = "雇员id")
+    private String sapemployeeid;
+
+    /** null */
+    @Excel(name = "null")
+    private String sapcostcentercode;
+
+    /** null */
+    @Excel(name = "null")
+    private String sapcostcenter;
+
+    /** null */
+    @Excel(name = "null")
+    private String sapcompanycode;
+
+    /** null */
+    @Excel(name = "null")
+    private String sapcompanyname;
+
+    /** 状态0离职 */
+    @Excel(name = "状态0离职")
+    private String status;
+
+    /** 离职时间 */
+    @Excel(name = "离职时间")
+    private String leavedate;
+
+    public void setIsDelete(Long isDelete) 
+    {
+        this.isDelete = isDelete;
+    }
+
+    public Long getIsDelete() 
+    {
+        return isDelete;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setLoginname(String loginname) 
+    {
+        this.loginname = loginname;
+    }
+
+    public String getLoginname() 
+    {
+        return loginname;
+    }
+    public void setEmail(String email) 
+    {
+        this.email = email;
+    }
+
+    public String getEmail() 
+    {
+        return email;
+    }
+    public void setMobile(String mobile) 
+    {
+        this.mobile = mobile;
+    }
+
+    public String getMobile() 
+    {
+        return mobile;
+    }
+    public void setSapemployeeid(String sapemployeeid) 
+    {
+        this.sapemployeeid = sapemployeeid;
+    }
+
+    public String getSapemployeeid() 
+    {
+        return sapemployeeid;
+    }
+    public void setSapcostcentercode(String sapcostcentercode) 
+    {
+        this.sapcostcentercode = sapcostcentercode;
+    }
+
+    public String getSapcostcentercode() 
+    {
+        return sapcostcentercode;
+    }
+    public void setSapcostcenter(String sapcostcenter) 
+    {
+        this.sapcostcenter = sapcostcenter;
+    }
+
+    public String getSapcostcenter() 
+    {
+        return sapcostcenter;
+    }
+    public void setSapcompanycode(String sapcompanycode) 
+    {
+        this.sapcompanycode = sapcompanycode;
+    }
+
+    public String getSapcompanycode() 
+    {
+        return sapcompanycode;
+    }
+    public void setSapcompanyname(String sapcompanyname) 
+    {
+        this.sapcompanyname = sapcompanyname;
+    }
+
+    public String getSapcompanyname() 
+    {
+        return sapcompanyname;
+    }
+    public void setStatus(String status) 
+    {
+        this.status = status;
+    }
+
+    public String getStatus() 
+    {
+        return status;
+    }
+    public void setLeavedate(String leavedate) 
+    {
+        this.leavedate = leavedate;
+    }
+
+    public String getLeavedate() 
+    {
+        return leavedate;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("isDelete", getIsDelete())
+            .append("name", getName())
+            .append("loginname", getLoginname())
+            .append("email", getEmail())
+            .append("mobile", getMobile())
+            .append("sapemployeeid", getSapemployeeid())
+            .append("sapcostcentercode", getSapcostcentercode())
+            .append("sapcostcenter", getSapcostcenter())
+            .append("sapcompanycode", getSapcompanycode())
+            .append("sapcompanyname", getSapcompanyname())
+            .append("status", getStatus())
+            .append("leavedate", getLeavedate())
+            .toString();
+    }
+}

+ 2 - 0
suishenbang-system/src/main/java/com/dgtly/system/mapper/SysUserMapper.java

@@ -210,4 +210,6 @@ public interface SysUserMapper
     int insertUserRole(@Param("userId") Long userId, @Param("roleId") Long roleId);
 
     int deleteByLoginName(@Param("loginName") String loginName);
+
+    List<SysUser> selectUser();
 }

+ 64 - 0
suishenbang-system/src/main/java/com/dgtly/system/mapper/SysUserQuitMapper.java

@@ -0,0 +1,64 @@
+package com.dgtly.system.mapper;
+
+import com.dgtly.system.domain.SysUserQuit;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 离职人员Mapper接口
+ * 
+ * @author dgtly
+ * @date 2022-06-16
+ */
+public interface SysUserQuitMapper 
+{
+    /**
+     * 查询离职人员
+     * 
+     * @param createBy 离职人员ID
+     * @return 离职人员
+     */
+    public SysUserQuit selectSysUserQuitById(String createBy);
+
+    /**
+     * 查询离职人员列表
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 离职人员集合
+     */
+    public List<SysUserQuit> selectSysUserQuitList(SysUserQuit sysUserQuit);
+
+    /**
+     * 新增离职人员
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 结果
+     */
+    public int insertSysUserQuit(SysUserQuit sysUserQuit);
+
+    /**
+     * 修改离职人员
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 结果
+     */
+    public int updateSysUserQuit(SysUserQuit sysUserQuit);
+
+    /**
+     * 删除离职人员
+     * 
+     * @param createBy 离职人员ID
+     * @return 结果
+     */
+    public int deleteSysUserQuitById(String createBy);
+
+    /**
+     * 批量删除离职人员
+     * 
+     * @param createBys 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteSysUserQuitByIds(String[] createBys);
+
+    public Set<String> selectAllUserSapEmployeeId();
+}

+ 6 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserOrderAuthorService.java

@@ -88,4 +88,10 @@ public interface ISysUserOrderAuthorService
      * 初始化用户权限
      */
     void initUserAuthor();
+
+    /**
+     *
+     * 离职用户标识
+     * **/
+    void quitUser();
 }

+ 61 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserQuitService.java

@@ -0,0 +1,61 @@
+package com.dgtly.system.service;
+
+import com.dgtly.system.domain.SysUserQuit;
+import java.util.List;
+
+/**
+ * 离职人员Service接口
+ * 
+ * @author dgtly
+ * @date 2022-06-16
+ */
+public interface ISysUserQuitService 
+{
+    /**
+     * 查询离职人员
+     * 
+     * @param createBy 离职人员ID
+     * @return 离职人员
+     */
+    public SysUserQuit selectSysUserQuitById(String createBy);
+
+    /**
+     * 查询离职人员列表
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 离职人员集合
+     */
+    public List<SysUserQuit> selectSysUserQuitList(SysUserQuit sysUserQuit);
+
+    /**
+     * 新增离职人员
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 结果
+     */
+    public int insertSysUserQuit(SysUserQuit sysUserQuit);
+
+    /**
+     * 修改离职人员
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 结果
+     */
+    public int updateSysUserQuit(SysUserQuit sysUserQuit);
+
+    /**
+     * 批量删除离职人员
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteSysUserQuitByIds(String ids);
+
+    /**
+     * 删除离职人员信息
+     * 
+     * @param createBy 离职人员ID
+     * @return 结果
+     */
+    public int deleteSysUserQuitById(String createBy);
+}

+ 24 - 3
suishenbang-system/src/main/java/com/dgtly/system/service/impl/SysUserOrderAuthorServiceImpl.java

@@ -9,11 +9,9 @@ import com.dgtly.common.utils.DateUtils;
 import com.dgtly.common.utils.StringUtils;
 import com.dgtly.common.utils.UserIdentityUtil;
 import com.dgtly.system.domain.*;
-import com.dgtly.system.mapper.SysUserAuthorRelMapper;
-import com.dgtly.system.mapper.SysUserExtMapper;
+import com.dgtly.system.mapper.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.dgtly.system.mapper.SysUserOrderAuthorMapper;
 import com.dgtly.system.service.ISysUserOrderAuthorService;
 import com.dgtly.common.core.text.Convert;
 import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +36,11 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
     @Autowired
     private SysUserExtMapper userExtMapper;
 
+    @Autowired
+    private SysUserMapper userMapper;
+    @Autowired
+    private SysUserQuitMapper userQuitMapper;
+
     /**
      * 查询权限
      * 
@@ -341,5 +344,23 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
 
     }
 
+    @Override
+    public void quitUser() {
+        List<SysUser> userList=userMapper.selectUser();
+        Set<String> SapEmployeeIdList=userQuitMapper.selectAllUserSapEmployeeId();
+        final Set<String> employList=SapEmployeeIdList.stream().map(String::toUpperCase).collect(Collectors.toSet());
+        userList.forEach(sysUser -> {
+            SysUserExt userExt=userExtMapper.selectSysUserExtById(sysUser.getUserId());
+            if(userExt !=null){
+            if (employList.contains(userExt.getSapEmployeeId().toUpperCase())) {
+                sysUser.setQuit("2");
+                userMapper.updateUser(sysUser);
+            }
+            }
+        });
+
+
+    }
+
 }
 

+ 97 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/impl/SysUserQuitServiceImpl.java

@@ -0,0 +1,97 @@
+package com.dgtly.system.service.impl;
+
+import java.util.List;
+import com.dgtly.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.dgtly.system.mapper.SysUserQuitMapper;
+import com.dgtly.system.domain.SysUserQuit;
+import com.dgtly.system.service.ISysUserQuitService;
+import com.dgtly.common.core.text.Convert;
+
+/**
+ * 离职人员Service业务层处理
+ * 
+ * @author dgtly
+ * @date 2022-06-16
+ */
+@Service
+public class SysUserQuitServiceImpl implements ISysUserQuitService 
+{
+    @Autowired
+    private SysUserQuitMapper sysUserQuitMapper;
+
+    /**
+     * 查询离职人员
+     * 
+     * @param createBy 离职人员ID
+     * @return 离职人员
+     */
+    @Override
+    public SysUserQuit selectSysUserQuitById(String createBy)
+    {
+        return sysUserQuitMapper.selectSysUserQuitById(createBy);
+    }
+
+    /**
+     * 查询离职人员列表
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 离职人员
+     */
+    @Override
+    public List<SysUserQuit> selectSysUserQuitList(SysUserQuit sysUserQuit)
+    {
+        return sysUserQuitMapper.selectSysUserQuitList(sysUserQuit);
+    }
+
+    /**
+     * 新增离职人员
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 结果
+     */
+    @Override
+    public int insertSysUserQuit(SysUserQuit sysUserQuit)
+    {
+        sysUserQuit.setCreateTime(DateUtils.getNowDate());
+        return sysUserQuitMapper.insertSysUserQuit(sysUserQuit);
+    }
+
+    /**
+     * 修改离职人员
+     * 
+     * @param sysUserQuit 离职人员
+     * @return 结果
+     */
+    @Override
+    public int updateSysUserQuit(SysUserQuit sysUserQuit)
+    {
+        sysUserQuit.setUpdateTime(DateUtils.getNowDate());
+        return sysUserQuitMapper.updateSysUserQuit(sysUserQuit);
+    }
+
+    /**
+     * 删除离职人员对象
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    @Override
+    public int deleteSysUserQuitByIds(String ids)
+    {
+        return sysUserQuitMapper.deleteSysUserQuitByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除离职人员信息
+     * 
+     * @param createBy 离职人员ID
+     * @return 结果
+     */
+    @Override
+    public int deleteSysUserQuitById(String createBy)
+    {
+        return sysUserQuitMapper.deleteSysUserQuitById(createBy);
+    }
+}

+ 7 - 0
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -281,6 +281,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="isConsignee != null">is_consignee = #{isConsignee},</if>
  			<if test="isSync != null">is_sync = #{isSync},</if>
+			<if test="quit != null">quit = #{quit},</if>
  			update_time = sysdate()
  		</set>
  		where user_id = #{userId}
@@ -480,4 +481,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			)
 	</delete>
 
+	<select id="selectUser" parameterType="SysUser" resultMap="SysUserResult">
+		select u.user_id,u.company_id, u.dept_id, u.login_name, u.user_name,u.id_type,u.id_number,u.account_id,u.is_authentication,u.receive_url_mobile_no, u.email, u.avatar,
+			   u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag,
+			   u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.quit
+		from sys_user u where is_sync=0 and quit is null
+	</select>
 </mapper> 

+ 131 - 0
suishenbang-system/src/main/resources/mapper/system/SysUserQuitMapper.xml

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dgtly.system.mapper.SysUserQuitMapper">
+    
+    <resultMap type="SysUserQuit" id="SysUserQuitResult">
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDelete"    column="is_delete"    />
+        <result property="name"    column="Name"    />
+        <result property="loginname"    column="LoginName"    />
+        <result property="email"    column="Email"    />
+        <result property="mobile"    column="Mobile"    />
+        <result property="sapemployeeid"    column="SapEmployeeId"    />
+        <result property="sapcostcentercode"    column="SapCostCenterCode"    />
+        <result property="sapcostcenter"    column="SapCostCenter"    />
+        <result property="sapcompanycode"    column="SapCompanyCode"    />
+        <result property="sapcompanyname"    column="SapCompanyName"    />
+        <result property="status"    column="Status"    />
+        <result property="leavedate"    column="LeaveDate"    />
+    </resultMap>
+
+    <sql id="selectSysUserQuitVo">
+        select create_by, create_time, update_by, update_time, is_delete, Name, LoginName, Email, Mobile, SapEmployeeId, SapCostCenterCode, SapCostCenter, SapCompanyCode, SapCompanyName, Status, LeaveDate from sys_user_quit
+    </sql>
+
+    <select id="selectSysUserQuitList" parameterType="SysUserQuit" resultMap="SysUserQuitResult">
+        <include refid="selectSysUserQuitVo"/>
+        <where>  
+            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
+            <if test="name != null  and name != ''"> and Name like concat('%', #{name}, '%')</if>
+            <if test="loginname != null  and loginname != ''"> and LoginName like concat('%', #{loginname}, '%')</if>
+            <if test="email != null  and email != ''"> and Email = #{email}</if>
+            <if test="mobile != null  and mobile != ''"> and Mobile = #{mobile}</if>
+            <if test="sapemployeeid != null  and sapemployeeid != ''"> and SapEmployeeId = #{sapemployeeid}</if>
+            <if test="sapcostcentercode != null  and sapcostcentercode != ''"> and SapCostCenterCode = #{sapcostcentercode}</if>
+            <if test="sapcostcenter != null  and sapcostcenter != ''"> and SapCostCenter = #{sapcostcenter}</if>
+            <if test="sapcompanycode != null  and sapcompanycode != ''"> and SapCompanyCode = #{sapcompanycode}</if>
+            <if test="sapcompanyname != null  and sapcompanyname != ''"> and SapCompanyName like concat('%', #{sapcompanyname}, '%')</if>
+            <if test="status != null  and status != ''"> and Status = #{status}</if>
+            <if test="leavedate != null  and leavedate != ''"> and LeaveDate = #{leavedate}</if>
+        </where>
+    </select>
+    
+    <select id="selectSysUserQuitById" parameterType="String" resultMap="SysUserQuitResult">
+        <include refid="selectSysUserQuitVo"/>
+        where create_by = #{createBy}
+    </select>
+        
+    <insert id="insertSysUserQuit" parameterType="SysUserQuit">
+        insert into sys_user_quit
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">create_by,</if>
+            <if test="createTime != null ">create_time,</if>
+            <if test="updateBy != null  and updateBy != ''">update_by,</if>
+            <if test="updateTime != null ">update_time,</if>
+            <if test="isDelete != null ">is_delete,</if>
+            <if test="name != null  and name != ''">Name,</if>
+            <if test="loginname != null  and loginname != ''">LoginName,</if>
+            <if test="email != null  and email != ''">Email,</if>
+            <if test="mobile != null  and mobile != ''">Mobile,</if>
+            <if test="sapemployeeid != null  and sapemployeeid != ''">SapEmployeeId,</if>
+            <if test="sapcostcentercode != null  and sapcostcentercode != ''">SapCostCenterCode,</if>
+            <if test="sapcostcenter != null  and sapcostcenter != ''">SapCostCenter,</if>
+            <if test="sapcompanycode != null  and sapcompanycode != ''">SapCompanyCode,</if>
+            <if test="sapcompanyname != null  and sapcompanyname != ''">SapCompanyName,</if>
+            <if test="status != null  and status != ''">Status,</if>
+            <if test="leavedate != null  and leavedate != ''">LeaveDate,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">#{createBy},</if>
+            <if test="createTime != null ">#{createTime},</if>
+            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
+            <if test="updateTime != null ">#{updateTime},</if>
+            <if test="isDelete != null ">#{isDelete},</if>
+            <if test="name != null  and name != ''">#{name},</if>
+            <if test="loginname != null  and loginname != ''">#{loginname},</if>
+            <if test="email != null  and email != ''">#{email},</if>
+            <if test="mobile != null  and mobile != ''">#{mobile},</if>
+            <if test="sapemployeeid != null  and sapemployeeid != ''">#{sapemployeeid},</if>
+            <if test="sapcostcentercode != null  and sapcostcentercode != ''">#{sapcostcentercode},</if>
+            <if test="sapcostcenter != null  and sapcostcenter != ''">#{sapcostcenter},</if>
+            <if test="sapcompanycode != null  and sapcompanycode != ''">#{sapcompanycode},</if>
+            <if test="sapcompanyname != null  and sapcompanyname != ''">#{sapcompanyname},</if>
+            <if test="status != null  and status != ''">#{status},</if>
+            <if test="leavedate != null  and leavedate != ''">#{leavedate},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysUserQuit" parameterType="SysUserQuit">
+        update sys_user_quit
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="createTime != null ">create_time = #{createTime},</if>
+            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="updateTime != null ">update_time = #{updateTime},</if>
+            <if test="isDelete != null ">is_delete = #{isDelete},</if>
+            <if test="name != null  and name != ''">Name = #{name},</if>
+            <if test="loginname != null  and loginname != ''">LoginName = #{loginname},</if>
+            <if test="email != null  and email != ''">Email = #{email},</if>
+            <if test="mobile != null  and mobile != ''">Mobile = #{mobile},</if>
+            <if test="sapemployeeid != null  and sapemployeeid != ''">SapEmployeeId = #{sapemployeeid},</if>
+            <if test="sapcostcentercode != null  and sapcostcentercode != ''">SapCostCenterCode = #{sapcostcentercode},</if>
+            <if test="sapcostcenter != null  and sapcostcenter != ''">SapCostCenter = #{sapcostcenter},</if>
+            <if test="sapcompanycode != null  and sapcompanycode != ''">SapCompanyCode = #{sapcompanycode},</if>
+            <if test="sapcompanyname != null  and sapcompanyname != ''">SapCompanyName = #{sapcompanyname},</if>
+            <if test="status != null  and status != ''">Status = #{status},</if>
+            <if test="leavedate != null  and leavedate != ''">LeaveDate = #{leavedate},</if>
+        </trim>
+        where create_by = #{createBy}
+    </update>
+
+    <delete id="deleteSysUserQuitById" parameterType="String">
+        delete from sys_user_quit where create_by = #{createBy}
+    </delete>
+
+    <delete id="deleteSysUserQuitByIds" parameterType="String">
+        delete from sys_user_quit where create_by in 
+        <foreach item="createBy" collection="array" open="(" separator="," close=")">
+            #{createBy}
+        </foreach>
+    </delete>
+
+    <select id="selectAllUserSapEmployeeId"  resultType="String">
+        select u.SapEmployeeId
+        from sys_user_quit u
+    </select>
+
+</mapper>