|
@@ -65,6 +65,8 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
private SysUserService sysUserService;
|
|
|
@Resource
|
|
|
private SysDingObjService sysDingObjService;
|
|
|
+ @Resource
|
|
|
+ private TBDingApplyService tbDingApplyService;
|
|
|
|
|
|
@Override
|
|
|
public DingElementResult findDingElements(String sopNo, Long userId) {
|
|
@@ -108,6 +110,11 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
|
|
|
@Override
|
|
|
public DingStatisticResult findDingStatistic(String sopNo, Long userId) {
|
|
|
+ // 截取年分割截止
|
|
|
+ final int yearEnd = 4;
|
|
|
+ // 截取日分割开始
|
|
|
+ final int dayStart = 5;
|
|
|
+
|
|
|
// 根据sopNo查询日期表单
|
|
|
DateFormDto dateFormDto = this.buildSignDateFormBySop(sopNo);
|
|
|
List<String> dateFormList = dateFormDto.getDateFormList();
|
|
@@ -178,11 +185,19 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
|
|
|
String endDate = dateFormDto.getEndDate();
|
|
|
- endDate = endDate.substring(5);
|
|
|
+ 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));
|
|
|
|
|
|
for (String date : dateFormList) {
|
|
|
- String year = date.substring(0, 4);
|
|
|
- String signDate = date.substring(5);
|
|
|
+ String year = date.substring(0, yearEnd);
|
|
|
+ String signDate = date.substring(dayStart);
|
|
|
|
|
|
List<DingFormResult> dingFormResultList = formDingList.stream()
|
|
|
.filter(e -> signDate.equals(e.getSignDate()))
|
|
@@ -226,6 +241,29 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
dingFormResult.setSignOutInfo(out);
|
|
|
dingFormResult.setSignDate(signDate);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ // 当天补卡中的记录
|
|
|
+ List<TBDingApply> applyRecordList = resigningList.stream().filter(e -> {
|
|
|
+ Long applyTime = e.getApplyTime();
|
|
|
+ String applyTimeStr = DateFormatUtils.format(applyTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
|
+ String applyYear = applyTimeStr.substring(0, yearEnd);
|
|
|
+ String applyDay = applyTimeStr.substring(dayStart);
|
|
|
+ return year.equals(applyYear) && signDate.equals(applyDay);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 签到 补卡记录
|
|
|
+ List<TBDingApply> applyInRecord = applyRecordList.stream().filter(e -> InOutTypeEnum.IN.equals(e.getType())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(applyInRecord)) {
|
|
|
+ dingFormResult.getSignInInfo().setStatus(DingStatusEnum.RE_SIGN_ING);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 签退 补卡记录
|
|
|
+ List<TBDingApply> applyOutRecord = applyRecordList.stream().filter(e -> InOutTypeEnum.OUT.equals(e.getType())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(applyOutRecord)) {
|
|
|
+ dingFormResult.getSignOutInfo().setStatus(DingStatusEnum.RE_SIGN_ING);
|
|
|
+ }
|
|
|
+
|
|
|
dingFormResult.setYear(year);
|
|
|
formList.add(dingFormResult);
|
|
|
}
|
|
@@ -399,13 +437,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询列表
|
|
|
- *
|
|
|
- * @param iPage
|
|
|
- * @return
|
|
|
- */
|
|
|
-
|
|
|
@Override
|
|
|
public IPage<TBDingSubmitQueryResult> query(IPage<Map> iPage, Long serviceId, String status, Long createId, String userName, Long supplierId, String custom, String sopNo, Long days) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|