update 调整字段错误,流程导入
This commit is contained in:
parent
3adf918067
commit
c21e0db622
@ -140,14 +140,12 @@ public class FlwDefinitionController extends BaseController {
|
||||
* 导入流程定义
|
||||
*
|
||||
* @param file 文件
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Log(title = "流程定义", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importDefinition")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<Void> importDefinition(MultipartFile file) throws Exception {
|
||||
defService.importXml(file.getInputStream());
|
||||
return R.ok();
|
||||
public R<Boolean> importDefinition(MultipartFile file) {
|
||||
return R.ok(iFlwDefinitionService.importXml(file));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@ -41,4 +42,12 @@ public interface IFlwDefinitionService {
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
void exportDefinition(Long id, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导入流程定义
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 结果
|
||||
*/
|
||||
boolean importXml(MultipartFile file);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.dromara.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.warm.flow.core.entity.Definition;
|
||||
import com.warm.flow.core.enums.PublishStatus;
|
||||
@ -14,11 +15,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
|
||||
import org.dromara.workflow.service.IFlwDefinitionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
@ -67,6 +70,28 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
|
||||
return BeanUtil.copyToList(list, FlowDefinitionVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入流程定义
|
||||
*
|
||||
* @param file 文件
|
||||
*/
|
||||
@Override
|
||||
public boolean importXml(MultipartFile file) {
|
||||
try {
|
||||
Definition definition = defService.importXml(file.getInputStream());
|
||||
List<FlowDefinition> list = flowDefinitionMapper.selectList(
|
||||
new LambdaQueryWrapper<FlowDefinition>().eq(FlowDefinition::getFlowCode, definition.getFlowCode()));
|
||||
List<FlowDefinition> definitionList = StreamUtils.filter(list, item -> !item.getId().equals(definition.getId()));
|
||||
if (CollUtil.isEmpty(definitionList)) {
|
||||
defService.publish(definition.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出流程定义
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
||||
<result property="businessId" column="business_id"/>
|
||||
<result property="flowName" column="flow_name"/>
|
||||
<result property="flowCode" column="flow_code"/>
|
||||
<result property="fromCustom" column="from_custom"/>
|
||||
<result property="fromPath" column="from_path"/>
|
||||
<result property="formCustom" column="form_custom"/>
|
||||
<result property="formPath" column="form_path"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
<resultMap type="org.dromara.workflow.domain.vo.FlowHisTaskVo" id="FlowHisTaskResult">
|
||||
@ -74,8 +74,8 @@
|
||||
i.flow_status,
|
||||
d.flow_name,
|
||||
d.flow_code,
|
||||
d.from_custom,
|
||||
d.from_path,
|
||||
d.form_custom,
|
||||
d.form_path,
|
||||
uu.processed_by
|
||||
FROM flow_task AS t
|
||||
LEFT JOIN flow_user uu ON uu.associated = t.id
|
||||
@ -105,8 +105,7 @@
|
||||
t.update_time,
|
||||
t.tenant_id,
|
||||
i.business_id,
|
||||
i.node_name,
|
||||
d.from_path fromPath,
|
||||
d.form_path fromPath,
|
||||
d.flow_name,
|
||||
d.flow_code
|
||||
from ( SELECT MAX(id) as id
|
||||
|
Loading…
x
Reference in New Issue
Block a user