|
|
|
@ -156,16 +156,66 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
|
|
|
|
|
final PageResult<InspectionsLogDO> inspectionsLogDOPageResult = inspectionsLogMapper.selectPage(pageReqVO); |
|
|
|
|
if (inspectionsLogDOPageResult.getList() != null && inspectionsLogDOPageResult.getList().size() > 0) { |
|
|
|
|
inspectionsLogDOPageResult.getList().forEach(item->{ |
|
|
|
|
item.setUserList(this.getInspectionsLogAppListVO(item.getId())); |
|
|
|
|
final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(item.getInspectionsId()); |
|
|
|
|
if (enterpriseInspectionsDO == null) { |
|
|
|
|
throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.setUserList(this.getInspectionsLogAppListVO2(item.getId())); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return inspectionsLogDOPageResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装
|
|
|
|
|
public List<InspectionsLogAppListVO> getInspectionsLogAppListVO2(Long insId) { |
|
|
|
|
List<InspectionsLogAppListVO> appListVO = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//取最新一条签到状态
|
|
|
|
|
LambdaQueryWrapper<InspectionsLogDO> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(InspectionsLogDO::getStatus, 1); |
|
|
|
|
wrapper.eq(InspectionsLogDO::getInspectionsId, insId); |
|
|
|
|
wrapper.orderByDesc(InspectionsLogDO::getCreateTime); |
|
|
|
|
final List<InspectionsLogDO> list = inspectionsLogMapper.selectList(wrapper); |
|
|
|
|
|
|
|
|
|
if (list != null) { |
|
|
|
|
final Long id = list.get(0).getId(); |
|
|
|
|
final List<SignInLogDO> signInLog = this.getSignInLog(id); |
|
|
|
|
if (signInLog != null && signInLog.size() > 0) { |
|
|
|
|
signInLog.forEach(signInLogDO->{ |
|
|
|
|
final AdminUserDO user = adminUserService.getUser(signInLogDO.getUserId()); |
|
|
|
|
if (user == null) { |
|
|
|
|
throw exception(USER_NOT_EXISTS); |
|
|
|
|
} |
|
|
|
|
InspectionsLogAppListVO appListVO1 = new InspectionsLogAppListVO(); |
|
|
|
|
appListVO1.setRealName(signInLogDO.getRealName()); |
|
|
|
|
appListVO1.setTime(signInLogDO.getCreateTime()); |
|
|
|
|
appListVO1.setUserId(signInLogDO.getUserId()); |
|
|
|
|
appListVO1.setIsInspect(signInLogDO.getIsInspect()); |
|
|
|
|
final DeptDO dept = deptService.getDept(user.getDeptId()); |
|
|
|
|
if (dept != null) { |
|
|
|
|
appListVO1.setDeptName(dept.getName()); |
|
|
|
|
} |
|
|
|
|
appListVO1.setAvtar(user.getAvatar()); |
|
|
|
|
appListVO.add(appListVO1); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return appListVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装
|
|
|
|
|
public List<InspectionsLogAppListVO> getInspectionsLogAppListVO(Long insId) { |
|
|
|
|
List<InspectionsLogAppListVO> appListVO = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//取最新一条签到状态
|
|
|
|
|
final List<SignInLogDO> signInLog = this.getSignInLog(insId); |
|
|
|
|
if (signInLog != null && signInLog.size() > 0) { |
|
|
|
|
signInLog.forEach(signInLogDO->{ |
|
|
|
@ -194,7 +244,19 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
|
|
|
|
|
public List<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO) { |
|
|
|
|
QueryWrapper<InspectionsLogDO> wrapper = new QueryWrapper<>(); |
|
|
|
|
wrapper.eq("inspections_id", pageReqVO.getInspectionsId()); |
|
|
|
|
return inspectionsLogMapper.selectList(wrapper); |
|
|
|
|
final List<InspectionsLogDO> list = inspectionsLogMapper.selectList(wrapper); |
|
|
|
|
if (list != null && list.size() > 0) { |
|
|
|
|
//把签到记录起来
|
|
|
|
|
List<InspectionsLogAppListVO> appListVO = new ArrayList<>(); |
|
|
|
|
list.forEach(item->{ |
|
|
|
|
if (item.getStatus() != null && item.getStatus() == 1) { |
|
|
|
|
final List<InspectionsLogAppListVO> inspectionsLogAppListVO2 = this.getInspectionsLogAppListVO2(item.getInspectionsId()); |
|
|
|
|
if (inspectionsLogAppListVO2 != null) {} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -298,9 +360,9 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
|
|
|
|
|
final InspectionsLogDO inspectionsLogDO = enterpriseInspectionsService.getInspectionsLogNew(inspectionsId); |
|
|
|
|
if (inspectionsLogDO != null) { |
|
|
|
|
//如果当前状态不是待确认打卡的状态报错
|
|
|
|
|
if (inspectionsLogDO.getStatus() != 0) { |
|
|
|
|
throw exception(SIGN_IN_LOG_ERROR3); |
|
|
|
|
} |
|
|
|
|
// if (inspectionsLogDO.getStatus() != 0) {
|
|
|
|
|
// throw exception(SIGN_IN_LOG_ERROR3);
|
|
|
|
|
// }
|
|
|
|
|
//根据记录查询
|
|
|
|
|
return this.getInspectionsLogAppListVO(inspectionsLogDO.getId()); |
|
|
|
|
} |
|
|
|
|