|
@@ -44,22 +44,26 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
|
|
|
@Autowired
|
|
|
private OaDocumentMapper oaDocumentMapper;
|
|
|
|
|
|
- // 我的申请-待处理、已处理、我发起、我收到-统计
|
|
|
+ // 我的申请-待处理、已处理、我发起、我收到-统计(暂时统计近一年数据)
|
|
|
@Override
|
|
|
public OaApprovalCountVO approvalCount() {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
String username = SecurityUtils.getUsername();
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ // 一年前时间
|
|
|
+ LocalDateTime oneYearAgo = now.minusYears(1);
|
|
|
+
|
|
|
OaApprovalCountVO oaApprovalCountVO = new OaApprovalCountVO();
|
|
|
// 待处理
|
|
|
- oaApprovalCountVO.setPendingSum(getPendingSum(tenantId, userId).size());
|
|
|
+ oaApprovalCountVO.setPendingSum(getPendingSum(tenantId, userId, oneYearAgo, now).size());
|
|
|
// 已处理
|
|
|
- oaApprovalCountVO.setAlreadySum(getAlreadySum(tenantId, userId).size());
|
|
|
+ oaApprovalCountVO.setAlreadySum(getAlreadySum(tenantId, userId, oneYearAgo, now).size());
|
|
|
// 我发起
|
|
|
- oaApprovalCountVO.setMyInitiated(getMyInitiated(tenantId, username).size());
|
|
|
+ oaApprovalCountVO.setMyInitiated(getMyInitiated(tenantId, username, oneYearAgo, now).size());
|
|
|
// 我收到
|
|
|
- oaApprovalCountVO.setMyReceived(getMyReceived(tenantId, userId).size());
|
|
|
+ oaApprovalCountVO.setMyReceived(getMyReceived(tenantId, userId, oneYearAgo, now).size());
|
|
|
|
|
|
return oaApprovalCountVO;
|
|
|
}
|
|
@@ -71,16 +75,11 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
|
IPage<OaApproval> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- // 一年前时间
|
|
|
- LocalDateTime oneYearAgo = now.minusYears(1);
|
|
|
-
|
|
|
List<Integer> processed = Stream.of(2, 3).collect(Collectors.toList());
|
|
|
|
|
|
LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(OaApproval::getTenantId, tenantId)
|
|
|
- .eq(OaApproval::getApprovalUid, userId)
|
|
|
- .between(OaApproval::getCreateTime, oneYearAgo, now);
|
|
|
+ .eq(OaApproval::getApprovalUid, userId).orderByDesc(OaApproval::getApprovalDate);
|
|
|
|
|
|
switch (queryType) {
|
|
|
case 1:
|
|
@@ -136,24 +135,26 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
|
|
|
}
|
|
|
|
|
|
// 待处理
|
|
|
- private List<OaApproval> getPendingSum(Integer tenantId, Long userId) {
|
|
|
+ private List<OaApproval> getPendingSum(Integer tenantId, Long userId, LocalDateTime oneYearAgo, LocalDateTime now) {
|
|
|
LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(OaApproval::getTenantId, tenantId)
|
|
|
.eq(OaApproval::getApprovalUid, userId)
|
|
|
- .eq(OaApproval::getApprovalStatus, 1);
|
|
|
+ .eq(OaApproval::getApprovalStatus, 1)
|
|
|
+ .between(OaApproval::getSubmitDate, oneYearAgo, now);
|
|
|
List<OaApproval> oaApprovals = oaApprovalMapper.selectList(queryWrapper);
|
|
|
return oaApprovals == null ? Collections.emptyList() : oaApprovals;
|
|
|
}
|
|
|
|
|
|
// 已处理
|
|
|
- private List<OaApproval> getAlreadySum(Integer tenantId, Long userId) {
|
|
|
+ private List<OaApproval> getAlreadySum(Integer tenantId, Long userId, LocalDateTime oneYearAgo, LocalDateTime now) {
|
|
|
LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(OaApproval::getTenantId, tenantId)
|
|
|
.eq(OaApproval::getApprovalUid, userId)
|
|
|
.and(wrapper -> wrapper
|
|
|
.eq(OaApproval::getApprovalStatus, 2)
|
|
|
.or()
|
|
|
- .eq(OaApproval::getApprovalStatus, 3));
|
|
|
+ .eq(OaApproval::getApprovalStatus, 3))
|
|
|
+ .between(OaApproval::getSubmitDate, oneYearAgo, now);
|
|
|
List<OaApproval> oaApprovals = oaApprovalMapper.selectList(queryWrapper);
|
|
|
return oaApprovals == null ? Collections.emptyList() : oaApprovals;
|
|
|
}
|
|
@@ -174,20 +175,23 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
|
|
|
}*/
|
|
|
|
|
|
// 我发起
|
|
|
- private List<OaDocument> getMyInitiated(Integer tenantId, String username) {
|
|
|
+ private List<OaDocument> getMyInitiated(Integer tenantId, String username, LocalDateTime oneYearAgo, LocalDateTime now) {
|
|
|
List<OaDocument> oaDocuments = oaDocumentMapper.selectList(new QueryWrapper<OaDocument>().lambda()
|
|
|
.select(OaDocument::getDocNo)
|
|
|
.eq(OaDocument::getTenantId, tenantId)
|
|
|
- .eq(OaDocument::getCreateBy, username));
|
|
|
+ .eq(OaDocument::getCreateBy, username)
|
|
|
+ .in(OaDocument::getDocStatus, 1, 2, 3)
|
|
|
+ .between(OaDocument::getCreateTime, oneYearAgo, now));
|
|
|
return oaDocuments == null ? Collections.emptyList() : oaDocuments;
|
|
|
}
|
|
|
|
|
|
// 我收到
|
|
|
- private List<OaApproval> getMyReceived(Integer tenantId, Long userId) {
|
|
|
+ private List<OaApproval> getMyReceived(Integer tenantId, Long userId, LocalDateTime oneYearAgo, LocalDateTime now) {
|
|
|
LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(OaApproval::getTenantId, tenantId)
|
|
|
.eq(OaApproval::getApprovalUid, userId)
|
|
|
- .eq(OaApproval::getType, 1);
|
|
|
+ .eq(OaApproval::getType, 1)
|
|
|
+ .between(OaApproval::getSubmitDate, oneYearAgo, now);
|
|
|
List<OaApproval> oaApprovals = oaApprovalMapper.selectList(queryWrapper);
|
|
|
return oaApprovals == null ? Collections.emptyList() : oaApprovals;
|
|
|
}
|