diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/OrgChangeDao.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/OrgChangeDao.java index cdadb6b..abde570 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/OrgChangeDao.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/OrgChangeDao.java @@ -64,4 +64,8 @@ public interface OrgChangeDao { int orgChangeCheck(OrgChangeBean o); List getAttGroupList(); + + void updateOrgByUserId(OrgChangeBean item); + + void updateAttGroupByUserId(OrgChangeBean item); } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttFaceBean.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttFaceBean.java index c02a31f..d57b548 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttFaceBean.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttFaceBean.java @@ -44,5 +44,11 @@ public class AttFaceBean { */ private String isCheck; + private String collectionTime; + + private String examineTime; + + private String examineOpinion; + } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeService.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeService.java index 312dc4a..79ae1e2 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeService.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeService.java @@ -57,4 +57,8 @@ public interface OrgChangeService { int orgChangeCheck(OrgChangeBean o); List getAttGroupList(); + + void updateOrgByUserId(OrgChangeBean item); + + void updateAttGroupByUserId(OrgChangeBean item); } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeServiceImpl.java index cbcb4ea..81db8e5 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeServiceImpl.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/OrgChangeServiceImpl.java @@ -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); + } + } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/tasks/HolidayTasks.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/tasks/HolidayTasks.java index 1a8baa9..fdda470 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/tasks/HolidayTasks.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/tasks/HolidayTasks.java @@ -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 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); + } + } + }); + } + } diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/att/OrgChangeMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/att/OrgChangeMapper.xml index 32741e2..9edc8e7 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/att/OrgChangeMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/att/OrgChangeMapper.xml @@ -115,5 +115,11 @@ where id = #{id} + + update sys_user_org set org_id = #{newOrgId} where user_id = #{userId} and org_id = #{oldOrgId} + + + update att_group_person_relation set group_id = #{newAttGroup},org_id = #{newOrgId} where user_id = #{userId} and group_id = #{oldAttGroup} + \ No newline at end of file diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/att/WechatPushMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/att/WechatPushMapper.xml index 2d5102b..e319f37 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/att/WechatPushMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/att/WechatPushMapper.xml @@ -8,8 +8,8 @@ values(#{userId},#{userName},#{phone},#{password},#{isPd},#{isFace},#{updateTime},#{isCadre}) - 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 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 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}