|
|
@@ -10,6 +10,7 @@ import com.yingpaipay.business.domain.*;
|
|
|
import com.yingpaipay.business.domain.bo.DocumentQcAuditBo;
|
|
|
import com.yingpaipay.business.domain.bo.DocumentQcTaskDetailListBo;
|
|
|
import com.yingpaipay.business.domain.bo.TaskCenterQcListBo;
|
|
|
+import com.yingpaipay.business.domain.bo.TaskCenterQcSubmitBo;
|
|
|
import com.yingpaipay.business.domain.vo.DocumentQcGenerateVo;
|
|
|
import com.yingpaipay.business.domain.vo.DocumentQcTaskDetailListVo;
|
|
|
import com.yingpaipay.business.domain.vo.TaskCenterQcListVo;
|
|
|
@@ -154,6 +155,7 @@ public class DocumentQcTaskDetailServiceImpl implements IDocumentQcTaskDetailSer
|
|
|
log.setTenantId(TenantHelper.getTenantId());
|
|
|
|
|
|
detail.setStatus(bo.getResult());
|
|
|
+ detail.setNote(bo.getOpinion());
|
|
|
detail.setExecutionTime(new Date());
|
|
|
|
|
|
if (DocumentQcStatusEnum.pass(bo.getResult())) {
|
|
|
@@ -229,6 +231,59 @@ public class DocumentQcTaskDetailServiceImpl implements IDocumentQcTaskDetailSer
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public boolean submit(TaskCenterQcSubmitBo bo) {
|
|
|
+
|
|
|
+ DocumentQcTaskDetail detail = baseMapper.selectById(bo.getDetailId());
|
|
|
+ DocumentQcTaskLog log = logMapper.selectOne(
|
|
|
+ Wrappers.lambdaQuery(DocumentQcTaskLog.class)
|
|
|
+ .eq(DocumentQcTaskLog::getDetailId, bo.getDetailId())
|
|
|
+ .orderByDesc(DocumentQcTaskLog::getId)
|
|
|
+ .last("LIMIT 1")
|
|
|
+ );
|
|
|
+ Document document = documentService.getById(detail.getDocumentId());
|
|
|
+
|
|
|
+ detail.setStatus(DocumentQcStatusEnum.TO_AUDIT.getCode());
|
|
|
+ log.setActualDealer(LoginHelper.getUserId());
|
|
|
+ log.setDealTime(new Date());
|
|
|
+ document.setStatus(DocumentStatusEnum.UN_QC.getValue());
|
|
|
+ document.setActualDocument(bo.getDocument());
|
|
|
+
|
|
|
+ boolean detailFlag = baseMapper.updateById(detail) == 0;
|
|
|
+ if (detailFlag) {
|
|
|
+ throw new RuntimeException("修改质控细节失败");
|
|
|
+ }
|
|
|
+ boolean logFlag = logMapper.updateById(log) == 0;
|
|
|
+ if (logFlag) {
|
|
|
+ throw new RuntimeException("修改质控记录失败");
|
|
|
+ }
|
|
|
+ boolean documentFlag = documentService.updateById(document);
|
|
|
+ if (!documentFlag) {
|
|
|
+ throw new RuntimeException("修改文档失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<DocumentQcTaskDetail> listOnWorkbench() {
|
|
|
+ List<Long> pendingIds = logMapper.selectList(
|
|
|
+ Wrappers.lambdaQuery(DocumentQcTaskLog.class)
|
|
|
+ .eq(DocumentQcTaskLog::getDesignatedDealer, LoginHelper.getUserId())
|
|
|
+ .isNull(DocumentQcTaskLog::getActualDealer)
|
|
|
+ ).stream().map(DocumentQcTaskLog::getDetailId).toList();
|
|
|
+
|
|
|
+ LambdaQueryWrapper<DocumentQcTaskDetail> wrapper = Wrappers.lambdaQuery(DocumentQcTaskDetail.class)
|
|
|
+ .in(!pendingIds.isEmpty(), DocumentQcTaskDetail::getId, pendingIds)
|
|
|
+ .or(w -> w
|
|
|
+ .eq(DocumentQcTaskDetail::getStatus, List.of(DocumentQcStatusEnum.UN_AUDIT.getCode(), DocumentQcStatusEnum.TO_AUDIT.getCode()))
|
|
|
+ .eq(DocumentQcTaskDetail::getExecutor, LoginHelper.getUserId())
|
|
|
+ );
|
|
|
+
|
|
|
+ return baseMapper.selectList(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
private LambdaQueryWrapper<DocumentQcTaskDetail> buildListOnTaskCenterWrapper(TaskCenterQcListBo bo, List<Long> taskIds, List<Long> projectIds) {
|
|
|
|
|
|
LambdaQueryWrapper<DocumentQcTaskDetail> wrapper = Wrappers.lambdaQuery(DocumentQcTaskDetail.class)
|
|
|
@@ -242,11 +297,29 @@ public class DocumentQcTaskDetailServiceImpl implements IDocumentQcTaskDetailSer
|
|
|
wrapper.in(StringUtils.isNotBlank(bo.getProjectName()), DocumentQcTaskDetail::getProjectId, projectIds.isEmpty() ? List.of(-1L) : projectIds);
|
|
|
|
|
|
if (StringUtils.isNotBlank(bo.getDocumentName())) {
|
|
|
- List<Long> documentIds = new ArrayList<>();
|
|
|
- documentService.selectByName(bo.getDocumentName(), projectIds).forEach(e -> documentIds.add(e.getId()));
|
|
|
+ List<Long> documentIds = documentService.selectByName(bo.getDocumentName(), projectIds).stream().map(Document::getId).toList();
|
|
|
wrapper.in(DocumentQcTaskDetail::getDocumentId, documentIds.isEmpty() ? List.of(-1L) : documentIds);
|
|
|
}
|
|
|
|
|
|
+ List<Long> logIds = logMapper.selectList(Wrappers.lambdaQuery(DocumentQcTaskLog.class).in(DocumentQcTaskLog::getTaskId, taskIds.isEmpty() ? List.of(-1L) : taskIds).eq(DocumentQcTaskLog::getDesignatedDealer, LoginHelper.getUserId()))
|
|
|
+ .stream().map(DocumentQcTaskLog::getDetailId).toList();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 1、质控执行人应该看到未审核的
|
|
|
+ * 2、指定处理人应该看到指控驳回的
|
|
|
+ */
|
|
|
+ wrapper
|
|
|
+ .and(bo.getStatus() == null || bo.getStatus().equals(DocumentQcStatusEnum.UN_AUDIT.getCode()), w -> w
|
|
|
+ .eq(DocumentQcTaskDetail::getExecutor, LoginHelper.getUserId())
|
|
|
+ .in(DocumentQcTaskDetail::getStatus, List.of(DocumentQcStatusEnum.UN_AUDIT.getCode(), DocumentQcStatusEnum.TO_AUDIT.getCode()))
|
|
|
+ )
|
|
|
+ // 使用 <code>.or().and(action)</code> 莫名奇妙 <code>OR</code> 会失效,最终结果会变成 <code>AND ((executor = 12 AND status = 0) AND (id IN (-1) AND status = 2))</code>
|
|
|
+ // 即使使用 <code>.and(w -> w.and().or().and())</code> 结果也是错误的
|
|
|
+ .or(bo.getStatus() == null || bo.getStatus().equals(DocumentQcStatusEnum.REJECT.getCode()), w -> w
|
|
|
+ .in(DocumentQcTaskDetail::getId, logIds.isEmpty() ? List.of(-1L) : logIds)
|
|
|
+ .eq(DocumentQcTaskDetail::getStatus, DocumentQcStatusEnum.REJECT.getCode())
|
|
|
+ );
|
|
|
+
|
|
|
return wrapper;
|
|
|
}
|
|
|
|