|
@@ -567,32 +567,27 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
DateFormDto result = new DateFormDto();
|
|
|
List<String> dateList = new ArrayList<>();
|
|
|
if (sopNo != null && sopNo.length() > 0) {
|
|
|
- List<TFFlowApprove> tfFlowApproves = this.baseMapper.findDateAndStatusBySopNo(sopNo);
|
|
|
- if (CollectionUtils.isNotEmpty(tfFlowApproves)) {
|
|
|
- if (tfFlowApproves.size() > 1) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("sop编号为[%s]的有多条流程审核记录", sopNo));
|
|
|
- }
|
|
|
- TFFlowApprove tfFlowApprove = tfFlowApproves.get(0);
|
|
|
- FlowStatusEnum flowStatusEnum = tfFlowApprove.getStatus();
|
|
|
- Long updateTime = tfFlowApprove.getUpdateTime();
|
|
|
- Long currentTime = System.currentTimeMillis();
|
|
|
-
|
|
|
- TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(sopNo);
|
|
|
- if (Objects.isNull(tbCrmDetail)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未找到派单详情");
|
|
|
- }
|
|
|
- Long createTime = tbCrmDetail.getPublishTime();
|
|
|
-
|
|
|
- if (FlowStatusEnum.FINISH.equals(flowStatusEnum)) {
|
|
|
- dateList = DateDisposeUtils.getDaysBetween(createTime, updateTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
|
- result.setSopIsEnd(true);
|
|
|
- } else {
|
|
|
- dateList = DateDisposeUtils.getDaysBetween(createTime, currentTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
|
- result.setSopIsEnd(false);
|
|
|
- }
|
|
|
- dateList.sort(Collections.reverseOrder());
|
|
|
- result.setDateFormList(dateList);
|
|
|
+ TFFlowApprove tfFlowApprove = this.findFlowApproveBySopNo(sopNo);
|
|
|
+ FlowStatusEnum flowStatusEnum = tfFlowApprove.getStatus();
|
|
|
+ Long updateTime = tfFlowApprove.getUpdateTime();
|
|
|
+ Long currentTime = System.currentTimeMillis();
|
|
|
+
|
|
|
+ TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(sopNo);
|
|
|
+ if (Objects.isNull(tbCrmDetail)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到派单详情");
|
|
|
+ }
|
|
|
+ Long createTime = tbCrmDetail.getPublishTime();
|
|
|
+
|
|
|
+ if (FlowStatusEnum.FINISH.equals(flowStatusEnum)) {
|
|
|
+ dateList = DateDisposeUtils.getDaysBetween(createTime, updateTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
|
+ result.setSopIsEnd(true);
|
|
|
+ } else {
|
|
|
+ dateList = DateDisposeUtils.getDaysBetween(createTime, currentTime, SystemConstant.DEFAULT_DATE_YMD_S_PATTERN);
|
|
|
+ result.setSopIsEnd(false);
|
|
|
}
|
|
|
+ dateList.sort(Collections.reverseOrder());
|
|
|
+ result.setDateFormList(dateList);
|
|
|
+
|
|
|
}
|
|
|
if (CollectionUtils.isNotEmpty(dateList)) {
|
|
|
result.setEndDate(dateList.get(0));
|
|
@@ -749,4 +744,16 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
|
|
|
// 重新统计该sop的考勤数据
|
|
|
tbDingStatisticService.buildDingStatistic(sopNo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TFFlowApprove findFlowApproveBySopNo(String sopNo) {
|
|
|
+ List<TFFlowApprove> tfFlowApproves = this.baseMapper.findDateAndStatusBySopNo(sopNo);
|
|
|
+ if (CollectionUtils.isEmpty(tfFlowApproves)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("sop编号为[%s]的流程审核记录不存在", sopNo));
|
|
|
+ }
|
|
|
+ if (tfFlowApproves.size() > 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("sop编号为[%s]的有多条流程审核记录", sopNo));
|
|
|
+ }
|
|
|
+ return tfFlowApproves.get(0);
|
|
|
+ }
|
|
|
}
|