diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java index 80374b5..cbc0a34 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java @@ -4,10 +4,9 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; -import com.biutag.enums.RoleEnum; -import com.biutag.lan.domain.*; -import com.biutag.lan.enums.WorkType; -import com.biutag.lan.flow.FlowNodeEnum; +import com.biutag.lan.domain.Mail; +import com.biutag.lan.domain.MailCoHandling; +import com.biutag.lan.domain.MailCountersign; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailFlowService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailFlowService.java index 3f73821..f24c74b 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailFlowService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailFlowService.java @@ -7,36 +7,24 @@ import com.biutag.lan.mapper.MailFlowMapper; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import java.time.LocalDateTime; import java.util.List; @RequiredArgsConstructor @Service public class MailFlowService extends ServiceImpl { - private final MailSourceService mailSourceService; - public List list(String mailId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(MailFlow::getMailId, mailId).orderByAsc(MailFlow::getCreateTime); return list(queryWrapper); } - public List list(String mailId, String flowKey) { + public List list(String mailId, List flowKeys) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(MailFlow::getMailId, mailId) - .eq(MailFlow::getFlowKey, flowKey) + .eq(MailFlow::getFlowKey, flowKeys) .orderByAsc(MailFlow::getCreateTime); return list(queryWrapper); } - public LocalDateTime getMailLastHandlerTime(String mailId) { - List list = list(mailId); - if (list.isEmpty()) { - return mailSourceService.getById(mailId).getCreateTime(); - } - return list.get(list.size() - 1).getCreateTime(); - } - - public List listOrderByCreateTimeDesc(String mailId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(MailFlow::getMailId, mailId).orderByDesc(MailFlow::getCreateTime); return list(queryWrapper); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java index d35f99e..6c21b04 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java @@ -215,7 +215,8 @@ public class MailService extends ServiceImpl { // flowConfig.getActions().stream().filter(item -> flowAction.getNextActionKey().equals(item.getKey())).findFirst().ifPresent(item -> { LocalDateTime now = LocalDateTime.now(); - LocalDateTime lastHandlerTime = mailFlowService.getMailLastHandlerTime(flowAction.getMailId()); + List list = mailFlowService.list(flowAction.getMailId()); + LocalDateTime lastHandlerTime = list.isEmpty() ? mailSourceService.getById(flowAction.getMailId()).getCreateTime() : list.get(list.size() - 1).getCreateTime(); long consumingTime = DateUtil.between(Date.from(lastHandlerTime.atZone(ZoneId.systemDefault()).toInstant()), new Date(), DateUnit.SECOND); // 保存当前流程数据 MailFlow mailFlow = new MailFlow() diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java index 0973be1..c134ae0 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java @@ -53,7 +53,6 @@ public class WorkService extends ServiceImpl { private final MailLabelMapper mailLabelMapper; - private final MailAppealMapper mailAppealMapper; @@ -76,6 +75,8 @@ public class WorkService extends ServiceImpl { private final NoticeService noticeService; + private final MailFlowService mailFlowService; + public boolean saveBatch(List mailSources) { LocalDateTime now = LocalDateTime.now(); @@ -710,6 +711,8 @@ public class WorkService extends ServiceImpl { .collect(Collectors.toList()).get(0).getName())); ledgerExcel.setMailTime(m.getMailTime()); ledgerExcel.setCreateTime(m.getCreateTime()); + // 办结时间 + ledgerExcel.setCompletionTime(q.getCompletionTime()); ledgerExcel.setContactName(nullToEmpty(q.getContactName())); ledgerExcel.setContactPhone(nullToEmpty(q.getContactPhone())); ledgerExcel.setSecondDeptName(nullToEmpty(m.getSecondDeptName())); @@ -720,12 +723,20 @@ public class WorkService extends ServiceImpl { FlowNodeEnum flowNodeEnum = FlowNodeEnum.get(m.getFlowKey()); if (Objects.nonNull(flowNodeEnum)) { if (flowNodeEnum.getIndex() > FlowNodeEnum.SECOND_DISTRIBUTE.getIndex()) { - // 是否5分钟内签收 (二级机构专班) TODO - //ledgerExcel.setSecondSignFlag(); + // 是否5分钟内签收 (二级机构专班) + String secondSignFlag = mailFlowService.list(m.getId(), Arrays.asList(FlowNodeEnum.SECOND_SIGN.getKey(), FlowNodeEnum.SECOND_DISTRIBUTE.getKey())) + .stream() + .limit(2) + .mapToLong(MailFlow::getConsumingTime).sum() > 300 ? AppConstants.NO : AppConstants.YES; + ledgerExcel.setSecondSignFlag(secondSignFlag); } if (flowNodeEnum.getIndex() > FlowNodeEnum.SECOND_DISTRIBUTE.getIndex()) { - // 是否5分钟内签收(三级机构专班) TODO - //ledgerExcel.setThreeSignFlag(); + String threeSignFlag = mailFlowService.list(m.getId(), Collections.singletonList(FlowNodeEnum.THREE_SIGN.getKey())) + .stream() + .limit(2) + .mapToLong(MailFlow::getConsumingTime).sum() > 300 ? AppConstants.NO : AppConstants.YES; + // 是否5分钟内签收(三级机构专班) + ledgerExcel.setThreeSignFlag(threeSignFlag); } } @@ -752,7 +763,6 @@ public class WorkService extends ServiceImpl { String appealResult = appealList.stream().anyMatch(item -> item.getMailId().equals(q.getId()) && item.getAppealState().equals("2")) ? "成功" : "失败"; ledgerExcel.setAppealResult(appealResult); } - ledgerExcel.setIsQualify(nullToEmpty(m.getQualifiedProcessingStatus())); list.add(ledgerExcel); }