1.小程序数据同步人脸按需更新

2.月异常报表当日数据查询不到问题修改
This commit is contained in:
fl 2025-03-03 18:03:03 +08:00
parent b612034036
commit 8321f3cd1d
7 changed files with 42 additions and 30 deletions

View File

@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 考勤数据
* @author zys
@ -50,5 +52,6 @@ public class AttFaceBean {
private String examineOpinion;
private Date updateTime;
}

View File

@ -619,7 +619,7 @@ public class AttCalServiceImpl implements AttCalService {
// if(c.getName().equals("肖阳")){
// System.out.println("c.getAttCurrentTime() = " + c.getAttCurrentTime());
// }
System.out.println(c.getName());
// System.out.println(c.getName());
int attStatus = calculateStatus(
c.getAttType(),
c.getAttCurrentTime(),
@ -627,7 +627,7 @@ public class AttCalServiceImpl implements AttCalService {
"1".equals(c.getAttType()) ? lateMinute : leaveMinute,
"1".equals(c.getAttType()) ? absenteeismLateMinute : absenteeismLeaveMinute
);
System.out.println(1111);
// System.out.println(1111);
// 如打卡状态为正常检查是否有异常出入时间
if (attStatus == 1 && c.getAttStatus() != null && c.getAttStatus() == 8) {
attStatus = 8; // 异常
@ -644,7 +644,7 @@ public class AttCalServiceImpl implements AttCalService {
c.setAttCurrentTime(time);
c.setAttAddress(address);
}
System.out.println(2222);
// System.out.println(2222);
c.setAttStatus(attStatus);
});
}
@ -849,13 +849,13 @@ public class AttCalServiceImpl implements AttCalService {
c.getUserId());
//开始和结束的那天是否只请了半天
if (c.getLeaveStartDate().equals(v)) {
if (c.getLeaveStartInterval().equals("2")) {
if ("2".equals(c.getLeaveStartInterval())) {
attSourceDataDao.updateLeaveData(offWorkBean);
} else {
tf = true;
}
} else if (c.getLeaveEndDate().equals(v)) {
if (c.getLeaveEndInterval().equals("1")) {
if ("1".equals(c.getLeaveEndInterval())) {
attSourceDataDao.updateLeaveData(toWorkBean);
} else {
tf = true;

View File

@ -54,6 +54,21 @@ public class NewAttTask {
log.info("--------数据拉取(考勤)定时器完毕------");
}
/**
* 早上8点40需要单独执行一次
* 1.数据拉取考勤定时器
* 2.考勤数据应用步骤一考勤数据更新
*/
@Scheduled(cron = "0 40 8 * * ?")
@Async
public void getEightAttDataPullTask() {
log.info("--------数据拉取(考勤)定时器开启------");
String today = DateUtil.today();
getAttendanceData(today,1);
updateAttData(today,1);
log.info("--------数据拉取(考勤)定时器完毕------");
}
/**
* 单独子流程不在主流程中
* 旷工判断

View File

@ -55,7 +55,7 @@ public class WechatTasks {
/**
* 人员基础数据同步定时器
*/
@Scheduled(initialDelay = 60000, fixedDelay = 60000 * 10)
@Scheduled(initialDelay = 60000, fixedDelay = 60000 * 15)
@Async
public void pushPersonTask() {
log.info("--------人员基础数据同步定时器开启------");
@ -83,7 +83,7 @@ public class WechatTasks {
/**
* 休假出差数据同步定时器
*/
@Scheduled(initialDelay = 60000 * 6, fixedDelay = 60000 * 10)
@Scheduled(initialDelay = 60000 * 6, fixedDelay = 60000 * 15)
@Async
public void leaveTask() {
log.info("--------休假出差数据定时器开启------");
@ -168,7 +168,7 @@ public class WechatTasks {
/**
* 考勤数据同步定时器
*/
@Scheduled(initialDelay = 60000 * 12, fixedDelay = 60000 * 10)
@Scheduled(initialDelay = 60000 * 12, fixedDelay = 60000 * 15)
@Async
public void wechatAttTask() {
log.info("--------考勤数据定时器开启------");
@ -256,14 +256,21 @@ public class WechatTasks {
private void syncFaceToDatabase(List<AttFaceBean> faceList, List<AttFaceBean> wechatFaceList) {
Map<Long, AttFaceBean> wechatUserMap = faceList.stream()
.collect(Collectors.toMap(AttFaceBean::getUserId, user -> user, (existing, replacement) -> existing));
for (AttFaceBean user : wechatFaceList) {
Long userId = user.getUserId();
for (AttFaceBean wechatUser : wechatFaceList) {
Long userId = wechatUser.getUserId();
if (!wechatUserMap.containsKey(userId)) {
//第一次录入人脸
dao.insertWebFace(user);
dao.insertWebFace(wechatUser);
} else {
AttFaceBean user = wechatUserMap.get(userId);
//将未审核通过的数据更新到考勤库审核
dao.updateWebFace(user);
if (wechatUser.getUpdateTime().after(user.getUpdateTime())) {
String jsonStr2 = "{\"userId\":\"" + user.getUserId() + "\"}";
String method2 = "getWeChatFaceListByUserId";
String string2 = httpPost(method2, jsonStr2);
AttFaceBean wechatFace = FastJsonHelper.jsonStrToBean(string2, AttFaceBean.class);
dao.updateWebFace(wechatFace);
}
}
}
}

View File

@ -311,20 +311,6 @@ public class SysUserServiceImpl implements SysUserService
Long[] orgIdsByUserId = userMapper.getOrgIdsByUserId(userId);
//新组织
Long[] orgIds = user.getOrgIds();
//绑定考勤组组织
Long orgId = userMapper.getUserAttGroupByUserId(userId);
if (orgId == null || containsOrgId(orgIds,orgId)) {
//没有考勤组或新变换的组织包含考勤组组织不变
}else{
List<Long> uniqueInOrgIds = findUniqueInOrgIds(orgIds, orgIdsByUserId);
if(!uniqueInOrgIds.isEmpty()){
OrgChangeBean item = new OrgChangeBean();
item.setOldOrgId(orgId);
item.setNewOrgId(uniqueInOrgIds.get(0));
item.setUserId(userId);
userMapper.updateAttOrgByUserId(item);
}
}
userMapper.deleteUserOrgByUserId(userId);
insertUserOrg(user);
//处理人员组织变更休假/外出/等审批组织

View File

@ -207,7 +207,7 @@
<if test="attCurrent != null and attCurrent != ''"><!-- 结束时间检索 -->
and
(vat.att_current_day &gt;= CONCAT(#{attCurrent}, '-01') AND
vat.att_current_day &lt; LAST_DAY(CONCAT(#{attCurrent}, '-01')))
vat.att_current_day &lt;= LAST_DAY(CONCAT(#{attCurrent}, '-01')))
</if>
<if test="startDate != null and startDate != ''">
and vat.att_current_day between #{startDate} and #{endDate}

View File

@ -38,7 +38,7 @@
<insert id="pushAttDataToQsy">
<foreach collection="list" item="item" separator=";">
replace INTO gz_cloud_test.fc_sup_attendance (
replace INTO gz_cloud.fc_sup_attendance (
name,
id_number,
org_id,
@ -151,7 +151,8 @@
<select id="getWebFaceList" resultType="com.bonus.system.att.entity.AttFaceBean">
SELECT
*
user_id,
update_time
FROM
sys_user_face
</select>
@ -202,7 +203,7 @@
If(PROJECT_ID is null,0,PROJECT_ID) AS proId,
If(ORG_ID is null,0,ORG_ID) AS orgId
FROM
gz_cloud_test.bm_sup_attend_history
gz_cloud.bm_sup_attend_history
WHERE
ID_NUMBER = #{idNumber}
limit 1