|
@@ -1,6 +1,7 @@
|
|
package com.qmth.sop.business.service.impl;
|
|
package com.qmth.sop.business.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -73,9 +74,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
@Resource
|
|
@Resource
|
|
private TBDingApplyService tbDingApplyService;
|
|
private TBDingApplyService tbDingApplyService;
|
|
|
|
|
|
- @Resource
|
|
|
|
- private TFFlowLogService tfFlowLogService;
|
|
|
|
-
|
|
|
|
@Resource
|
|
@Resource
|
|
private TBSopInfoService tbSopInfoService;
|
|
private TBSopInfoService tbSopInfoService;
|
|
|
|
|
|
@@ -88,6 +86,9 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
@Resource
|
|
@Resource
|
|
private TBDingStatisticService tbDingStatisticService;
|
|
private TBDingStatisticService tbDingStatisticService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private TBCrmDetailService tbCrmDetailService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public DingElementResult findDingElements(String sopNo, Long userId) {
|
|
public DingElementResult findDingElements(String sopNo, Long userId) {
|
|
|
|
|
|
@@ -299,7 +300,11 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
}
|
|
}
|
|
|
|
|
|
Long signTime = dingSaveParam.getSignTime();
|
|
Long signTime = dingSaveParam.getSignTime();
|
|
- SopPlanTimeResult sopPlan = tbSopInfoService.querySopPlanTime(sopNo);
|
|
|
|
|
|
+ TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(sopNo);
|
|
|
|
+ Long scanStartTime = tbCrmDetail.getScanStartTime();
|
|
|
|
+ Long scanEndTime = tbCrmDetail.getScanEndTime();
|
|
|
|
+ Long markPaperStartTime = tbCrmDetail.getMarkPaperStartTime();
|
|
|
|
+ Long markPaperEndTime = tbCrmDetail.getMarkPaperEndTime();
|
|
|
|
|
|
DingDateTypeEnum dateType = sysDingDateService.getDingDateType(DateDisposeUtils.timestampToLocalDate(signTime));
|
|
DingDateTypeEnum dateType = sysDingDateService.getDingDateType(DateDisposeUtils.timestampToLocalDate(signTime));
|
|
|
|
|
|
@@ -357,8 +362,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
List<TBDing> todayDingList = this.list(
|
|
List<TBDing> todayDingList = this.list(
|
|
new QueryWrapper<TBDing>().lambda().eq(TBDing::getUserId, userId).eq(TBDing::getSignYear, signYear).eq(TBDing::getSignDate, signDate));
|
|
new QueryWrapper<TBDing>().lambda().eq(TBDing::getUserId, userId).eq(TBDing::getSignYear, signYear).eq(TBDing::getSignDate, signDate));
|
|
// 该用户在其他sop的当天打卡记录
|
|
// 该用户在其他sop的当天打卡记录
|
|
- List<TBDing> otherSopDingList = todayDingList.stream().filter(e -> !e.getSopNo().equals(sopNo)).collect(
|
|
|
|
- Collectors.toList());
|
|
|
|
|
|
+ List<TBDing> otherSopDingList = todayDingList.stream().filter(e -> !e.getSopNo().equals(sopNo)).collect(Collectors.toList());
|
|
if (CollectionUtils.isNotEmpty(otherSopDingList)) {
|
|
if (CollectionUtils.isNotEmpty(otherSopDingList)) {
|
|
List<TBDing> unFinishDingList = otherSopDingList.stream()
|
|
List<TBDing> unFinishDingList = otherSopDingList.stream()
|
|
.filter(e -> !SystemConstant.longNotNull(e.getSignInTime()) || !SystemConstant.longNotNull(e.getSignOutTime())).collect(Collectors.toList());
|
|
.filter(e -> !SystemConstant.longNotNull(e.getSignInTime()) || !SystemConstant.longNotNull(e.getSignOutTime())).collect(Collectors.toList());
|
|
@@ -369,7 +373,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
// 新增打卡历史记录
|
|
// 新增打卡历史记录
|
|
TBDingHistory history = new TBDingHistory();
|
|
TBDingHistory history = new TBDingHistory();
|
|
history.setSopNo(sopNo);
|
|
history.setSopNo(sopNo);
|
|
@@ -390,7 +393,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
throw ExceptionResultEnum.ERROR.exception("人脸识别不通过!");
|
|
throw ExceptionResultEnum.ERROR.exception("人脸识别不通过!");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
List<TBDing> tbDingList = todayDingList.stream().filter(e -> e.getSopNo().equals(sopNo)).collect(Collectors.toList());
|
|
List<TBDing> tbDingList = todayDingList.stream().filter(e -> e.getSopNo().equals(sopNo)).collect(Collectors.toList());
|
|
if (CollectionUtils.isEmpty(tbDingList)) {
|
|
if (CollectionUtils.isEmpty(tbDingList)) {
|
|
// 没有这天的打卡记录 - 新增打卡记录
|
|
// 没有这天的打卡记录 - 新增打卡记录
|
|
@@ -449,8 +451,10 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
Long signOutTime = tbDing.getSignOutTime();
|
|
Long signOutTime = tbDing.getSignOutTime();
|
|
if (signInTime != null && signInTime > 0 && signOutTime != null && signOutTime > 0) {
|
|
if (signInTime != null && signInTime > 0 && signOutTime != null && signOutTime > 0) {
|
|
// 打卡异常 (两个打卡时间均不在时间点 -> 异常)
|
|
// 打卡异常 (两个打卡时间均不在时间点 -> 异常)
|
|
- boolean signInException = !(sopPlan.getBeginTime() <= signInTime && signInTime <= sopPlan.getEndTime());
|
|
|
|
- boolean signOutException = !(sopPlan.getBeginTime() <= signOutTime && signOutTime <= sopPlan.getEndTime());
|
|
|
|
|
|
+ boolean signInException = !((scanStartTime <= signInTime && signInTime <= scanEndTime) || (
|
|
|
|
+ markPaperStartTime <= signInTime && signInTime <= markPaperEndTime));
|
|
|
|
+ boolean signOutException = !((scanStartTime <= signOutTime && signOutTime <= scanEndTime) || (
|
|
|
|
+ markPaperStartTime <= signOutTime && signOutTime <= markPaperEndTime));
|
|
tbDing.setDingException(signInException && signOutException);
|
|
tbDing.setDingException(signInException && signOutException);
|
|
}
|
|
}
|
|
this.updateById(tbDing);
|
|
this.updateById(tbDing);
|
|
@@ -520,8 +524,18 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
}
|
|
}
|
|
supplierId = userSupplierId;
|
|
supplierId = userSupplierId;
|
|
}
|
|
}
|
|
- return this.baseMapper.attendanceQuery(iPage, serviceId, userName, startTime, endTime, supplierId, custom, sopNo, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(status) ? status.name() : null, dpr,
|
|
|
|
- abnormal);
|
|
|
|
|
|
+ IPage<TBDingAttendanceResult> page = this.baseMapper.attendanceQuery(iPage, serviceId, userName, startTime,
|
|
|
|
+ endTime, supplierId, custom, sopNo, Objects.nonNull(type) ? type.name() : null,
|
|
|
|
+ Objects.nonNull(status) ? status.name() : null, dpr, abnormal);
|
|
|
|
+ page.getRecords().forEach(e -> {
|
|
|
|
+ String sopRoleType = e.getSopRoleType();
|
|
|
|
+ if (SystemConstant.strNotNull(sopRoleType)) {
|
|
|
|
+ List<SopRoleTypeEnum> sopRoleTypeEnumList = JSONArray.parseArray(sopRoleType, SopRoleTypeEnum.class);
|
|
|
|
+ e.setRoleName(
|
|
|
|
+ sopRoleTypeEnumList.stream().map(SopRoleTypeEnum::getTitle).collect(Collectors.joining(",")));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return page;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -563,13 +577,11 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
Long updateTime = tfFlowApprove.getUpdateTime();
|
|
Long updateTime = tfFlowApprove.getUpdateTime();
|
|
Long currentTime = System.currentTimeMillis();
|
|
Long currentTime = System.currentTimeMillis();
|
|
|
|
|
|
- Long flowId = tfFlowApprove.getFlowId();
|
|
|
|
- TFFlowLog tfFlowLog = tfFlowLogService.getOne(
|
|
|
|
- new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, flowId).eq(TFFlowLog::getApproveRemark, "通过").eq(TFFlowLog::getApproveSetup, 1).orderByDesc(TFFlowLog::getId).last("limit 1"));
|
|
|
|
- if (Objects.isNull(tfFlowLog)) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未找到流程提交记录");
|
|
|
|
|
|
+ TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(sopNo);
|
|
|
|
+ if (Objects.isNull(tbCrmDetail)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到派单详情");
|
|
}
|
|
}
|
|
- Long createTime = tfFlowLog.getCreateTime();
|
|
|
|
|
|
+ Long createTime = tbCrmDetail.getPublishTime();
|
|
|
|
|
|
if (FlowStatusEnum.FINISH.equals(flowStatusEnum)) {
|
|
if (FlowStatusEnum.FINISH.equals(flowStatusEnum)) {
|
|
dateList = DateDisposeUtils.getDaysBetween(createTime, updateTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
dateList = DateDisposeUtils.getDaysBetween(createTime, updateTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
@@ -598,8 +610,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(dingGroupIds)) {
|
|
if (CollectionUtils.isNotEmpty(dingGroupIds)) {
|
|
List<SysDingObj> sysDingObjList = sysDingObjService.list(
|
|
List<SysDingObj> sysDingObjList = sysDingObjService.list(
|
|
- new QueryWrapper<SysDingObj>().lambda()
|
|
|
|
- .in(SysDingObj::getDingGroupId, dingGroupIds)
|
|
|
|
|
|
+ new QueryWrapper<SysDingObj>().lambda().in(SysDingObj::getDingGroupId, dingGroupIds)
|
|
.eq(SysDingObj::getSopRoleType, SopRoleTypeEnum.ENGINEER)
|
|
.eq(SysDingObj::getSopRoleType, SopRoleTypeEnum.ENGINEER)
|
|
.eq(SysDingObj::getType, DingObjTypeEnum.DING));
|
|
.eq(SysDingObj::getType, DingObjTypeEnum.DING));
|
|
|
|
|
|
@@ -713,7 +724,11 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
@Override
|
|
@Override
|
|
public void resetDingExceptionBySopNo(String sopNo) {
|
|
public void resetDingExceptionBySopNo(String sopNo) {
|
|
List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo));
|
|
List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo));
|
|
- SopPlanTimeResult sopPlan = tbSopInfoService.querySopPlanTime(sopNo);
|
|
|
|
|
|
+ TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(sopNo);
|
|
|
|
+ Long scanStartTime = tbCrmDetail.getScanStartTime();
|
|
|
|
+ Long scanEndTime = tbCrmDetail.getScanEndTime();
|
|
|
|
+ Long markPaperStartTime = tbCrmDetail.getMarkPaperStartTime();
|
|
|
|
+ Long markPaperEndTime = tbCrmDetail.getMarkPaperEndTime();
|
|
// 打卡异常
|
|
// 打卡异常
|
|
tbDingList.forEach(e -> {
|
|
tbDingList.forEach(e -> {
|
|
Long signInTime = e.getSignInTime();
|
|
Long signInTime = e.getSignInTime();
|
|
@@ -721,10 +736,11 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
boolean inDingException = false;
|
|
boolean inDingException = false;
|
|
boolean outDingException = false;
|
|
boolean outDingException = false;
|
|
if (signInTime != null && signInTime > 0) {
|
|
if (signInTime != null && signInTime > 0) {
|
|
- inDingException = !(sopPlan.getBeginTime() <= signInTime && signInTime <= sopPlan.getEndTime());
|
|
|
|
|
|
+ inDingException = !((scanStartTime <= signInTime && signInTime <= scanEndTime) || (markPaperStartTime <= signInTime && signInTime <= markPaperEndTime));
|
|
}
|
|
}
|
|
if (signOutTime != null && signOutTime > 0) {
|
|
if (signOutTime != null && signOutTime > 0) {
|
|
- outDingException = !(sopPlan.getBeginTime() <= signOutTime && signOutTime <= sopPlan.getEndTime());
|
|
|
|
|
|
+ outDingException = !((scanStartTime <= signOutTime && signOutTime <= scanEndTime) || (
|
|
|
|
+ markPaperStartTime <= signOutTime && signOutTime <= markPaperEndTime));
|
|
}
|
|
}
|
|
boolean dingException = inDingException && outDingException;
|
|
boolean dingException = inDingException && outDingException;
|
|
e.setDingException(dingException);
|
|
e.setDingException(dingException);
|