Commit 0596a358 authored by zhangyingbin's avatar zhangyingbin

新增流程关系表公用方法save和update

parent 76de4841
...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.ugp.api.Enum; ...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.ugp.api.Enum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum ProcessTypeEnum { public enum ProcessTypeEnum {
...@@ -14,4 +17,12 @@ public enum ProcessTypeEnum { ...@@ -14,4 +17,12 @@ public enum ProcessTypeEnum {
String type; String type;
String name; String name;
String tableName; String tableName;
public static Map<String,String> getCodeByName = new HashMap<String,String>();
static {
for(ProcessTypeEnum processTypeEnum:ProcessTypeEnum.values()){
getCodeByName.put(processTypeEnum.name,processTypeEnum.type);
}
}
} }
package com.yeejoin.amos.boot.module.ugp.api.service; package com.yeejoin.amos.boot.module.ugp.api.service;
public interface IProcessRelationService { public interface IProcessRelationService {
/**
* 保存资源流程关系信息
*
* @param instanceId 流程实例id
* @param sourceId 资源id
* @param processName 流程名称(文字)
*/
void savePR(String instanceId, Long sourceId, String processName);
/**
* 更新资源流程关系信息 state字段
*
* @param instanceId 流程实例id
*/
void updateState(String instanceId);
} }
package com.yeejoin.amos.boot.module.ugp.biz.service.impl; package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProcessTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProcessRelationDto; import com.yeejoin.amos.boot.module.ugp.api.dto.ProcessRelationDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProcessRelation; import com.yeejoin.amos.boot.module.ugp.api.entity.ProcessRelation;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProcessRelationMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.ProcessRelationMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IProcessRelationService; import com.yeejoin.amos.boot.module.ugp.api.service.IProcessRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service @Service
public class ProcessRelationServiceImpl extends BaseService<ProcessRelationDto, ProcessRelation, ProcessRelationMapper> implements IProcessRelationService { public class ProcessRelationServiceImpl extends BaseService<ProcessRelationDto, ProcessRelation, ProcessRelationMapper> implements IProcessRelationService {
@Autowired
ProjectInitiationServiceImpl projectInitiationService;
/**
* 保存资源流程关系信息
*
* @param instanceId 流程实例id
* @param sourceId 资源id
* @param processName 流程名称(文字)
*/
@Override
public void savePR(String instanceId, Long sourceId, String processName){
//此处不给state赋值,待流程执行更新state字段
ProcessRelation processRelation = new ProcessRelation();
processRelation.setInstanceId(instanceId);
processRelation.setSourceId(sourceId);
processRelation.setDefName(processName);
processRelation.setDefCode(ProcessTypeEnum.getCodeByName.get(processName));
this.save(processRelation);
}
/**
* 更新资源流程关系信息 state字段
*
* @param instanceId 流程实例id
*/
@Override
public void updateState(String instanceId){
LambdaQueryWrapper<ProcessRelation> wrapper = new LambdaQueryWrapper();
wrapper.eq(ProcessRelation::getInstanceId,instanceId);
// .eq(ProcessRelation::getSourceId,sourceId).eq(ProcessRelation::getDefName,processName);
ProcessRelation processRelation = this.getOne(wrapper);
String taskName = projectInitiationService.getFlowTaskName(instanceId);
processRelation.setStatus(taskName);
this.updateById(processRelation);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment