|
@@ -23,6 +23,8 @@ import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.task.IdentityLink;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -46,6 +48,8 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo> implements TBSopInfoService {
|
|
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(TBSopInfoServiceImpl.class);
|
|
|
+
|
|
|
@Resource
|
|
|
TBSopInfoMapper tbSopInfoMapper;
|
|
|
|
|
@@ -166,36 +170,38 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
for (Map<String, String> m : dynamicFieldList) {
|
|
|
for (Map.Entry<String, String> entry : m.entrySet()) {
|
|
|
switch (entry.getValue()) {
|
|
|
- case SystemConstant.TYPE:
|
|
|
- map.put(entry.getValue(), tfCustomFlow.getType());
|
|
|
- break;
|
|
|
- case SystemConstant.FLOW_DEPLOYMENT_ID_FIELD:
|
|
|
- map.put(entry.getValue(), tfCustomFlow.getFlowDeploymentId());
|
|
|
- break;
|
|
|
- case SystemConstant.VERSION:
|
|
|
- map.put(entry.getValue(), tfCustomFlow.getVersion());
|
|
|
- break;
|
|
|
- case SystemConstant.CODE:
|
|
|
- map.put(entry.getValue(), code);
|
|
|
- break;
|
|
|
- case SystemConstant.FLOW_ID:
|
|
|
- map.put(entry.getValue(), flowId);
|
|
|
- break;
|
|
|
- default:
|
|
|
- if (formFieldMap.containsKey(entry.getValue())) {
|
|
|
- map.put(entry.getValue(), formFieldMap.get(entry.getValue()));
|
|
|
- } else {
|
|
|
- map.put(entry.getValue(), null);
|
|
|
- }
|
|
|
- break;
|
|
|
+ case SystemConstant.TYPE:
|
|
|
+ map.put(entry.getValue(), tfCustomFlow.getType());
|
|
|
+ break;
|
|
|
+ case SystemConstant.FLOW_DEPLOYMENT_ID_FIELD:
|
|
|
+ map.put(entry.getValue(), tfCustomFlow.getFlowDeploymentId());
|
|
|
+ break;
|
|
|
+ case SystemConstant.VERSION:
|
|
|
+ map.put(entry.getValue(), tfCustomFlow.getVersion());
|
|
|
+ break;
|
|
|
+ case SystemConstant.CODE:
|
|
|
+ map.put(entry.getValue(), code);
|
|
|
+ break;
|
|
|
+ case SystemConstant.FLOW_ID:
|
|
|
+ map.put(entry.getValue(), flowId);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (formFieldMap.containsKey(entry.getValue())) {
|
|
|
+ map.put(entry.getValue(), formFieldMap.get(entry.getValue()));
|
|
|
+ } else {
|
|
|
+ map.put(entry.getValue(), null);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
|
stringJoinerFieldName.add(entry.getKey());
|
|
|
- stringJoinerFieldValue.add(Objects.nonNull(entry.getValue()) ? "'" + entry.getValue().toString() + "'" : null);
|
|
|
+ stringJoinerFieldValue.add(
|
|
|
+ Objects.nonNull(entry.getValue()) ? "'" + entry.getValue().toString() + "'" : null);
|
|
|
}
|
|
|
- tbSopInfoMapper.saveDynamicSop(tableName, stringJoinerFieldName.toString(), stringJoinerFieldValue.toString());
|
|
|
+ tbSopInfoMapper.saveDynamicSop(tableName, stringJoinerFieldName.toString(),
|
|
|
+ stringJoinerFieldValue.toString());
|
|
|
}
|
|
|
} else {//否则更新
|
|
|
if (!CollectionUtils.isEmpty(formFieldMap)) {
|
|
@@ -203,7 +209,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
for (Map.Entry<String, String> entry : formFieldMap.entrySet()) {
|
|
|
stringJoinerFieldValue.add(entry.getKey() + "='" + entry.getValue() + "'");
|
|
|
}
|
|
|
- tbSopInfoMapper.updateDynamicSop(tableName, tfCustomFlow.getFlowDeploymentId(), flowId, stringJoinerFieldValue.toString());
|
|
|
+ tbSopInfoMapper.updateDynamicSop(tableName, tfCustomFlow.getFlowDeploymentId(), flowId,
|
|
|
+ stringJoinerFieldValue.toString());
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -232,11 +239,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean sopPublish(SopPublishParam sopPublishParam) throws InterruptedException {
|
|
|
- Optional.ofNullable(sopPublishParam.getCrmNo()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
+ Optional.ofNullable(sopPublishParam.getCrmNo())
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
if (sopPublishParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
throw ExceptionResultEnum.PARAMS_ERROR.exception("sop发布只能为草稿");
|
|
|
}
|
|
|
- return tbSopInfoService.sopApplyOrPublish(sopPublishParam.getSopNo(), sopPublishParam.getCrmNo(), sopPublishParam.getFlowDeploymentId(), sopPublishParam.getApprove(), sopPublishParam.getFormProperties());
|
|
|
+ return tbSopInfoService.sopApplyOrPublish(sopPublishParam.getSopNo(), sopPublishParam.getCrmNo(),
|
|
|
+ sopPublishParam.getFlowDeploymentId(), sopPublishParam.getApprove(),
|
|
|
+ sopPublishParam.getFormProperties());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -248,11 +258,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean sopApply(SopApplyParam sopApplyParam) throws InterruptedException {
|
|
|
- Optional.ofNullable(sopApplyParam.getCrmNo()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
- if (sopApplyParam.getApprove() != FlowApprovePassEnum.START && sopApplyParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
+ Optional.ofNullable(sopApplyParam.getCrmNo())
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
+ if (sopApplyParam.getApprove() != FlowApprovePassEnum.START
|
|
|
+ && sopApplyParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
throw ExceptionResultEnum.PARAMS_ERROR.exception("sop申请只能为提交或草稿");
|
|
|
}
|
|
|
- return tbSopInfoService.sopApplyOrPublish(sopApplyParam.getSopNo(), sopApplyParam.getCrmNo(), sopApplyParam.getFlowDeploymentId(), sopApplyParam.getApprove(), sopApplyParam.getFormProperties());
|
|
|
+ return tbSopInfoService.sopApplyOrPublish(sopApplyParam.getSopNo(), sopApplyParam.getCrmNo(),
|
|
|
+ sopApplyParam.getFlowDeploymentId(), sopApplyParam.getApprove(), sopApplyParam.getFormProperties());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -264,12 +277,18 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean sopApprove(FlowApproveParam flowApproveParam) throws InterruptedException {
|
|
|
- Optional.ofNullable(flowApproveParam.getTaskId()).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_ID_IS_NULL.exception());
|
|
|
- if (flowApproveParam.getApprove() != FlowApprovePassEnum.PASS && flowApproveParam.getApprove() != FlowApprovePassEnum.REJECT && flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT && flowApproveParam.getApprove() != FlowApprovePassEnum.START) {
|
|
|
+ Optional.ofNullable(flowApproveParam.getTaskId())
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_ID_IS_NULL.exception());
|
|
|
+ if (flowApproveParam.getApprove() != FlowApprovePassEnum.PASS
|
|
|
+ && flowApproveParam.getApprove() != FlowApprovePassEnum.REJECT
|
|
|
+ && flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT
|
|
|
+ && flowApproveParam.getApprove() != FlowApprovePassEnum.START) {
|
|
|
throw ExceptionResultEnum.PARAMS_ERROR.exception("sop填报只能为通过或驳回或草稿或提交");
|
|
|
}
|
|
|
- Optional.ofNullable(flowApproveParam.getFormProperties()).orElseThrow(() -> ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception());
|
|
|
- if (flowApproveParam.getApprove() == FlowApprovePassEnum.REJECT && Objects.isNull(flowApproveParam.getSetup())) {
|
|
|
+ Optional.ofNullable(flowApproveParam.getFormProperties())
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception());
|
|
|
+ if (flowApproveParam.getApprove() == FlowApprovePassEnum.REJECT && Objects.isNull(
|
|
|
+ flowApproveParam.getSetup())) {
|
|
|
throw ExceptionResultEnum.FLOW_REJECT_SETUP_IS_NULL.exception();
|
|
|
}
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
@@ -277,28 +296,35 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
|
|
|
|
|
|
List<String> taskApproveUserList = activitiService.getTaskApprove(task);
|
|
|
- if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT && !CollectionUtils.isEmpty(taskApproveUserList) && !taskApproveUserList.contains(sysUser.getId().toString())) {
|
|
|
+ if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT && !CollectionUtils.isEmpty(taskApproveUserList)
|
|
|
+ && !taskApproveUserList.contains(sysUser.getId().toString())) {
|
|
|
throw ExceptionResultEnum.FLOW_SOP_DATA_NOT_ME.exception();
|
|
|
}
|
|
|
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda()
|
|
|
+ .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
|
|
|
Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
|
|
|
- if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
+ if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
+ && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("sop流程类型错误");
|
|
|
}
|
|
|
|
|
|
- TBSopInfo tbSopInfo = this.getOne(new QueryWrapper<TBSopInfo>().lambda().eq(TBSopInfo::getSopNo, tfCustomFlowEntity.getCode()));
|
|
|
+ TBSopInfo tbSopInfo = this.getOne(
|
|
|
+ new QueryWrapper<TBSopInfo>().lambda().eq(TBSopInfo::getSopNo, tfCustomFlowEntity.getCode()));
|
|
|
Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
|
|
|
- TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(new QueryWrapper<TBSopInfoDetail>().lambda().eq(TBSopInfoDetail::getSopInfoId, tbSopInfo.getId()));
|
|
|
+ TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(
|
|
|
+ new QueryWrapper<TBSopInfoDetail>().lambda().eq(TBSopInfoDetail::getSopInfoId, tbSopInfo.getId()));
|
|
|
Optional.ofNullable(tbSopInfoDetail).orElseThrow(() -> ExceptionResultEnum.SOP_DETAIL_INFO_NO_DATA.exception());
|
|
|
|
|
|
//更新表单信息
|
|
|
- FlowTaskResult flowTaskResult = JSONObject.parseObject(flowApproveParam.getFormProperties(), FlowTaskResult.class);
|
|
|
+ FlowTaskResult flowTaskResult = JSONObject.parseObject(flowApproveParam.getFormProperties(),
|
|
|
+ FlowTaskResult.class);
|
|
|
Long engineerUserId = null;
|
|
|
if (flowTaskResult.getSetup().intValue() == 1) {
|
|
|
Long regionUserId = null;
|
|
@@ -313,16 +339,20 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
} else {
|
|
|
engineerUserId = Long.parseLong(taskApproveUserList.get(0));
|
|
|
}
|
|
|
- if (flowApproveParam.getApprove() == FlowApprovePassEnum.PASS || flowApproveParam.getApprove() == FlowApprovePassEnum.START) {
|
|
|
- List<String> approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult, tbSopInfoDetail, Long.parseLong(task.getProcessInstanceId()));
|
|
|
+ if (flowApproveParam.getApprove() == FlowApprovePassEnum.PASS
|
|
|
+ || flowApproveParam.getApprove() == FlowApprovePassEnum.START) {
|
|
|
+ List<String> approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult,
|
|
|
+ tbSopInfoDetail, Long.parseLong(task.getProcessInstanceId()));
|
|
|
flowApproveParam.setApproveUserIds(approveUserIds);
|
|
|
}
|
|
|
|
|
|
if (flowTaskResult.getSetup().intValue() == 3) {//内审时要set全部值
|
|
|
FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
|
- FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(flowResult.getSetupMap().get(flowTaskResult.getTaskKey())), FlowTaskResult.class);
|
|
|
+ FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(
|
|
|
+ GsonUtil.toJson(flowResult.getSetupMap().get(flowTaskResult.getTaskKey())), FlowTaskResult.class);
|
|
|
List<FlowFormWidgetResult> flowFormWidgetResultList = currFlowTaskResult.getFormProperty();
|
|
|
- Map<String, FlowFormWidgetResult> flowTaskResultMap = flowTaskResult.getFormProperty().stream().collect(Collectors.toMap(FlowFormWidgetResult::getFormId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
+ Map<String, FlowFormWidgetResult> flowTaskResultMap = flowTaskResult.getFormProperty().stream().collect(
|
|
|
+ Collectors.toMap(FlowFormWidgetResult::getFormId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
if (flowTaskResultMap.containsKey(f.getFormId())) {
|
|
|
f.setValue(flowTaskResultMap.get(f.getFormId()).getValue());
|
|
@@ -332,7 +362,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
flowApproveParam.setFormProperties(JacksonUtil.parseJson(flowTaskResult));
|
|
|
}
|
|
|
|
|
|
- CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(),
|
|
|
+ tfCustomFlowEntity.getCrmNo());
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
|
|
Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
|
|
@@ -343,25 +374,16 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
}
|
|
|
TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
|
|
|
- tbSopInfo.setStatus(tfFlowApprove.getSetup().intValue() == 1 && tfFlowApprove.getStatus() == FlowStatusEnum.DRAFT ? SopStatusEnum.DRAFT : SopStatusEnum.START);
|
|
|
+ tbSopInfo.setStatus(
|
|
|
+ tfFlowApprove.getSetup().intValue() == 1 && tfFlowApprove.getStatus() == FlowStatusEnum.DRAFT ?
|
|
|
+ SopStatusEnum.DRAFT :
|
|
|
+ SopStatusEnum.START);
|
|
|
tbSopInfo.updateInfo(sysUser.getId());
|
|
|
tbSopInfoService.updateById(tbSopInfo);
|
|
|
|
|
|
- if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW && tfFlowApprove.getSetup().intValue() == 6) {//现场环境测试下一步"扫描准备",修改设备发货管理里的设备改为已签收
|
|
|
- List<TBDeviceDelivery> tbDeviceDeliveryList = tbDeviceDeliveryService.list(new QueryWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getCrmNo, tfCustomFlowEntity.getCrmNo()));
|
|
|
- if (!CollectionUtils.isEmpty(tbDeviceDeliveryList)) {
|
|
|
- for (TBDeviceDelivery t : tbDeviceDeliveryList) {
|
|
|
- t.setStatus(DeviceDeliveryStatusEnum.RECEIVE);
|
|
|
- t.setReceiveTime(System.currentTimeMillis());
|
|
|
- t.setReceiveUserId(sysUser.getId());
|
|
|
- t.updateInfo(sysUser.getId());
|
|
|
- }
|
|
|
- tbDeviceDeliveryService.updateBatchById(tbDeviceDeliveryList);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//如果下一步审批是大区经理内审并且区域协调人和大区经理为同一人时,后台自动审批
|
|
|
- tbSopInfoService.sopSystemApprove(tfCustomFlow, tfCustomFlowEntity, tfFlowApprove, tbSopInfoDetail, flowApproveParam.getCrmNo());
|
|
|
+ tbSopInfoService.sopSystemApprove(tfCustomFlow, tfCustomFlowEntity, tfFlowApprove, tbSopInfoDetail,
|
|
|
+ flowApproveParam.getCrmNo());
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -373,7 +395,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<Map> list(SopInfoListParam sopInfoListParam) {
|
|
|
- if (sopInfoListParam.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW && sopInfoListParam.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
+ if (sopInfoListParam.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
+ && sopInfoListParam.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("流程类型只能为教务处或研究生");
|
|
|
}
|
|
|
TFCustomFlow maxTfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, sopInfoListParam.getType());
|
|
@@ -394,7 +417,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
//筛选字段
|
|
|
if (!CollectionUtils.isEmpty(sopInfoListParam.getFormWidgetMetadataConditionList())) {
|
|
|
- LinkedMultiValueMap<String, FormWidgetMetadataParam> formWidgetMetadataParamLinkedMultiValueMap = new LinkedMultiValueMap<>(sopInfoListParam.getFormWidgetMetadataConditionList().size());
|
|
|
+ LinkedMultiValueMap<String, FormWidgetMetadataParam> formWidgetMetadataParamLinkedMultiValueMap = new LinkedMultiValueMap<>(
|
|
|
+ sopInfoListParam.getFormWidgetMetadataConditionList().size());
|
|
|
for (FormWidgetMetadataParam f : sopInfoListParam.getFormWidgetMetadataConditionList()) {
|
|
|
if (Objects.nonNull(f.getOperator())) {
|
|
|
//加入固定字段转换
|
|
@@ -403,10 +427,16 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
JSONArray jsonArray = JSONArray.parseArray(f.getFieldValue());
|
|
|
if (Objects.nonNull(jsonArray) && jsonArray.size() > 0) {
|
|
|
StringJoiner stringJoiner = new StringJoiner("").add("(");
|
|
|
- f.setOperator(f.getOperator() == FormWidgetMetadataOperator.EQ ? FormWidgetMetadataOperator.IN : FormWidgetMetadataOperator.NOT_IN);
|
|
|
+ f.setOperator(f.getOperator() == FormWidgetMetadataOperator.EQ ?
|
|
|
+ FormWidgetMetadataOperator.IN :
|
|
|
+ FormWidgetMetadataOperator.NOT_IN);
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
if (Objects.equals(jsonArray.getString(i), FlowStatusEnum.AUDITING.name())) {
|
|
|
- stringJoiner.add("'" + FlowStatusEnum.START.name() + "','" + FlowStatusEnum.DRAFT.name() + "','" + FlowStatusEnum.AUDITING.name() + "','" + FlowStatusEnum.REJECT.name() + "','" + FlowStatusEnum.CANCEL.name() + "',");
|
|
|
+ stringJoiner.add(
|
|
|
+ "'" + FlowStatusEnum.START.name() + "','" + FlowStatusEnum.DRAFT.name()
|
|
|
+ + "','" + FlowStatusEnum.AUDITING.name() + "','"
|
|
|
+ + FlowStatusEnum.REJECT.name() + "','"
|
|
|
+ + FlowStatusEnum.CANCEL.name() + "',");
|
|
|
} else if (Objects.equals(jsonArray.getString(i), FlowStatusEnum.FINISH.name())) {
|
|
|
stringJoiner.add("'" + FlowStatusEnum.FINISH.name() + "',");
|
|
|
}
|
|
@@ -429,15 +459,19 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
sopInfoListParam.setFormWidgetMetadataOperation(FormWidgetMetadataOperation.AND);
|
|
|
}
|
|
|
if (formWidgetMetadataParamList.size() > 1) {
|
|
|
- StringJoiner conditionJoin = new StringJoiner("").add(sopInfoListParam.getFormWidgetMetadataOperation().getCode()).add(" ( ");
|
|
|
+ StringJoiner conditionJoin = new StringJoiner("").add(
|
|
|
+ sopInfoListParam.getFormWidgetMetadataOperation().getCode()).add(" ( ");
|
|
|
for (int y = 0; y < formWidgetMetadataParamList.size(); y++) {
|
|
|
FormWidgetMetadataParam f = formWidgetMetadataParamList.get(y);
|
|
|
if (f.getOperator() == FormWidgetMetadataOperator.LIKE) {
|
|
|
- conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add("('%','").add(f.getFieldValue()).add("','%')");
|
|
|
- } else if (f.getOperator() == FormWidgetMetadataOperator.IN || f.getOperator() == FormWidgetMetadataOperator.NOT_IN) {
|
|
|
+ conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add("('%','")
|
|
|
+ .add(f.getFieldValue()).add("','%')");
|
|
|
+ } else if (f.getOperator() == FormWidgetMetadataOperator.IN
|
|
|
+ || f.getOperator() == FormWidgetMetadataOperator.NOT_IN) {
|
|
|
conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add(f.getFieldValue());
|
|
|
} else {
|
|
|
- conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add("'").add(f.getFieldValue()).add("'");
|
|
|
+ conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add("'")
|
|
|
+ .add(f.getFieldValue()).add("'");
|
|
|
}
|
|
|
if (y < formWidgetMetadataParamList.size() - 1) {
|
|
|
conditionJoin.add(FormWidgetMetadataOperation.OR.getCode());
|
|
@@ -448,17 +482,26 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
} else {
|
|
|
for (FormWidgetMetadataParam f : formWidgetMetadataParamList) {
|
|
|
if (f.getOperator() == FormWidgetMetadataOperator.LIKE) {
|
|
|
- stringJoinerCondition.add(sopInfoListParam.getFormWidgetMetadataOperation().getCode()).add(f.getFieldId()).add(f.getOperator().getCode()).add("('%','").add(f.getFieldValue()).add("','%')").add("\r\n");
|
|
|
- } else if (f.getOperator() == FormWidgetMetadataOperator.IN || f.getOperator() == FormWidgetMetadataOperator.NOT_IN) {
|
|
|
- stringJoinerCondition.add(sopInfoListParam.getFormWidgetMetadataOperation().getCode()).add(f.getFieldId()).add(f.getOperator().getCode()).add(f.getFieldValue()).add("\r\n");
|
|
|
+ stringJoinerCondition.add(sopInfoListParam.getFormWidgetMetadataOperation().getCode())
|
|
|
+ .add(f.getFieldId()).add(f.getOperator().getCode()).add("('%','")
|
|
|
+ .add(f.getFieldValue()).add("','%')").add("\r\n");
|
|
|
+ } else if (f.getOperator() == FormWidgetMetadataOperator.IN
|
|
|
+ || f.getOperator() == FormWidgetMetadataOperator.NOT_IN) {
|
|
|
+ stringJoinerCondition.add(sopInfoListParam.getFormWidgetMetadataOperation().getCode())
|
|
|
+ .add(f.getFieldId()).add(f.getOperator().getCode()).add(f.getFieldValue())
|
|
|
+ .add("\r\n");
|
|
|
} else {
|
|
|
- stringJoinerCondition.add(sopInfoListParam.getFormWidgetMetadataOperation().getCode()).add(f.getFieldId()).add(f.getOperator().getCode()).add("'").add(f.getFieldValue()).add("'").add("\r\n");
|
|
|
+ stringJoinerCondition.add(sopInfoListParam.getFormWidgetMetadataOperation().getCode())
|
|
|
+ .add(f.getFieldId()).add(f.getOperator().getCode()).add("'").add(f.getFieldValue())
|
|
|
+ .add("'").add("\r\n");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- fieldValue = !Objects.equals(stringJoinerCondition.toString().trim(), "") ? stringJoinerCondition.toString().trim() : null;
|
|
|
+ fieldValue = !Objects.equals(stringJoinerCondition.toString().trim(), "") ?
|
|
|
+ stringJoinerCondition.toString().trim() :
|
|
|
+ null;
|
|
|
|
|
|
//排序字段
|
|
|
if (!CollectionUtils.isEmpty(sopInfoListParam.getFormWidgetMetadataOrderList())) {
|
|
@@ -471,7 +514,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
|
- IPage<Map> list = this.baseMapper.list(new Page<>(sopInfoListParam.getPageNumber(), sopInfoListParam.getPageSize()), Objects.nonNull(sopInfoListParam.getType()) ? sopInfoListParam.getType().name() : null, sopInfoListParam.getServiceId(), tableName, fieldName, fieldValue, dpr, fieldOrder);
|
|
|
+ IPage<Map> list = this.baseMapper.list(
|
|
|
+ new Page<>(sopInfoListParam.getPageNumber(), sopInfoListParam.getPageSize()),
|
|
|
+ Objects.nonNull(sopInfoListParam.getType()) ? sopInfoListParam.getType().name() : null,
|
|
|
+ sopInfoListParam.getServiceId(), tableName, fieldName, fieldValue, dpr, fieldOrder);
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
for (Map m : list.getRecords()) {
|
|
|
String regionUserId = (String) m.get("region_user_id_1");
|
|
@@ -519,9 +565,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
String flowId = (String) m.get("flowId");
|
|
|
TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLog(Long.parseLong(flowId));
|
|
|
if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getPendApproveId())) {
|
|
|
- List<String> userList = Arrays.asList(tfFlowLog.getPendApproveId().split(SystemConstant.LIST_JOIN_SPLIT));
|
|
|
- List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
- List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName()).collect(Collectors.toList());
|
|
|
+ List<String> userList = Arrays.asList(
|
|
|
+ tfFlowLog.getPendApproveId().split(SystemConstant.LIST_JOIN_SPLIT));
|
|
|
+ List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(
|
|
|
+ userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
+ List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
m.put("pendApproveName", StringUtils.join(userName, SystemConstant.LIST_JOIN_SPLIT));
|
|
|
} else {
|
|
|
m.put("pendApproveName", "--");
|
|
@@ -579,12 +628,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void sopSystemApprove(TFCustomFlow tfCustomFlow, TFCustomFlowEntity tfCustomFlowEntity, TFFlowApprove tfFlowApprove, TBSopInfoDetail tbSopInfoDetail, String crmNo) throws InterruptedException {
|
|
|
+ public void sopSystemApprove(TFCustomFlow tfCustomFlow, TFCustomFlowEntity tfCustomFlowEntity,
|
|
|
+ TFFlowApprove tfFlowApprove, TBSopInfoDetail tbSopInfoDetail, String crmNo) throws InterruptedException {
|
|
|
//如果下一步审批是内审并且区域协调人和大区经理为同一人时,后台自动审批
|
|
|
if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END
|
|
|
&& tfFlowApprove.getStatus() == FlowStatusEnum.AUDITING && tfFlowApprove.getSetup().intValue() == 3
|
|
|
&& tbSopInfoDetail.getLeadId().longValue() == tbSopInfoDetail.getRegionUserId().longValue()) {
|
|
|
- Task taskNew = taskService.createTaskQuery().processInstanceId(String.valueOf(tfFlowApprove.getFlowId())).taskAssignee(String.valueOf(tbSopInfoDetail.getLeadId())).singleResult();
|
|
|
+ Task taskNew = taskService.createTaskQuery().processInstanceId(String.valueOf(tfFlowApprove.getFlowId()))
|
|
|
+ .taskAssignee(String.valueOf(tbSopInfoDetail.getLeadId())).singleResult();
|
|
|
Optional.ofNullable(taskNew).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
|
|
|
|
|
|
FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
@@ -615,7 +666,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- activitiService.taskApprove(new FlowApproveParam(Long.parseLong(taskNew.getId()), FlowApprovePassEnum.PASS, this.getNextApproveUserIds(tfCustomFlow.getType(), nextFlowTaskResult, tbSopInfoDetail, tfCustomFlowEntity.getFlowId()), crmNo, SystemConstant.SYSTEM_AUTO_APPROVE, JacksonUtil.parseJson(nextFlowTaskResult)));
|
|
|
+ activitiService.taskApprove(new FlowApproveParam(Long.parseLong(taskNew.getId()), FlowApprovePassEnum.PASS,
|
|
|
+ this.getNextApproveUserIds(tfCustomFlow.getType(), nextFlowTaskResult, tbSopInfoDetail,
|
|
|
+ tfCustomFlowEntity.getFlowId()), crmNo, SystemConstant.SYSTEM_AUTO_APPROVE,
|
|
|
+ JacksonUtil.parseJson(nextFlowTaskResult)));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -628,19 +682,22 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
* @param flowId
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> getNextApproveUserIds(TFCustomTypeEnum type, FlowTaskResult flowTaskResult, TBSopInfoDetail tbSopInfoDetail, Long flowId) {
|
|
|
+ public List<String> getNextApproveUserIds(TFCustomTypeEnum type, FlowTaskResult flowTaskResult,
|
|
|
+ TBSopInfoDetail tbSopInfoDetail, Long flowId) {
|
|
|
List<String> approveUserIds = null;
|
|
|
if (type == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop流程待审核人
|
|
|
if (flowTaskResult.getSetup().intValue() == 1) {
|
|
|
approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getRegionUserId()));
|
|
|
} else if (flowTaskResult.getSetup().intValue() == 2) {
|
|
|
- approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()), String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
+ approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
+ String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
} else if (flowTaskResult.getSetup().intValue() == 3) {
|
|
|
List<Task> taskList = taskService.createTaskQuery().processInstanceId(String.valueOf(flowId)).list();
|
|
|
if (!CollectionUtils.isEmpty(taskList) && taskList.size() == 1) {
|
|
|
approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()));
|
|
|
} else {
|
|
|
- approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()), String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
+ approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
+ String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
}
|
|
|
} else {
|
|
|
if (flowTaskResult.getSetup().intValue() >= 8 && tbSopInfoDetail.getAfterRegionToEnginess()) {
|
|
@@ -653,13 +710,15 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
if (flowTaskResult.getSetup().intValue() == 1) {
|
|
|
approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getRegionUserId()));
|
|
|
} else if (flowTaskResult.getSetup().intValue() == 2) {
|
|
|
- approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()), String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
+ approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
+ String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
} else if (flowTaskResult.getSetup().intValue() == 3) {
|
|
|
List<Task> taskList = taskService.createTaskQuery().processInstanceId(String.valueOf(flowId)).list();
|
|
|
if (!CollectionUtils.isEmpty(taskList) && taskList.size() == 1) {
|
|
|
approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()));
|
|
|
} else {
|
|
|
- approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()), String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
+ approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
+ String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
}
|
|
|
} else {
|
|
|
approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
@@ -680,11 +739,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
String assistantEngineerUserIds = null;
|
|
|
List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
|
|
|
for (FlowFormWidgetResult f : formProperty) {
|
|
|
- if (f.getFormId().contains(SystemConstant.REGION_USER_ID) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
|
|
|
+ if (f.getFormId().contains(SystemConstant.REGION_USER_ID) && Objects.nonNull(f.getValue()) && !f.getValue()
|
|
|
+ .contains("null")) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
regionUserId = Long.parseLong(value);
|
|
|
- } else if (f.getFormId().contains(SystemConstant.ASSISTANT_ENGINEER_USER_ID) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
|
|
|
+ } else if (f.getFormId().contains(SystemConstant.ASSISTANT_ENGINEER_USER_ID) && Objects.nonNull(
|
|
|
+ f.getValue()) && !f.getValue().contains("null")) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
StringJoiner stringJoiner = new StringJoiner(",");
|
|
@@ -692,12 +753,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
stringJoiner.add(jsonArray.getString(i));
|
|
|
}
|
|
|
assistantEngineerUserIds = stringJoiner.toString();
|
|
|
- } else if ((f.getFormId().contains(SystemConstant.ENGINEER_USER_ID) && Objects.nonNull(f.getValue())) && !f.getValue().contains("null")) {
|
|
|
+ } else if ((f.getFormId().contains(SystemConstant.ENGINEER_USER_ID) && Objects.nonNull(f.getValue()))
|
|
|
+ && !f.getValue().contains("null")) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
engineerUserId = Long.parseLong(value);
|
|
|
}
|
|
|
- if (Objects.nonNull(regionUserId) && Objects.nonNull(engineerUserId) && Objects.nonNull(assistantEngineerUserIds)) {
|
|
|
+ if (Objects.nonNull(regionUserId) && Objects.nonNull(engineerUserId) && Objects.nonNull(
|
|
|
+ assistantEngineerUserIds)) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -722,11 +785,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean sopApplyOrPublish(String sopNo, String crmNo, String flowDeploymentId, FlowApprovePassEnum approve, String formProperties) throws InterruptedException {
|
|
|
+ public Boolean sopApplyOrPublish(String sopNo, String crmNo, String flowDeploymentId, FlowApprovePassEnum approve,
|
|
|
+ String formProperties) throws InterruptedException {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
- Optional.ofNullable(crmProjectResult.getRegionManagerId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("该派单号[" + crmNo + "]未设置大区经理"));
|
|
|
+ Optional.ofNullable(crmProjectResult.getRegionManagerId())
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("该派单号[" + crmNo + "]未设置大区经理"));
|
|
|
|
|
|
TBService tbService = tbServiceService.getById(crmProjectResult.getServiceUnitId());
|
|
|
Optional.ofNullable(tbService).orElseThrow(() -> ExceptionResultEnum.SERVICE_NO_DATA.exception());
|
|
@@ -745,9 +810,11 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
if (approve == FlowApprovePassEnum.DRAFT) {
|
|
|
approveUserIds.add(String.valueOf(crmProjectResult.getRegionManagerId()));
|
|
|
} else if (approve == FlowApprovePassEnum.START) {
|
|
|
- Optional.ofNullable(formProperties).orElseThrow(() -> ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception());
|
|
|
+ Optional.ofNullable(formProperties)
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception());
|
|
|
|
|
|
- tfCustomFlow = tfCustomFlowService.getOne(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowDeploymentId));
|
|
|
+ tfCustomFlow = tfCustomFlowService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowDeploymentId));
|
|
|
Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
TFCustomFlow maxTfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, tfCustomFlow.getType());
|
|
|
Optional.ofNullable(maxTfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
@@ -755,7 +822,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
BeanUtils.copyProperties(maxTfCustomFlow, tfCustomFlow);
|
|
|
}
|
|
|
|
|
|
- if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
+ if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
+ && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("sop流程类型错误");
|
|
|
}
|
|
|
|
|
@@ -764,11 +832,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Long regionUserId = (Long) map.get(SystemConstant.REGION_USER_ID);
|
|
|
Long engineerUserId = (Long) map.get(SystemConstant.ENGINEER_USER_ID);
|
|
|
String assistantEngineerUserIds = (String) map.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
|
|
|
- tbSopInfoDetail = new TBSopInfoDetail(crmProjectResult.getRegionManagerId(), regionUserId, engineerUserId, assistantEngineerUserIds);
|
|
|
+ tbSopInfoDetail = new TBSopInfoDetail(crmProjectResult.getRegionManagerId(), regionUserId, engineerUserId,
|
|
|
+ assistantEngineerUserIds);
|
|
|
approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult, tbSopInfoDetail, null);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(flowDeploymentId, approve, approveUserIds, crmNo, formProperties));
|
|
|
+ Map<String, Object> map = activitiService.taskApprove(
|
|
|
+ new FlowApproveParam(flowDeploymentId, approve, approveUserIds, crmNo, formProperties));
|
|
|
if (approve != FlowApprovePassEnum.DRAFT) {
|
|
|
map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
map.put(SystemConstant.SOP_ID, null);
|
|
@@ -779,14 +849,18 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tfCustomFlow = Objects.isNull(tfCustomFlow) ? (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM) : tfCustomFlow;
|
|
|
TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
|
|
|
- TBSopInfo tbSopInfo = new TBSopInfo(crmNo, tfCustomFlowEntity.getCode(), crmProjectResult.getServiceUnitId(), crmProjectResult.getCustomId(), crmProjectResult.getProductId(), tfCustomFlow.getType(), SopStatusEnum.valueOf(approve.name()), sysUser.getId());
|
|
|
+ TBSopInfo tbSopInfo = new TBSopInfo(crmNo, tfCustomFlowEntity.getCode(), crmProjectResult.getServiceUnitId(),
|
|
|
+ crmProjectResult.getCustomId(), crmProjectResult.getProductId(), tfCustomFlow.getType(),
|
|
|
+ SopStatusEnum.valueOf(approve.name()), sysUser.getId());
|
|
|
if (Objects.isNull(tbSopInfoDetail)) {
|
|
|
tbSopInfoDetail = new TBSopInfoDetail(tbSopInfo.getId(), crmProjectResult.getRegionManagerId());
|
|
|
} else {
|
|
|
tbSopInfoDetail.setSopInfoId(tbSopInfo.getId());
|
|
|
}
|
|
|
tbSopInfoDetailService.save(tbSopInfoDetail);
|
|
|
- TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(new QueryWrapper<TBSopPlanDateLog>().lambda().eq(TBSopPlanDateLog::getFlowId, tfCustomFlowEntity.getFlowId()).orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
+ TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(new QueryWrapper<TBSopPlanDateLog>().lambda()
|
|
|
+ .eq(TBSopPlanDateLog::getFlowId, tfCustomFlowEntity.getFlowId())
|
|
|
+ .orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
if (Objects.nonNull(tbSopPlanDateLog)) {
|
|
|
tbSopPlanDateLog.setSopId(tbSopInfo.getId());
|
|
|
tbSopPlanDateLogService.updateById(tbSopPlanDateLog);
|
|
@@ -820,27 +894,34 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
|
|
|
|
|
|
Long sopId = (Long) map.get(SystemConstant.SOP_ID);
|
|
|
- List<Task> taskList = taskService.createTaskQuery().processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).list();
|
|
|
- if (!CollectionUtils.isEmpty(taskList) && (tfFlowApprove.getStatus() != FlowStatusEnum.DRAFT && tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END)) {
|
|
|
+ List<Task> taskList = taskService.createTaskQuery()
|
|
|
+ .processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).list();
|
|
|
+ if (!CollectionUtils.isEmpty(taskList) && (tfFlowApprove.getStatus() != FlowStatusEnum.DRAFT
|
|
|
+ && tfFlowApprove.getStatus() != FlowStatusEnum.FINISH
|
|
|
+ && tfFlowApprove.getStatus() != FlowStatusEnum.END)) {
|
|
|
Long processLimitedTime = null;
|
|
|
String execField = null;
|
|
|
if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop
|
|
|
if (tfFlowApprove.getSetup().intValue() == 2) {//项目关键信息
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey());
|
|
|
execField = ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey();
|
|
|
- tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId());
|
|
|
+ tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(),
|
|
|
+ sysUser.getId());
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 3) {//内审
|
|
|
processLimitedTime = tfFlowApprove.getUpdateTime();
|
|
|
execField = ProcessLimitedEnum.APPROVE_RADIO.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 5) {//扫描准备
|
|
|
tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 7) {//校验收尾
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 8) {//设备入库登记
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
@@ -850,11 +931,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
|
|
|
Long engineerUserId = null;
|
|
|
for (FlowFormWidgetResult f : formProperty) {
|
|
|
- if (f.getFormId().contains(SystemConstant.THIRD_SERVICE_REGION_CB) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
|
|
|
+ if (f.getFormId().contains(SystemConstant.THIRD_SERVICE_REGION_CB) && Objects.nonNull(
|
|
|
+ f.getValue()) && !f.getValue().contains("null")) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
if (Objects.nonNull(value) && Objects.nonNull(sopId) && value.equals("SCAN")) {
|
|
|
- TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(new QueryWrapper<TBSopInfoDetail>().lambda().eq(TBSopInfoDetail::getSopInfoId, sopId));
|
|
|
+ TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(
|
|
|
+ new QueryWrapper<TBSopInfoDetail>().lambda()
|
|
|
+ .eq(TBSopInfoDetail::getSopInfoId, sopId));
|
|
|
engineerUserId = tbSopInfoDetail.getEngineerUserId();
|
|
|
tbSopInfoDetail.setAfterRegionToEnginess(true);
|
|
|
tbSopInfoDetailService.updateById(tbSopInfoDetail);
|
|
@@ -866,12 +950,16 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
List<Map<String, Object>> sopPassageMap = this.findSopPassage(null);
|
|
|
if (!CollectionUtils.isEmpty(sopPassageMap)) {
|
|
|
for (Map m : sopPassageMap) {
|
|
|
- String engineerUserStr = Objects.nonNull(m) && Objects.nonNull(m.get("engineerUserIds")) ? m.get("engineerUserIds").toString() : null;
|
|
|
+ String engineerUserStr =
|
|
|
+ Objects.nonNull(m) && Objects.nonNull(m.get("engineerUserIds")) ?
|
|
|
+ m.get("engineerUserIds").toString() :
|
|
|
+ null;
|
|
|
if (Objects.nonNull(engineerUserStr)) {
|
|
|
String[] strs = engineerUserStr.split(",");
|
|
|
Set<String> set = new HashSet<>(Arrays.asList(strs));
|
|
|
if (!set.contains(engineerUserId)) {
|
|
|
- TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(engineerUserId);
|
|
|
+ TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(
|
|
|
+ engineerUserId);
|
|
|
if (Objects.nonNull(tbUserArchives)) {
|
|
|
tbUserArchives.setStatus(UserArchivesStatusEnum.FREE);
|
|
|
tbUserArchives.updateInfo(sysUser.getId());
|
|
@@ -884,50 +972,91 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
execField = ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 9) {//评卷准备
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 10) {//评卷收尾
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
}
|
|
|
} else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
|
if (tfFlowApprove.getSetup().intValue() == 2) {//项目关键信息
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey());
|
|
|
execField = ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey();
|
|
|
- tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId());
|
|
|
+ tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(),
|
|
|
+ sysUser.getId());
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 3) {//内审
|
|
|
processLimitedTime = tfFlowApprove.getUpdateTime();
|
|
|
execField = ProcessLimitedEnum.APPROVE_RADIO.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 5) {//现场环境测试/环境部署时间
|
|
|
tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.ENV_DEPLOYMENT_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.ENV_DEPLOYMENT_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.ENV_DEPLOYMENT_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 6) {//扫描准备
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
+
|
|
|
+ //现场环境测试后,设备发货管理里的设备通过序列号匹配更新为签收
|
|
|
+ FlowTaskResult flowTaskResultDeviceOut = this.getFormProperties(tfCustomFlowEntity, 4);
|
|
|
+ List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResultDeviceOut.getFormProperty();
|
|
|
+ List<String> deviceSerialNoList = new ArrayList<>();
|
|
|
+ for (FlowFormWidgetResult t : flowFormWidgetResultList) {
|
|
|
+ if (t.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE)) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(t.getValue());
|
|
|
+ JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ DeviceInOutForm deviceInOutForm = GsonUtil.fromJson(
|
|
|
+ GsonUtil.toJson(jsonArray.getJSONObject(i)), DeviceInOutForm.class);
|
|
|
+ deviceSerialNoList.add(deviceInOutForm.getSerialNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<TBDeviceDelivery> tbDeviceDeliveryList = tbDeviceDeliveryService.list(
|
|
|
+ new QueryWrapper<TBDeviceDelivery>().lambda()
|
|
|
+ .eq(TBDeviceDelivery::getCrmNo, tfCustomFlowEntity.getCrmNo())
|
|
|
+ .eq(TBDeviceDelivery::getEffect, true)
|
|
|
+ .in(TBDeviceDelivery::getSerialNo, deviceSerialNoList));
|
|
|
+ if (!CollectionUtils.isEmpty(tbDeviceDeliveryList)) {
|
|
|
+ for (TBDeviceDelivery t : tbDeviceDeliveryList) {
|
|
|
+ t.setStatus(DeviceDeliveryStatusEnum.RECEIVE);
|
|
|
+ t.setReceiveTime(System.currentTimeMillis());
|
|
|
+ t.setReceiveUserId(sysUser.getId());
|
|
|
+ t.updateInfo(sysUser.getId());
|
|
|
+ }
|
|
|
+ tbDeviceDeliveryService.updateBatchById(tbDeviceDeliveryList);
|
|
|
+ }
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 7) {//校验收尾
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 8) {//评卷准备
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 9) {//成绩复核
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 11) {//设备入库登记
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
execField = ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey();
|
|
|
}
|
|
|
}
|
|
@@ -936,14 +1065,32 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tsJobRemindService.updateJobRemind(Long.parseLong(task.getId()));
|
|
|
List<TSJobRemind> tsJobRemindList = new ArrayList<>();
|
|
|
if (Objects.nonNull(task.getAssignee())) {
|
|
|
- tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.BEFORE, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(), processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
- tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(), processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
+ tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
+ JobTypeEnum.BEFORE, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(),
|
|
|
+ processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
+ tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
+ JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(),
|
|
|
+ processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
} else {
|
|
|
List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
|
|
|
if (!CollectionUtils.isEmpty(identityLinkList)) {
|
|
|
for (IdentityLink i : identityLinkList) {
|
|
|
- tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(i.getTaskId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.BEFORE, Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
- tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(i.getTaskId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
+ tsJobRemindList.add(
|
|
|
+ new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(i.getTaskId()),
|
|
|
+ tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
+ JobTypeEnum.BEFORE, Long.parseLong(i.getUserId()),
|
|
|
+ tfFlowLog.getApproveOperation(), processLimitedTime, execField,
|
|
|
+ sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
+ tsJobRemindList.add(
|
|
|
+ new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(i.getTaskId()),
|
|
|
+ tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
+ JobTypeEnum.AFTER, Long.parseLong(i.getUserId()),
|
|
|
+ tfFlowLog.getApproveOperation(), processLimitedTime, execField,
|
|
|
+ sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -980,24 +1127,32 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
InOutTypeEnum type = null;
|
|
|
Long deviceInOutTime = null;
|
|
|
for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
- if (f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) || f.getFormId().contains(SystemConstant.DEVICE_IN_TIME)) {
|
|
|
+ if (f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) || f.getFormId()
|
|
|
+ .contains(SystemConstant.DEVICE_IN_TIME)) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
deviceInOutTime = Long.parseLong(value);
|
|
|
- type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) ? InOutTypeEnum.OUT : InOutTypeEnum.IN;
|
|
|
- } else if (f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) || f.getFormId().contains(SystemConstant.DEVICE_IN_TABLE)) {
|
|
|
+ type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) ?
|
|
|
+ InOutTypeEnum.OUT :
|
|
|
+ InOutTypeEnum.IN;
|
|
|
+ } else if (f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) || f.getFormId()
|
|
|
+ .contains(SystemConstant.DEVICE_IN_TABLE)) {
|
|
|
if (Objects.isNull(type)) {
|
|
|
- type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) ? InOutTypeEnum.OUT : InOutTypeEnum.IN;
|
|
|
+ type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) ?
|
|
|
+ InOutTypeEnum.OUT :
|
|
|
+ InOutTypeEnum.IN;
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- deviceInOutFormList.add(GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)), DeviceInOutForm.class));
|
|
|
+ deviceInOutFormList.add(
|
|
|
+ GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)), DeviceInOutForm.class));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- tbDeviceInOutService.deviceInOutSubmit(new DeviceInOutSubmitParam(crmProjectResult.getServiceUnitId(),
|
|
|
- tfCustomFlowEntity.getCrmNo(), tfCustomFlowEntity.getCode(), deviceInOutTime, type, true, deviceInOutFormList));
|
|
|
+ tbDeviceInOutService.deviceInOutSubmit(
|
|
|
+ new DeviceInOutSubmitParam(crmProjectResult.getServiceUnitId(), tfCustomFlowEntity.getCrmNo(),
|
|
|
+ tfCustomFlowEntity.getCode(), deviceInOutTime, type, true, deviceInOutFormList));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1013,10 +1168,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
TBSopInfo tbSopInfo = this.getById(id);
|
|
|
Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbSopInfo.getSopNo()));
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbSopInfo.getSopNo()));
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
- TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
|
|
|
+ .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
|
|
FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
@@ -1032,7 +1189,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
f.setWritable(false);
|
|
|
}
|
|
|
}
|
|
|
- if (tfFlowApprove.getSetup().intValue() != 0 && tfFlowApprove.getSetup().intValue() < entry.getValue().getSetup().intValue()) {
|
|
|
+ if (tfFlowApprove.getSetup().intValue() != 0 && tfFlowApprove.getSetup().intValue() < entry.getValue()
|
|
|
+ .getSetup().intValue()) {
|
|
|
break;
|
|
|
} else if (entry.getValue().getSetup().intValue() != tfFlowApprove.getSetup().intValue()) {
|
|
|
setupMapNew.put(entry.getKey(), entry.getValue());
|
|
@@ -1041,7 +1199,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
flowResultNew.setSetupMap(setupMapNew);
|
|
|
|
|
|
- CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(),
|
|
|
+ tfCustomFlowEntity.getCrmNo());
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
|
|
flowResultNew.setCrmInfo(crmProjectResult);
|
|
@@ -1060,15 +1219,17 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
TBSopInfo tbSopInfo = this.getById(sopSaveParam.getId());
|
|
|
Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbSopInfo.getSopNo()));
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbSopInfo.getSopNo()));
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
- TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
|
|
|
+ .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
|
|
-// if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH || tfFlowApprove.getStatus() == FlowStatusEnum.END) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("已结束的流程不允许修改");
|
|
|
-// }
|
|
|
+ // if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH || tfFlowApprove.getStatus() == FlowStatusEnum.END) {
|
|
|
+ // throw ExceptionResultEnum.ERROR.exception("已结束的流程不允许修改");
|
|
|
+ // }
|
|
|
|
|
|
TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
|
|
|
Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
@@ -1078,7 +1239,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
LinkedHashMap<String, FlowTaskResult> setupParamMap = flowResultParam.getSetupMap();
|
|
|
for (Map.Entry<String, FlowTaskResult> entry : setupParamMap.entrySet()) {
|
|
|
if (entry.getValue().getSetup() != 0) {//更新动态表单字段和处理时限
|
|
|
- tbSopInfoService.saveDynamicSop(tfCustomFlow, tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getFlowId(), entry.getValue());
|
|
|
+ tbSopInfoService.saveDynamicSop(tfCustomFlow, tfCustomFlowEntity.getCode(),
|
|
|
+ tfCustomFlowEntity.getFlowId(), entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
@@ -1093,10 +1255,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tfCustomFlowEntity.setFlowProcessVar(JacksonUtil.parseJson(flowResult));
|
|
|
if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(),
|
|
|
+ tfCustomFlowEntity.getCrmNo());
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
|
|
- TFFlowLog tfFlowLog = tfFlowLogService.getOne(new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, tfCustomFlowEntity.getFlowId()).last(" order by create_time limit 1 "));
|
|
|
+ TFFlowLog tfFlowLog = tfFlowLogService.getOne(
|
|
|
+ new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, tfCustomFlowEntity.getFlowId())
|
|
|
+ .last(" order by create_time limit 1 "));
|
|
|
Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
|
|
|
|
|
|
map.put(SystemConstant.FLOW_CUSTOM, tfCustomFlow);
|
|
@@ -1109,7 +1274,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- tbSopInfoService.saveSopPlanDate(flowTaskResult, tbSopInfo.getId(), tfCustomFlowEntity.getFlowId(), sysUser.getId());
|
|
|
+ tbSopInfoService.saveSopPlanDate(flowTaskResult, tbSopInfo.getId(), tfCustomFlowEntity.getFlowId(),
|
|
|
+ sysUser.getId());
|
|
|
}
|
|
|
return tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
|
|
|
}
|
|
@@ -1169,7 +1335,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
if (!fieldId.contains(ProcessLimitedEnum.SERVICE_FINISH_PLAN_BEGIN_DATE.getKey())) {
|
|
|
- Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(ProcessLimitedEnum.convertKeyToEnum(fieldId).getTitle() + "处理时限时间为空"));
|
|
|
+ Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(
|
|
|
+ ProcessLimitedEnum.convertKeyToEnum(fieldId).getTitle() + "处理时限时间为空"));
|
|
|
}
|
|
|
return processLimitedTime;
|
|
|
}
|
|
@@ -1185,12 +1352,17 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void saveSopPlanDate(FlowTaskResult flowTaskResult, Long sopId, Long flowId, Long userId) {
|
|
|
- Long serviceFinishPlanBeginDate = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SERVICE_FINISH_PLAN_BEGIN_DATE.getKey());
|
|
|
- Long serviceFinishPlanEndDate = this.getProcessLimitedTime(flowTaskResult, ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
+ Long serviceFinishPlanBeginDate = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SERVICE_FINISH_PLAN_BEGIN_DATE.getKey());
|
|
|
+ Long serviceFinishPlanEndDate = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
if (Objects.nonNull(serviceFinishPlanBeginDate)) {
|
|
|
- TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(new QueryWrapper<TBSopPlanDateLog>().lambda().eq(TBSopPlanDateLog::getFlowId, flowId).orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
+ TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(
|
|
|
+ new QueryWrapper<TBSopPlanDateLog>().lambda().eq(TBSopPlanDateLog::getFlowId, flowId)
|
|
|
+ .orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
if (Objects.isNull(tbSopPlanDateLog)) {
|
|
|
- tbSopPlanDateLog = new TBSopPlanDateLog(sopId, flowId, serviceFinishPlanBeginDate, serviceFinishPlanEndDate, userId);
|
|
|
+ tbSopPlanDateLog = new TBSopPlanDateLog(sopId, flowId, serviceFinishPlanBeginDate,
|
|
|
+ serviceFinishPlanEndDate, userId);
|
|
|
tbSopPlanDateLogService.save(tbSopPlanDateLog);
|
|
|
} else {
|
|
|
TBSopPlanDateLog tbSopPlanDateLogNew = new TBSopPlanDateLog();
|
|
@@ -1227,7 +1399,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return this.baseMapper.findFlowPassageByCrmNo(crmNo, sysUser.getId(), Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
|
|
|
+ return this.baseMapper.findFlowPassageByCrmNo(crmNo, sysUser.getId(),
|
|
|
+ Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1252,6 +1425,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return this.baseMapper.findFlowByServiceId(serviceId, userId, Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
|
|
|
+ return this.baseMapper.findFlowByServiceId(serviceId, userId,
|
|
|
+ Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
|
|
|
}
|
|
|
}
|