标签:style class blog code ext color
解决方式:
1.配置文件插入
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> <property name="dataSource" ref="dataSource" /> <property name="databaseSchemaUpdate" value="true" /> <property name="transactionManager" ref="transactionManager" /> <!-- 中文乱码问题 --> <property name="activityFontName" value="宋体"></property> <property name="labelFontName" value="宋体"/> </bean>
2.生成图片代码中增加
public InputStream getDiagram(String processInstanceId) { // 查询流程实例 ProcessInstance pi = this.runtimeService.createProcessInstanceQuery() .processInstanceId(processInstanceId).singleResult(); // 强制类型转换为RepositoryServiceImpl RepositoryServiceImpl rs = (RepositoryServiceImpl) this.processEngine .getRepositoryService(); //1使用Spring注入 ProcessEngineConfigurationImpl processEngineConfigurationImpl = ((ProcessEngineImpl) this.processEngine) .getProcessEngineConfiguration(); Context.setProcessEngineConfiguration(processEngineConfigurationImpl); //2.不使用Spring注入 // ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines // .getDefaultProcessEngine(); // Context.setProcessEngineConfiguration(defaultProcessEngine // .getProcessEngineConfiguration()); BpmnModel bpmnModel = repositoryService.getBpmnModel(pi .getProcessDefinitionId()); // 转换为输入流 InputStream is = ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(processInstanceId)); return is; }
activiti5.15中文乱码问题,布布扣,bubuko.com
标签:style class blog code ext color
原文地址:http://www.cnblogs.com/humeng126/p/3790602.html