|
@@ -42,34 +42,49 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> implements TBDingService {
|
|
|
+
|
|
|
@Resource
|
|
|
private SysRoleService sysRoleService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBCrmService tbCrmService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBUserArchivesService tbUserArchivesService;
|
|
|
+
|
|
|
@Resource
|
|
|
private SysDingDateService sysDingDateService;
|
|
|
+
|
|
|
@Resource
|
|
|
private FileStoreUtil fileStoreUtil;
|
|
|
+
|
|
|
@Resource
|
|
|
private FaceApiUtils faceApiUtils;
|
|
|
+
|
|
|
@Resource
|
|
|
private SysConfigService sysConfigService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBDingHistoryService tbDingHistoryService;
|
|
|
+
|
|
|
@Resource
|
|
|
private SysUserService sysUserService;
|
|
|
+
|
|
|
@Resource
|
|
|
private SysDingObjService sysDingObjService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBDingApplyService tbDingApplyService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TFFlowLogService tfFlowLogService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBSopInfoService tbSopInfoService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBServiceService tbServiceService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TBUserArchivesAllocationService tbUserArchivesAllocationService;
|
|
|
|
|
@@ -87,11 +102,8 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
if (Objects.nonNull(dingElementResult)) {
|
|
|
Long userArchivesId = dingElementResult.getUserArchivesId();
|
|
|
String currentDayStr = DateFormatUtils.format(System.currentTimeMillis(), SystemConstant.DEFAULT_DATE_DAY_PATTERN);
|
|
|
- List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>()
|
|
|
- .lambda()
|
|
|
- .eq(TBDing::getSopNo, sopNo)
|
|
|
- .eq(TBDing::getUserArchivesId, userArchivesId)
|
|
|
- .eq(TBDing::getSignDate, currentDayStr));
|
|
|
+ List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo)
|
|
|
+ .eq(TBDing::getUserArchivesId, userArchivesId).eq(TBDing::getSignDate, currentDayStr));
|
|
|
if (CollectionUtils.isNotEmpty(tbDingList)) {
|
|
|
// 有考勤记录
|
|
|
if (tbDingList.size() > 1) {
|
|
@@ -124,16 +136,13 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
DateFormDto dateFormDto = this.buildSignDateFormBySop(sopNo);
|
|
|
List<String> dateFormList = dateFormDto.getDateFormList();
|
|
|
|
|
|
-
|
|
|
int workCount = 0;
|
|
|
int exceptionCount = 0;
|
|
|
List<DingFormResult> formList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(dateFormList)) {
|
|
|
|
|
|
- List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda()
|
|
|
- .eq(TBDing::getSopNo, sopNo)
|
|
|
- .eq(TBDing::getUserId, userId)
|
|
|
- .orderByAsc(TBDing::getId));
|
|
|
+ List<TBDing> tbDingList = this.list(
|
|
|
+ new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo).eq(TBDing::getUserId, userId).orderByAsc(TBDing::getId));
|
|
|
|
|
|
// 签到表
|
|
|
List<DingFormResult> formDingList = new ArrayList<>();
|
|
@@ -186,7 +195,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
DingFormResult formResult = new DingFormResult();
|
|
|
formResult.setDingId(tbDing.getId());
|
|
|
formResult.setSignDate(signDate);
|
|
|
- formResult.setYear(signYear.substring(0,yearEnd));
|
|
|
+ formResult.setYear(signYear.substring(0, yearEnd));
|
|
|
formResult.setSignInInfo(signInInfo);
|
|
|
formResult.setSignOutInfo(signOutInfo);
|
|
|
formDingList.add(formResult);
|
|
@@ -196,19 +205,16 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
endDate = endDate.substring(dayStart);
|
|
|
|
|
|
// 查询正在补卡中的记录
|
|
|
- List<TBDingApply> resigningList = tbDingApplyService.list(new QueryWrapper<TBDingApply>()
|
|
|
- .lambda()
|
|
|
- .select(TBDingApply::getType, TBDingApply::getApplyTime)
|
|
|
- .eq(TBDingApply::getSopNo, sopNo)
|
|
|
- .eq(TBDingApply::getCreateId, userId)
|
|
|
- .isNull(TBDingApply::getApprove));
|
|
|
+ List<TBDingApply> resigningList = tbDingApplyService.list(
|
|
|
+ new QueryWrapper<TBDingApply>().lambda().select(TBDingApply::getType, TBDingApply::getApplyTime).eq(TBDingApply::getSopNo, sopNo).eq(TBDingApply::getCreateId, userId)
|
|
|
+ .isNull(TBDingApply::getApprove));
|
|
|
|
|
|
for (String date : dateFormList) {
|
|
|
String year = date.substring(0, yearEnd);
|
|
|
String signDate = date.substring(dayStart);
|
|
|
|
|
|
List<DingFormResult> dingFormResultList = formDingList.stream()
|
|
|
- .filter(e -> year.equals(e.getYear().substring(0,yearEnd)) && signDate.equals(e.getSignDate()))
|
|
|
+ .filter(e -> year.equals(e.getYear().substring(0, yearEnd)) && signDate.equals(e.getSignDate()))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
DingFormResult dingFormResult = new DingFormResult();
|
|
@@ -229,8 +235,8 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
}
|
|
|
// 出勤天数增加
|
|
|
- if ((dingFormResult.getSignInInfo().getStatus().equals(DingStatusEnum.SIGN) && dingFormResult.getSignOutInfo().getStatus().equals(DingStatusEnum.SIGN)) ||
|
|
|
- (dingFormResult.getSignInInfo().getStatus().equals(DingStatusEnum.OTHER) && dingFormResult.getSignOutInfo().getStatus().equals(DingStatusEnum.OTHER))) {
|
|
|
+ if ((dingFormResult.getSignInInfo().getStatus().equals(DingStatusEnum.SIGN) && dingFormResult.getSignOutInfo().getStatus().equals(DingStatusEnum.SIGN)) || (
|
|
|
+ dingFormResult.getSignInInfo().getStatus().equals(DingStatusEnum.OTHER) && dingFormResult.getSignOutInfo().getStatus().equals(DingStatusEnum.OTHER))) {
|
|
|
workCount++;
|
|
|
}
|
|
|
} else {
|
|
@@ -251,7 +257,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
dingFormResult.setYear(year);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 当天补卡中的记录
|
|
|
List<TBDingApply> applyRecordList = resigningList.stream().filter(e -> {
|
|
|
Long applyTime = e.getApplyTime();
|
|
@@ -298,6 +303,10 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
|
|
|
Long signTime = dingSaveParam.getSignTime();
|
|
|
+ SopPlanTimeResult sopPlan = tbSopInfoService.querySopPlanTime(sopNo);
|
|
|
+ // 打卡异常
|
|
|
+ boolean dingException = !(sopPlan.getBeginTime() <= signTime && signTime <= sopPlan.getEndTime());
|
|
|
+
|
|
|
DingDateTypeEnum dateType = sysDingDateService.getDingDateType(DateDisposeUtils.timestampToLocalDate(signTime));
|
|
|
|
|
|
InOutTypeEnum signType = dingSaveParam.getSignType();
|
|
@@ -368,11 +377,8 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
throw ExceptionResultEnum.ERROR.exception("人脸识别不通过!");
|
|
|
}
|
|
|
|
|
|
- List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda()
|
|
|
- .eq(TBDing::getSopNo, sopNo)
|
|
|
- .eq(TBDing::getUserId, userId)
|
|
|
- .eq(TBDing::getSignYear, signYear)
|
|
|
- .eq(TBDing::getSignDate, signDate));
|
|
|
+ List<TBDing> tbDingList = this.list(
|
|
|
+ new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo).eq(TBDing::getUserId, userId).eq(TBDing::getSignYear, signYear).eq(TBDing::getSignDate, signDate));
|
|
|
|
|
|
if (CollectionUtils.isEmpty(tbDingList)) {
|
|
|
// 没有这天的打卡记录 - 新增打卡记录
|
|
@@ -388,21 +394,22 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
tbDing.setSignDate(signDate);
|
|
|
tbDing.setSignYear(signYear);
|
|
|
tbDing.setDateType(dateType);
|
|
|
+ tbDing.setDingException(dingException);
|
|
|
switch (signType) {
|
|
|
- case IN: // 签到打卡
|
|
|
- tbDing.setSignInTime(signTime);
|
|
|
- tbDing.setSignInAddress(signAddress);
|
|
|
- tbDing.setAxisInX(axisX);
|
|
|
- tbDing.setAxisInY(axisY);
|
|
|
- tbDing.setFaceInPass(facePass);
|
|
|
- break;
|
|
|
- case OUT: // 签退打卡
|
|
|
- tbDing.setSignOutTime(signTime);
|
|
|
- tbDing.setSignOutAddress(signAddress);
|
|
|
- tbDing.setAxisOutX(axisX);
|
|
|
- tbDing.setAxisOutY(axisY);
|
|
|
- tbDing.setFaceOutPass(facePass);
|
|
|
- break;
|
|
|
+ case IN: // 签到打卡
|
|
|
+ tbDing.setSignInTime(signTime);
|
|
|
+ tbDing.setSignInAddress(signAddress);
|
|
|
+ tbDing.setAxisInX(axisX);
|
|
|
+ tbDing.setAxisInY(axisY);
|
|
|
+ tbDing.setFaceInPass(facePass);
|
|
|
+ break;
|
|
|
+ case OUT: // 签退打卡
|
|
|
+ tbDing.setSignOutTime(signTime);
|
|
|
+ tbDing.setSignOutAddress(signAddress);
|
|
|
+ tbDing.setAxisOutX(axisX);
|
|
|
+ tbDing.setAxisOutY(axisY);
|
|
|
+ tbDing.setFaceOutPass(facePass);
|
|
|
+ break;
|
|
|
}
|
|
|
this.save(tbDing);
|
|
|
} else {
|
|
@@ -411,21 +418,22 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("用户id为[%s],sop单号为[%s],在[%s]的打卡记录异常", userId, sopNo, signDate));
|
|
|
}
|
|
|
TBDing tbDing = tbDingList.get(0);
|
|
|
+ tbDing.setDingException(tbDing.getDingException() && dingException);
|
|
|
switch (signType) {
|
|
|
- case IN: // 签到打卡
|
|
|
- tbDing.setSignInTime(signTime);
|
|
|
- tbDing.setSignInAddress(signAddress);
|
|
|
- tbDing.setAxisInX(axisX);
|
|
|
- tbDing.setAxisInY(axisY);
|
|
|
- tbDing.setFaceInPass(facePass);
|
|
|
- break;
|
|
|
- case OUT: // 签退打卡
|
|
|
- tbDing.setSignOutTime(signTime);
|
|
|
- tbDing.setSignOutAddress(signAddress);
|
|
|
- tbDing.setAxisOutX(axisX);
|
|
|
- tbDing.setAxisOutY(axisY);
|
|
|
- tbDing.setFaceOutPass(facePass);
|
|
|
- break;
|
|
|
+ case IN: // 签到打卡
|
|
|
+ tbDing.setSignInTime(signTime);
|
|
|
+ tbDing.setSignInAddress(signAddress);
|
|
|
+ tbDing.setAxisInX(axisX);
|
|
|
+ tbDing.setAxisInY(axisY);
|
|
|
+ tbDing.setFaceInPass(facePass);
|
|
|
+ break;
|
|
|
+ case OUT: // 签退打卡
|
|
|
+ tbDing.setSignOutTime(signTime);
|
|
|
+ tbDing.setSignOutAddress(signAddress);
|
|
|
+ tbDing.setAxisOutX(axisX);
|
|
|
+ tbDing.setAxisOutY(axisY);
|
|
|
+ tbDing.setFaceOutPass(facePass);
|
|
|
+ break;
|
|
|
}
|
|
|
this.updateById(tbDing);
|
|
|
}
|
|
@@ -456,7 +464,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
// 乙方PMO
|
|
|
Long userSupplierId = requestUser.getSupplierId();
|
|
|
if (userSupplierId == null || userSupplierId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商",RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商", RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
}
|
|
|
supplierId = userSupplierId;
|
|
|
}
|
|
@@ -464,7 +472,8 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TBDingCountResult count(Long serviceId,String status, Long createId, String userName, Long supplierId, String custom, String sopNo) {
|
|
|
+ public TBDingCountResult count(Long serviceId, String status, Long createId, String userName, Long supplierId,
|
|
|
+ String custom, String sopNo) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
Long userId = requestUser.getId();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(userId);
|
|
@@ -472,15 +481,16 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
// 乙方PMO
|
|
|
Long userSupplierId = requestUser.getSupplierId();
|
|
|
if (userSupplierId == null || userSupplierId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商",RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商", RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
}
|
|
|
supplierId = userSupplierId;
|
|
|
}
|
|
|
- return this.baseMapper.count(serviceId,status, createId, userName, supplierId, custom, sopNo, dpr);
|
|
|
+ return this.baseMapper.count(serviceId, status, createId, userName, supplierId, custom, sopNo, dpr);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<TBDingAttendanceResult> attendanceQuery(IPage<Map> iPage, Long serviceId, String userName, Long startTime, Long endTime, Long supplierId, String custom, String sopNo, InOutTypeEnum type, DingResultEnum status, Long abnormal) {
|
|
|
+ public IPage<TBDingAttendanceResult> attendanceQuery(IPage<Map> iPage, Long serviceId, String userName, Long startTime, Long endTime, Long supplierId, String custom, String sopNo, InOutTypeEnum type,
|
|
|
+ DingResultEnum status, Long abnormal) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
Long userId = requestUser.getId();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(userId);
|
|
@@ -488,15 +498,17 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
// 乙方PMO
|
|
|
Long userSupplierId = requestUser.getSupplierId();
|
|
|
if (userSupplierId == null || userSupplierId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商",RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商", RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
}
|
|
|
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);
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TBDingAttendanceCountResult attendanceCount(Long serviceId, String userName, Long startTime, Long endTime, Long supplierId, String custom, String sopNo) {
|
|
|
+ public TBDingAttendanceCountResult attendanceCount(Long serviceId, String userName, Long startTime, Long endTime,
|
|
|
+ Long supplierId, String custom, String sopNo) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
Long userId = requestUser.getId();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(userId);
|
|
@@ -504,7 +516,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
// 乙方PMO
|
|
|
Long userSupplierId = requestUser.getSupplierId();
|
|
|
if (userSupplierId == null || userSupplierId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商",RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商", RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
}
|
|
|
supplierId = userSupplierId;
|
|
|
}
|
|
@@ -512,8 +524,10 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<TBDingAttendanceResult> attendanceQuery(Long serviceId, String userName, Long startTime, Long endTime, Long supplierId, String custom, String sopNo, InOutTypeEnum type, DingResultEnum status, Long abnormal) {
|
|
|
- return this.baseMapper.attendanceQuery(serviceId, userName, startTime, endTime, supplierId, custom, sopNo, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(status) ? status.name() : null, abnormal);
|
|
|
+ public List<TBDingAttendanceResult> attendanceQuery(Long serviceId, String userName, Long startTime, Long endTime,
|
|
|
+ Long supplierId, String custom, String sopNo, InOutTypeEnum type, DingResultEnum status, Long abnormal) {
|
|
|
+ return this.baseMapper.attendanceQuery(serviceId, userName, startTime, endTime, supplierId, custom, sopNo,
|
|
|
+ Objects.nonNull(type) ? type.name() : null, Objects.nonNull(status) ? status.name() : null, abnormal);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -532,19 +546,14 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
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)
|
|
|
- .eq(TFFlowLog::getApproveOperation, FlowApproveOperationEnum.START)
|
|
|
- .orderByDesc(TFFlowLog::getId)
|
|
|
- .last("limit 1"));
|
|
|
+ TFFlowLog tfFlowLog = tfFlowLogService.getOne(
|
|
|
+ new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, flowId).eq(TFFlowLog::getApproveRemark, "通过").eq(TFFlowLog::getApproveSetup, 1)
|
|
|
+ .eq(TFFlowLog::getApproveOperation, FlowApproveOperationEnum.START).orderByDesc(TFFlowLog::getId).last("limit 1"));
|
|
|
if (Objects.isNull(tfFlowLog)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到流程提交记录");
|
|
|
}
|
|
|
Long createTime = tfFlowLog.getCreateTime();
|
|
|
|
|
|
-
|
|
|
if (FlowStatusEnum.FINISH.equals(flowStatusEnum)) {
|
|
|
dateList = DateDisposeUtils.getDaysBetween(createTime, updateTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
|
result.setSopIsEnd(true);
|
|
@@ -571,17 +580,12 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
List<DingElementResult> dingElementResultList = this.baseMapper.findDingResultByUserId(userId, serviceUnitId);
|
|
|
List<Long> dingGroupIds = dingElementResultList.stream().map(DingElementResult::getDingGroupId).distinct().collect(Collectors.toList());
|
|
|
if (CollectionUtils.isNotEmpty(dingGroupIds)) {
|
|
|
- List<SysDingObj> sysDingObjList = sysDingObjService.list(new QueryWrapper<SysDingObj>()
|
|
|
- .lambda()
|
|
|
- .in(SysDingObj::getDingGroupId, dingGroupIds)
|
|
|
- .in(SysDingObj::getRoleId, roleIdList)
|
|
|
- .eq(SysDingObj::getType, DingObjTypeEnum.DING));
|
|
|
+ List<SysDingObj> sysDingObjList = sysDingObjService.list(
|
|
|
+ new QueryWrapper<SysDingObj>().lambda().in(SysDingObj::getDingGroupId, dingGroupIds).in(SysDingObj::getRoleId, roleIdList).eq(SysDingObj::getType, DingObjTypeEnum.DING));
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(sysDingObjList) && sysDingObjList.size() == 1) {
|
|
|
- dingElementResultList = dingElementResultList
|
|
|
- .stream()
|
|
|
- .filter(e -> e.getDingGroupId()
|
|
|
- .equals(sysDingObjList.get(0).getDingGroupId()))
|
|
|
+ dingElementResultList = dingElementResultList.stream()
|
|
|
+ .filter(e -> e.getDingGroupId().equals(sysDingObjList.get(0).getDingGroupId()))
|
|
|
.collect(Collectors.toList());
|
|
|
if (dingElementResultList.size() == 1) {
|
|
|
return dingElementResultList.get(0);
|
|
@@ -608,40 +612,40 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
@Override
|
|
|
public void autoAddDingRecord(String signYear, String signDay) {
|
|
|
Long signTime = DateDisposeUtils.dateTime(SystemConstant.DEFAULT_DATE_YMD_S_PATTERN, signYear + signDay).getTime();
|
|
|
- List<TBService> tbServiceList = tbServiceService.list(new QueryWrapper<TBService>().lambda()
|
|
|
- .eq(TBService::getStatus, ServiceStatusEnum.PUBLISH));
|
|
|
+ List<TBService> tbServiceList = tbServiceService.list(
|
|
|
+ new QueryWrapper<TBService>().lambda().eq(TBService::getStatus, ServiceStatusEnum.PUBLISH));
|
|
|
|
|
|
Set<Long> needDingUserIdSet = new HashSet<>();
|
|
|
|
|
|
for (TBService tbService : tbServiceList) {
|
|
|
Long serviceUnitId = tbService.getId();
|
|
|
// TODO: 2024/5/21 系统自动生成打卡记录方法修改 -czx
|
|
|
-// List<Map<String, Object>> sopPassageMap = tbSopInfoService.findSopPassage(serviceUnitId);
|
|
|
-// if (CollectionUtils.isNotEmpty(sopPassageMap)) {
|
|
|
-// Map<String, Object> map = sopPassageMap.get(0);
|
|
|
-// if (Objects.nonNull(map)) {
|
|
|
-// String engineerUserIds = String.valueOf(map.get("engineerUserIds"));
|
|
|
-// String assistantEngineerUserIds = String.valueOf(map.get("assistantEngineerUserIds"));
|
|
|
-//
|
|
|
-// if (engineerUserIds != null && engineerUserIds.length() > 0 && !engineerUserIds.equals("null")) {
|
|
|
-// List<Long> engineerUserIdCell = Arrays.stream(engineerUserIds.split(","))
|
|
|
-// .map(Long::parseLong)
|
|
|
-// .filter(userId -> Objects.nonNull(this.findDingRule(userId, serviceUnitId)))
|
|
|
-// .distinct()
|
|
|
-// .collect(Collectors.toList());
|
|
|
-// needDingUserIdSet.addAll(engineerUserIdCell);
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (assistantEngineerUserIds != null && assistantEngineerUserIds.length() > 0 && !assistantEngineerUserIds.equals("null")) {
|
|
|
-// List<Long> assistantEngineerUserIdCell = Arrays.stream(assistantEngineerUserIds.split(","))
|
|
|
-// .map(Long::parseLong)
|
|
|
-// .filter(userId -> Objects.nonNull(this.findDingRule(userId, serviceUnitId)))
|
|
|
-// .distinct()
|
|
|
-// .collect(Collectors.toList());
|
|
|
-// needDingUserIdSet.addAll(assistantEngineerUserIdCell);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ // List<Map<String, Object>> sopPassageMap = tbSopInfoService.findSopPassage(serviceUnitId);
|
|
|
+ // if (CollectionUtils.isNotEmpty(sopPassageMap)) {
|
|
|
+ // Map<String, Object> map = sopPassageMap.get(0);
|
|
|
+ // if (Objects.nonNull(map)) {
|
|
|
+ // String engineerUserIds = String.valueOf(map.get("engineerUserIds"));
|
|
|
+ // String assistantEngineerUserIds = String.valueOf(map.get("assistantEngineerUserIds"));
|
|
|
+ //
|
|
|
+ // if (engineerUserIds != null && engineerUserIds.length() > 0 && !engineerUserIds.equals("null")) {
|
|
|
+ // List<Long> engineerUserIdCell = Arrays.stream(engineerUserIds.split(","))
|
|
|
+ // .map(Long::parseLong)
|
|
|
+ // .filter(userId -> Objects.nonNull(this.findDingRule(userId, serviceUnitId)))
|
|
|
+ // .distinct()
|
|
|
+ // .collect(Collectors.toList());
|
|
|
+ // needDingUserIdSet.addAll(engineerUserIdCell);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (assistantEngineerUserIds != null && assistantEngineerUserIds.length() > 0 && !assistantEngineerUserIds.equals("null")) {
|
|
|
+ // List<Long> assistantEngineerUserIdCell = Arrays.stream(assistantEngineerUserIds.split(","))
|
|
|
+ // .map(Long::parseLong)
|
|
|
+ // .filter(userId -> Objects.nonNull(this.findDingRule(userId, serviceUnitId)))
|
|
|
+ // .distinct()
|
|
|
+ // .collect(Collectors.toList());
|
|
|
+ // needDingUserIdSet.addAll(assistantEngineerUserIdCell);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
List<TBDing> willAddDingList = new ArrayList<>();
|
|
@@ -651,13 +655,9 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
String crmNo = tbCrm.getCrmNo();
|
|
|
List<String> sopNoList = tbSopInfoService.findFlowPassageByCrmNo(tbCrm.getCrmNo());
|
|
|
for (String sopNo : sopNoList) {
|
|
|
- TBDing tbDing = this.getOne(new QueryWrapper<TBDing>().lambda()
|
|
|
- .eq(TBDing::getSopNo, sopNo)
|
|
|
- .eq(TBDing::getCrmNo, crmNo)
|
|
|
- .eq(TBDing::getUserId, userId)
|
|
|
- .eq(TBDing::getSignYear, signYear)
|
|
|
- .eq(TBDing::getSignDate, signDay)
|
|
|
- .last("limit 1"));
|
|
|
+ TBDing tbDing = this.getOne(
|
|
|
+ new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo).eq(TBDing::getCrmNo, crmNo).eq(TBDing::getUserId, userId).eq(TBDing::getSignYear, signYear)
|
|
|
+ .eq(TBDing::getSignDate, signDay).last("limit 1"));
|
|
|
|
|
|
if (Objects.isNull(tbDing)) {
|
|
|
SopCrmInfo sopCrmInfo = tbCrmService.findSopCrmInfoBySop(sopNo);
|
|
@@ -681,4 +681,33 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
this.saveBatch(willAddDingList);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean checkDingExceptionBySopNo(String sopNo) {
|
|
|
+ return this.count(
|
|
|
+ new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo).eq(TBDing::getDingException, true)) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void resetDingExceptionBySopNo(String sopNo) {
|
|
|
+ List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo));
|
|
|
+ SopPlanTimeResult sopPlan = tbSopInfoService.querySopPlanTime(sopNo);
|
|
|
+ // 打卡异常
|
|
|
+ tbDingList.forEach(e -> {
|
|
|
+ Long signInTime = e.getSignInTime();
|
|
|
+ Long signOutTime = e.getSignOutTime();
|
|
|
+ boolean inDingException = false;
|
|
|
+ boolean outDingException = false;
|
|
|
+ if (signInTime != null && signInTime > 0) {
|
|
|
+ inDingException = !(sopPlan.getBeginTime() <= signInTime && signInTime <= sopPlan.getEndTime());
|
|
|
+ }
|
|
|
+ if (signOutTime != null && signOutTime > 0) {
|
|
|
+ outDingException = !(sopPlan.getBeginTime() <= signOutTime && signOutTime <= sopPlan.getEndTime());
|
|
|
+ }
|
|
|
+ boolean dingException = inDingException && outDingException;
|
|
|
+ e.setDingException(dingException);
|
|
|
+ });
|
|
|
+ this.updateBatchById(tbDingList);
|
|
|
+ }
|
|
|
}
|