|
@@ -386,6 +386,9 @@ public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchi
|
|
|
if (serviceUnitId == null || serviceUnitId == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("该派单还未绑定服务单元,不能发布");
|
|
|
}
|
|
|
+ if (!CrmStatusEnum.UN_PUBLISH.equals(tbCrm.getStatus())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("只有'未发布'状态的派单才能发布,该派单当前状态为[" + tbCrm.getStatus() + "]");
|
|
|
+ }
|
|
|
Long crmId = tbCrm.getId();
|
|
|
List<Long> crmIdList = new ArrayList<>();
|
|
|
crmIdList.add(crmId);
|
|
@@ -398,8 +401,16 @@ public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchi
|
|
|
UserArchivesAllocationResult crmSource = crmSourceList.get(0);
|
|
|
ProductTypeEnum productType = crmSource.getCustomType();
|
|
|
|
|
|
- // 发布校验
|
|
|
- // TODO: 2023/9/6 发布校验
|
|
|
+ // 发布校验(至少有一名区域协调人和一名实施工程师)
|
|
|
+ Integer coordinatorDistributed = crmSource.getCoordinatorDistributed();
|
|
|
+ if (coordinatorDistributed < 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("派单号为[%s]的派单发布失败,派单至少要有一个区域协调人", crmNo));
|
|
|
+ }
|
|
|
+ Integer effectDistributed = crmSource.getEffectDistributed();
|
|
|
+ if (effectDistributed < 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("派单号为[%s]的派单发布失败,派单至少要有一个实施工程师", crmNo));
|
|
|
+ }
|
|
|
+
|
|
|
List<TFCustomFlow> tfCustomFlowList = tfCustomFlowService.findFlowDeploymentList();
|
|
|
String flowDeploymentId = null;
|
|
|
switch (productType) {
|
|
@@ -436,11 +447,20 @@ public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchi
|
|
|
}
|
|
|
sopPublishParam.setFlowDeploymentId(flowDeploymentId);
|
|
|
tbSopInfoService.sopPublish(sopPublishParam);
|
|
|
+
|
|
|
+ // 更新tbCrm状态为发布
|
|
|
+ tbCrmService.updateCrmStatus(crmNo, CrmStatusEnum.PUBLISH);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void unPublishSop(String crmNo) {
|
|
|
- // TODO: 2023/8/21 crm流程撤销发布
|
|
|
+ TBCrm tbCrm = tbCrmService.findByCrmNo(crmNo);
|
|
|
+ if (!CrmStatusEnum.PUBLISH.equals(tbCrm.getStatus())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("只有'已发布'状态的派单才能撤回,该派单当前状态为[" + tbCrm.getStatus() + "]");
|
|
|
+ }
|
|
|
+ tbCrmService.updateCrmStatus(crmNo, CrmStatusEnum.UN_PUBLISH);
|
|
|
+ // TODO: 2023/9/8 流程作废
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|