|
@@ -11,7 +11,6 @@ import com.flow.common.mybatis.service.impl.BaseServiceImpl;
|
|
import com.flow.common.redis.service.RedisService;
|
|
import com.flow.common.redis.service.RedisService;
|
|
import com.flow.dao.FlowDefineDao;
|
|
import com.flow.dao.FlowDefineDao;
|
|
import com.flow.entity.FlowDefine;
|
|
import com.flow.entity.FlowDefine;
|
|
-import com.flow.entity.FlowTemp;
|
|
|
|
import com.flow.entity.FormModel;
|
|
import com.flow.entity.FormModel;
|
|
import com.flow.entity.form.Field;
|
|
import com.flow.entity.form.Field;
|
|
import com.flow.entity.form.serial.SerialRule;
|
|
import com.flow.entity.form.serial.SerialRule;
|
|
@@ -23,7 +22,6 @@ import com.flow.enums.ProcessStatus;
|
|
import com.flow.model.FormInfo;
|
|
import com.flow.model.FormInfo;
|
|
import com.flow.model.StartProcess;
|
|
import com.flow.model.StartProcess;
|
|
import com.flow.service.FlowDefineService;
|
|
import com.flow.service.FlowDefineService;
|
|
-import com.flow.service.FlowTempService;
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.flowable.common.engine.impl.identity.Authentication;
|
|
import org.flowable.common.engine.impl.identity.Authentication;
|
|
@@ -43,7 +41,6 @@ import java.time.format.DateTimeFormatter;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
-import java.util.Optional;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -59,9 +56,9 @@ public class FlowDefineServiceImpl extends BaseServiceImpl<FlowDefineDao, FlowDe
|
|
@Autowired
|
|
@Autowired
|
|
private RedisService<Long> redisService;
|
|
private RedisService<Long> redisService;
|
|
@Autowired
|
|
@Autowired
|
|
- private ObjectMapper objectMapper;
|
|
|
|
|
|
+ private RedisService<Map<String, Object>> redisMapService;
|
|
@Autowired
|
|
@Autowired
|
|
- private FlowTempService flowTempService;
|
|
|
|
|
|
+ private ObjectMapper objectMapper;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
@@ -148,7 +145,7 @@ public class FlowDefineServiceImpl extends BaseServiceImpl<FlowDefineDao, FlowDe
|
|
.variables(values)
|
|
.variables(values)
|
|
.start();
|
|
.start();
|
|
// 删除暂存
|
|
// 删除暂存
|
|
- flowTempService.deleteByBusinessId(startProcess.getDefineId());
|
|
|
|
|
|
+ redisMapService.hdel(startProcess.getDefineId(), SecurityContextUtil.getUserId());
|
|
try {
|
|
try {
|
|
runtimeService.setVariable(instanceId, "_SKIP_INITIATOR", false);
|
|
runtimeService.setVariable(instanceId, "_SKIP_INITIATOR", false);
|
|
} catch (Exception ignored) {
|
|
} catch (Exception ignored) {
|
|
@@ -199,34 +196,18 @@ public class FlowDefineServiceImpl extends BaseServiceImpl<FlowDefineDao, FlowDe
|
|
}
|
|
}
|
|
RootNode rootNode = (RootNode) define.getProcess();
|
|
RootNode rootNode = (RootNode) define.getProcess();
|
|
List<FieldProperty> formProperties = rootNode.getFormProperties();
|
|
List<FieldProperty> formProperties = rootNode.getFormProperties();
|
|
- return new FormInfo(define, formProperties, null);
|
|
|
|
|
|
+ Map variables = redisMapService.hget(defineId, SecurityContextUtil.getUserId(), Map.class);
|
|
|
|
+ return new FormInfo(define, formProperties, variables);
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public void storeFormDataTemporarily(StartProcess startProcess) {
|
|
public void storeFormDataTemporarily(StartProcess startProcess) {
|
|
- Optional<FlowTemp> optional = flowTempService.lambdaQuery()
|
|
|
|
- .eq(FlowTemp::getBusinessId, startProcess.getDefineId())
|
|
|
|
- .eq(FlowTemp::getUserId, SecurityContextUtil.getUserId())
|
|
|
|
- .oneOpt();
|
|
|
|
- if (optional.isPresent()) {
|
|
|
|
- FlowTemp flowTemp = optional.get();
|
|
|
|
- flowTemp.setData(startProcess.getValues());
|
|
|
|
- flowTempService.updateById(flowTemp);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- FlowTemp flowTemp = new FlowTemp();
|
|
|
|
- flowTemp.setBusinessId(startProcess.getDefineId());
|
|
|
|
- flowTemp.setUserId(SecurityContextUtil.getUserId());
|
|
|
|
- flowTemp.setData(startProcess.getValues());
|
|
|
|
- flowTempService.saveData(flowTemp);
|
|
|
|
|
|
+ redisMapService.hset(startProcess.getDefineId(), SecurityContextUtil.getUserId(), startProcess.getValues());
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getFormDataTemporarily(String defineId) {
|
|
public Map<String, Object> getFormDataTemporarily(String defineId) {
|
|
- FlowTemp flowTemp = flowTempService.getByBusinessId(defineId);
|
|
|
|
- return Optional.ofNullable(flowTemp)
|
|
|
|
- .map(FlowTemp::getData)
|
|
|
|
- .orElse(null);
|
|
|
|
|
|
+ return redisMapService.hget(defineId, SecurityContextUtil.getUserId(), Map.class);
|
|
}
|
|
}
|
|
}
|
|
}
|