组织架构变更定时修改

This commit is contained in:
fl 2024-12-04 18:31:58 +08:00
parent 20e289e496
commit 0adc753d86
7 changed files with 67 additions and 3 deletions

View File

@ -64,4 +64,8 @@ public interface OrgChangeDao {
int orgChangeCheck(OrgChangeBean o);
List<MapVo> getAttGroupList();
void updateOrgByUserId(OrgChangeBean item);
void updateAttGroupByUserId(OrgChangeBean item);
}

View File

@ -44,5 +44,11 @@ public class AttFaceBean {
*/
private String isCheck;
private String collectionTime;
private String examineTime;
private String examineOpinion;
}

View File

@ -57,4 +57,8 @@ public interface OrgChangeService {
int orgChangeCheck(OrgChangeBean o);
List<MapVo> getAttGroupList();
void updateOrgByUserId(OrgChangeBean item);
void updateAttGroupByUserId(OrgChangeBean item);
}

View File

@ -101,5 +101,15 @@ public class OrgChangeServiceImpl implements OrgChangeService {
return orgChangeDao.getAttGroupList();
}
@Override
public void updateOrgByUserId(OrgChangeBean item) {
orgChangeDao.updateOrgByUserId(item);
}
@Override
public void updateAttGroupByUserId(OrgChangeBean item) {
orgChangeDao.updateAttGroupByUserId(item);
}
}

View File

@ -5,6 +5,8 @@ import com.alibaba.fastjson2.JSONObject;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.system.att.dao.AttSourceDataDao;
import com.bonus.system.att.entity.Holiday;
import com.bonus.system.att.entity.OrgChangeBean;
import com.bonus.system.att.service.OrgChangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
@ -13,6 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.time.Instant;
import java.util.*;
/**
@ -29,6 +32,9 @@ public class HolidayTasks {
@Resource(name = "attSourceDataDao")
private AttSourceDataDao attSourceDataDao;
@Resource(name = "OrgChangeService")
private OrgChangeService orgChangeService;
@Scheduled(cron = "0 0 5 1 1 *")
//@Scheduled(fixedDelay = 300000)
@Async
@ -62,4 +68,31 @@ public class HolidayTasks {
}
}
/**
* 考勤组变更更新数据
*/
@Scheduled(fixedDelay = 60000 * 60)
@Async
public void getOrgChange(){
OrgChangeBean bean = new OrgChangeBean();
bean.setIsCheck("1");
//查询审核通过的
List<OrgChangeBean> list = orgChangeService.selectOrgChangeList(bean);
list.forEach(item -> {
Date changeEffectiveDate = item.getChangeEffectiveDate();
// Date 转换为 Instant
Instant changeEffectiveInstant = changeEffectiveDate.toInstant();
// 获取当前时间的 Instant
Instant now = Instant.now();
// 判断 changeEffectiveDate 是否大于当前时间
if (!changeEffectiveInstant.isAfter(now)) {
orgChangeService.updateOrgByUserId(item);
if ("1".equals(item.getIsChangeAttGroup())){
orgChangeService.updateAttGroupByUserId(item);
}
}
});
}
}

View File

@ -115,5 +115,11 @@
</set>
where id = #{id}
</update>
<update id="updateOrgByUserId">
update sys_user_org set org_id = #{newOrgId} where user_id = #{userId} and org_id = #{oldOrgId}
</update>
<update id="updateAttGroupByUserId">
update att_group_person_relation set group_id = #{newAttGroup},org_id = #{newOrgId} where user_id = #{userId} and group_id = #{oldAttGroup}
</update>
</mapper>

View File

@ -8,8 +8,8 @@
values(#{userId},#{userName},#{phone},#{password},#{isPd},#{isFace},#{updateTime},#{isCadre})
</insert>
<insert id="insertWebFace">
insert into sys_user_face(user_id,applied_face,applied_face_features,new_face,new_face_features,is_check)
values(#{userId},#{appliedFace},#{appliedFaceFeatures},#{newFace},#{newFaceFeatures},#{isCheck})
insert into sys_user_face(user_id,applied_face,applied_face_features,new_face,new_face_features,is_check,collection_time,examine_time)
values(#{userId},#{appliedFace},#{appliedFaceFeatures},#{newFace},#{newFaceFeatures},#{isCheck},#{collectionTime},#{examineTime})
</insert>
<insert id="insertWebLeave" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
insert into leave_apply(leave_form_id,submit_id,user_id,user_name,org_id,org_name,type,
@ -48,7 +48,8 @@
update gz_attendance_wechat.sys_user_wechat set is_pd = #{isPd} where user_id = #{userId}
</update>
<update id="updateWebFace">
update sys_user_face set new_face = #{newFace},new_face_features = #{newFaceFeatures},is_check = #{isCheck}
update sys_user_face set new_face = #{newFace},new_face_features = #{newFaceFeatures},is_check = #{isCheck},
collection_time = #{collectionTime},examine_time = #{examineTime}
where user_id = #{userId}
</update>