考勤规则变更 禅道bug修改

Signed-off-by: lSun <15893999301@qq.com>
This commit is contained in:
lSun 2025-08-05 11:02:07 +08:00
parent 2f3b5a29d3
commit 43a67fd17a
6 changed files with 99 additions and 44 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.system.att.dao;
import com.bonus.system.api.domain.MapVo;
import com.bonus.system.att.entity.*;
import com.bonus.system.basic.domain.SysOrg;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -74,4 +75,17 @@ public interface AttChangeDao {
* @param bean
*/
void addAtt(AttChangeBean bean);
/**
* 获取组织信息
* @param bean
* @return
*/
SysOrg findOrgByOrgId(AttChangeBean bean);
/**
* 修改组织信息
* @param bean
*/
void updateOrgIdByUserId(AttChangeBean bean);
}

View File

@ -16,6 +16,7 @@ import com.bonus.system.att.tasks.NewAttTask;
import com.bonus.system.att.utils.RoleUtil;
import com.bonus.system.att.utils.WorkdayCalculator;
import com.bonus.system.basic.domain.SysNotice;
import com.bonus.system.basic.domain.SysOrg;
import com.bonus.system.basic.service.SysNoticeService;
import com.bonus.system.file.service.FileUploadService;
import lombok.extern.log4j.Log4j2;
@ -81,6 +82,10 @@ public class AttChangeServiceImpl implements AttChangeService {
if(i>0){
//修改部门信息
int l = attChangeDao.updateUser(bean);
//处理人员组织变更休假/外出/等审批组织
SysOrg orgBean = attChangeDao.findOrgByOrgId(bean);
bean.setAfterOrgName(orgBean.getOrgName());
attChangeDao.updateOrgIdByUserId(bean);
//先去判断是否有该人员信息
AttChangeBean o = attChangeDao.getAttPerson(bean);
if(o!=null && o.getId()>0){

View File

@ -258,4 +258,10 @@ public interface SysUserMapper
* @date 2025/2/18 10:31
*/
void delAttGroupPersonRelation(Long userId);
/**
* 删除人员数据后同步删除组织变更数据
* @param userId
*/
void delChange(Long userId);
}

View File

@ -272,6 +272,8 @@ public class SysUserServiceImpl implements SysUserService
subOrgServiceImpl.syncDelUser(userId);
// 删除考勤组数据
userMapper.delAttGroupPersonRelation(userId);
// 删除变更记录
userMapper.delChange(userId);
return userMapper.deleteUserById(userId);
} catch (Exception e) {
log.error(e.toString(),e);

View File

@ -9,81 +9,104 @@
</insert>
<insert id="addAtt">
INSERT INTO `att_change`(`user_id`, `old_att_id`, `after_att_id`, `old_org_id`, `after_org_id`, `create_user_id`)
INSERT INTO `att_change`(`user_id`, `old_att_id`, `after_att_id`, `old_org_id`, `after_org_id`,
`create_user_id`)
VALUES (#{userId}, #{oldAttId}, #{afterAttId}, #{oldOrgId}, #{afterOrgId}, #{createUserId})
</insert>
<update id="updateUser">
UPDATE sys_user_org
SET `org_id` = #{afterOrgId}
WHERE `user_id` = #{userId} and `is_active` = '1'
WHERE `user_id` = #{userId}
and `is_active` = '1'
</update>
<update id="updateAttPerson">
UPDATE `att_group_person_relation` SET `group_id` = #{afterAttId} WHERE `user_id` = #{userId} and `is_active` = '1'
UPDATE `att_group_person_relation`
SET `group_id` = #{afterAttId}
WHERE `user_id` = #{userId}
and `is_active` = '1'
</update>
<update id="updateOrgIdByUserId">
UPDATE leave_apply
SET org_id = #{afterOrgId},
org_name = #{afterOrgName}
WHERE user_id = #{userId}
</update>
<select id="getChangeList" resultType="com.bonus.system.att.entity.AttChangeBean">
SELECT att.id,
att.user_id as userId,
su.user_name as userName,
su.phone as phone,
att.old_att_id,
gr1.group_name as oldAttName,
att.after_att_id,
gr2.group_name as afterAttName,
att.user_id as userId,
su.user_name as userName,
su.phone as phone,
att.old_att_id,
gr1.group_name as oldAttName,
att.after_att_id,
gr2.group_name as afterAttName,
att.old_org_id,
org1.org_name as oldOrgName,
att.after_org_id,
org1.org_name as afterOrgName,
att.create_user_id,
su2.user_name as createName,
att.create_time as createTime
att.old_org_id,
org1.org_name as oldOrgName,
att.after_org_id,
org2.org_name as afterOrgName,
att.create_user_id,
su2.user_name as createName,
att.create_time as createTime
FROM att_change att
LEFT JOIN sys_user su ON su.user_id = att.user_id
LEFT JOIN sys_organization org1 on org1.id = att.old_org_id
LEFT JOIN sys_organization org2 on org2.id = att.after_org_id
LEFT JOIN att_group gr1 on gr1.id = att.old_att_id
LEFT JOIN att_group gr2 on gr2.id = att.after_att_id
LEFT JOIN sys_user su2 ON su2.user_id = att.create_user_id
<where>
<if test="userName != null and userName != ''">
and su.user_name like concat('%',#{userName},'%')
</if>
<if test="phone != null and phone != ''">
and su.phone like concat('%',#{phone},'%')
</if>
</where>
LEFT JOIN sys_user su ON su.user_id = att.user_id
LEFT JOIN sys_organization org1 on org1.id = att.old_org_id
LEFT JOIN sys_organization org2 on org2.id = att.after_org_id
LEFT JOIN att_group gr1 on gr1.id = att.old_att_id
LEFT JOIN att_group gr2 on gr2.id = att.after_att_id
LEFT JOIN sys_user su2 ON su2.user_id = att.create_user_id
where att.is_active = '1'
<if test="userName != null and userName != ''">
and su.user_name like concat('%',#{userName},'%')
</if>
<if test="phone != null and phone != ''">
and su.phone like concat('%',#{phone},'%')
</if>
ORDER BY att.create_time desc
</select>
<select id="getAttPerson" resultType="com.bonus.system.att.entity.AttChangeBean">
SELECT id FROM `att_group_person_relation`
WHERE is_active = '1' AND user_id = #{userId}
SELECT id
FROM `att_group_person_relation`
WHERE is_active = '1'
AND user_id = #{userId}
</select>
<select id="getAttGroup" resultType="com.bonus.system.att.entity.AttChangeBean">
SELECT id as afterAttId, group_name as afterAttName FROM att_group
SELECT id as afterAttId, group_name as afterAttName
FROM att_group
WHERE is_active = '1'
</select>
<select id="getOldData" resultType="com.bonus.system.att.entity.AttChangeBean">
SELECT su.user_name as userName,
su.phone as phoneNumber,
org.id as oldOrgId,
org.org_name as oldOrgName,
gr.id as oldAttId,
SELECT su.user_name as userName,
su.phone as phoneNumber,
org.id as oldOrgId,
org.org_name as oldOrgName,
gr.id as oldAttId,
gr.group_name as oldAttName
FROM sys_user su
LEFT JOIN sys_user_org suo ON su.user_id = suo.user_id and suo.is_active = '1'
LEFT JOIN sys_organization org ON org.id = suo.org_id AND org.is_active ='1'
LEFT JOIN att_group_person_relation pr ON pr.user_id = su.user_id AND pr.is_active ='1'
LEFT JOIN sys_user_org suo ON su.user_id = suo.user_id and suo.is_active = '1'
LEFT JOIN sys_organization org ON org.id = suo.org_id AND org.is_active = '1'
LEFT JOIN att_group_person_relation pr ON pr.user_id = su.user_id AND pr.is_active = '1'
LEFT JOIN att_group gr ON gr.id = pr.group_id
WHERE su.user_id = #{userId}
</select>
<select id="getUser" resultType="java.lang.Integer">
select count(1) from sys_user_org
WHERE `user_id` = #{userId} and `is_active` = '1'
select count(1)
from sys_user_org
WHERE `user_id` = #{userId}
and `is_active` = '1'
</select>
<select id="findOrgByOrgId" resultType="com.bonus.system.basic.domain.SysOrg">
SELECT org_name as orgName
FROM sys_organization
WHERE id = #{afterOrgId}
</select>
</mapper>

View File

@ -62,6 +62,11 @@
SET is_active = '0'
WHERE user_id = #{userId}
</delete>
<update id="delChange">
UPDATE att_change
SET is_active = '0'
WHERE user_id = #{userId}
</update>
<update id="deleteUserById">
update sys_user
set is_active = 0