|
@@ -1,11 +1,21 @@
|
|
|
package com.qmth.sop.business.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.qmth.sop.business.bean.result.FlowFormWidgetResult;
|
|
|
+import com.qmth.sop.business.bean.result.FlowTaskResult;
|
|
|
import com.qmth.sop.business.entity.TBSopInfo;
|
|
|
+import com.qmth.sop.business.entity.TFCustomFlow;
|
|
|
import com.qmth.sop.business.mapper.TBSopInfoMapper;
|
|
|
import com.qmth.sop.business.service.TBSopInfoService;
|
|
|
+import com.qmth.sop.business.service.TFCustomFlowService;
|
|
|
+import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* sop表 服务实现类
|
|
@@ -17,6 +27,9 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo> implements TBSopInfoService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ TFCustomFlowService tfCustomFlowService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询动态sop表名是否存在
|
|
|
*
|
|
@@ -28,4 +41,44 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
public int selectSopDynamicExist(String db, String tableName) {
|
|
|
return this.baseMapper.selectSopDynamicExist(db, tableName);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存动态sop信息
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ * @param flowId
|
|
|
+ * @param flowTaskResult
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveDynamicSop(TFCustomTypeEnum type, Long flowId, FlowTaskResult flowTaskResult) {
|
|
|
+ TFCustomFlow tfCustomFlow = tfCustomFlowService.getOne(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getType, type));
|
|
|
+ Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
+
|
|
|
+ String tableName = type.getTableName() + "_" + tfCustomFlow.getVersion();
|
|
|
+ List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
|
|
|
+ List<Map<String, String>> fieldValue = new ArrayList<>(flowFormWidgetResultList.size());
|
|
|
+ for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
+ Map<String, String> map = new LinkedHashMap<>();
|
|
|
+ map.put(f.getFormId(), f.getValue());
|
|
|
+ fieldValue.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ //首先查询动态表里是否有当前表单的数据,没有插入,有则更新
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询动态sop数据
|
|
|
+ *
|
|
|
+ * @param tableName
|
|
|
+ * @param flowDeploymentId
|
|
|
+ * @param flowId
|
|
|
+ * @param fieldName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int selectDynamicSop(String tableName, String flowDeploymentId, Long flowId, String fieldName) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|