Commit 2890402c authored by 郑越's avatar 郑越

源码修改1.0版

parent aac73fbb
......@@ -564,6 +564,32 @@
</plugins>
</build>
</profile>
<profile>
<id>mssql</id>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments>
<argument>--spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver</argument>
<argument>--spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowabledb</argument>
<argument>--spring.datasource.username=sa</argument>
<argument>--spring.datasource.password=sa</argument>
<argument>--com.sun.management.jmxremote.port=4001</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>mysql</id>
<dependencies>
......@@ -721,6 +747,11 @@
</profiles>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre8</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-rest</artifactId>
......
......@@ -15,10 +15,10 @@ spring.banner.location=classpath:/org/flowable/spring/boot/flowable-banner.txt
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.jmx.default-domain=${spring.application.name}
# datasource
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:~/flowable-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1
spring.datasource.username=flowable
spring.datasource.password=flowable
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowabledb
spring.datasource.username=sa
spring.datasource.password=sa
spring.datasource.hikari.poolName=${spring.application.name}
# 10 minutes
......@@ -41,7 +41,7 @@ flowable.rest.app.create-demo-definitions=true
# engine properties
flowable.process.servlet.path=/service
flowable.database-schema-update=true
flowable.database-schema-update=false
flowable.async-executor-activate=true
flowable.history-level=full
......
......@@ -23,11 +23,12 @@ import org.flowable.engine.impl.util.CommandContextUtil;
/**
* @author Tom Baeyens
* 注释防止更新表结构
*/
public class DbSchemaUpdate {
public static void main(String[] args) {
ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
/*ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
CommandExecutor commandExecutor = processEngine.getProcessEngineConfiguration().getCommandExecutor();
CommandConfig config = new CommandConfig().transactionNotSupported();
commandExecutor.execute(config, new Command<Object>() {
......@@ -36,7 +37,7 @@ public class DbSchemaUpdate {
CommandContextUtil.getProcessEngineConfiguration(commandContext).getSchemaManager().schemaUpdate();
return null;
}
});
});*/
}
}
......@@ -89,7 +89,7 @@ public class IdmIdentityServiceImpl extends CommonEngineServiceImpl<IdmEngineCon
@Override
public void saveUser(User user) {
commandExecutor.execute(new SaveUserCmd(user, configuration));
}
@Override
......@@ -209,7 +209,6 @@ public class IdmIdentityServiceImpl extends CommonEngineServiceImpl<IdmEngineCon
@Override
public void addUserPrivilegeMapping(String privilegeId, String userId) {
commandExecutor.execute(new AddPrivilegeMappingCmd(privilegeId, userId, null, configuration));
}
@Override
......
......@@ -85,7 +85,11 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......@@ -209,6 +213,32 @@
</plugins>
</build>
</profile>
<profile>
<id>mssql</id>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments>
<argument>--spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver</argument>
<argument>--spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowabledb</argument>
<argument>--spring.datasource.username=sa</argument>
<argument>--spring.datasource.password=sa</argument>
<argument>--com.sun.management.jmxremote.port=4001</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>postgresql</id>
<dependencies>
......
package org.flowable.ui.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.http.CacheControl;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import javax.annotation.PostConstruct;
import java.util.concurrent.TimeUnit;
@Configuration
public class MyWebMvcConfigurerAdapter implements WebMvcConfigurer {
@Autowired
private RequestMappingHandlerAdapter handlerAdapter;
/**
* string转Date
*/
@PostConstruct
public void initEditableAvlidation() {
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer)handlerAdapter.getWebBindingInitializer();
if(initializer.getConversionService()!=null) {
GenericConversionService genericConversionService = (GenericConversionService)initializer.getConversionService();
genericConversionService.addConverter(new StringToDateConverter());
}
}
/**
* 静态资源配置
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/flow/**")
.addResourceLocations("classpath:/templates/page/");
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/static/").setCacheControl(CacheControl.maxAge(30, TimeUnit.DAYS));
registry.addResourceHandler("/idm/**")
.addResourceLocations("classpath:/idm/").setCacheControl(CacheControl.maxAge(30, TimeUnit.DAYS));
}
/**
* 跨域配置
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedMethods("*")
.allowedOrigins("*")
.allowedHeaders("*")
.allowCredentials(true);
}
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*");
corsConfiguration.setAllowCredentials(true);
corsConfiguration.addAllowedHeader("*");
corsConfiguration.addAllowedMethod("*");
return corsConfiguration;
}
/**
* 跨域过滤器
*
* @return
*/
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", buildConfig());
return new CorsFilter(source);
}
}
\ No newline at end of file
package org.flowable.ui.config;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.StringUtils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by IntelliJ IDEA
* TODO: TODO
* author: 徐成
* Date: 2019-11-21
* Time: 20:17
* Email: old_camel@163.com
*/
public class StringToDateConverter implements Converter<String, Date>{
private static final List<String> formarts = new ArrayList<>(4);
static{
formarts.add("yyyy-MM");
formarts.add("yyyy-MM-dd");
formarts.add("yyyy-MM-dd HH:mm");
formarts.add("yyyy-MM-dd HH:mm:ss");
}
@Override
public Date convert(String source) {
String value = source.trim();
if ("".equals(value)) {
return null;
}
if(source.matches("^\\d{4}-\\d{1,2}$")){
return parseDate(source, formarts.get(0));
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")){
return parseDate(source, formarts.get(1));
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")){
return parseDate(source, formarts.get(2));
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")){
return parseDate(source, formarts.get(3));
}else {
throw new IllegalArgumentException("Invalid boolean value '" + source + "'");
}
}
/**
* 格式化日期
* @param dateStr String 字符型日期
* @param format String 格式
* @return Date 日期
*/
public Date parseDate(String dateStr, String format) {
Date date=null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = dateFormat.parse(dateStr);
} catch (Exception e) {
}
return date;
}
}
......@@ -49,7 +49,7 @@ flowable.common.app.role-prefix=
#
#spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:~/flowable-db/engine-db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9093;DB_CLOSE_DELAY=-1
#spring.datasource.url=jdbc:h2:~/flowable-db/engine-db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9093;DB_CLOSE_DELAY=-1
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8
......@@ -57,8 +57,8 @@ spring.datasource.url=jdbc:h2:~/flowable-db/engine-db;AUTO_SERVER=TRUE;AUTO_SERV
#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowable
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowablea
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowabledb
#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLE
......@@ -66,8 +66,8 @@ spring.datasource.url=jdbc:h2:~/flowable-db/engine-db;AUTO_SERVER=TRUE;AUTO_SERV
#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowable
spring.datasource.username=flowable
spring.datasource.password=flowable
spring.datasource.username=sa
spring.datasource.password=sa
# JNDI CONFIG
......
......@@ -12,6 +12,11 @@
*/
package org.flowable.ui.task.rest.runtime;
import java.util.Map;
import java.util.HashMap;
import org.flowable.engine.impl.TaskServiceImpl;
import org.flowable.task.service.TaskServiceConfiguration;
import org.springframework.web.bind.annotation.RequestParam;
import org.flowable.form.api.FormInfo;
import org.flowable.form.model.SimpleFormModel;
import org.flowable.ui.task.model.runtime.CompleteFormRepresentation;
......@@ -32,12 +37,15 @@ import org.springframework.web.bind.annotation.RestController;
* @author Joram Barrez
*/
@RestController
@RequestMapping("/app/rest/task-forms")
@ RequestMapping("/app/rest/task-forms")
public class TaskFormResource {
@Autowired
protected FlowableTaskFormService taskFormService;
@Autowired
protected TaskServiceImpl taskService;
@GetMapping(value = "/{taskId}", produces = "application/json")
public FormModelRepresentation getTaskForm(@PathVariable String taskId) {
FormInfo formInfo = taskFormService.getTaskForm(taskId);
......@@ -56,4 +64,35 @@ public class TaskFormResource {
public void saveTaskForm(@PathVariable String taskId, @RequestBody SaveFormRepresentation saveFormRepresentation) {
taskFormService.saveTaskForm(taskId, saveFormRepresentation);
}
@ResponseStatus(value = HttpStatus.OK)
@PostMapping(value = "/{taskId}/save-condition", produces = "application/json")
public Map<String,Object> rejectTask(@PathVariable String taskId, @RequestBody @RequestParam(required = false) Map<String,String> paras){
Map<String,Object> res =new HashMap<>();
Map<String,String> data = new HashMap<>();
boolean bok =true;
if(taskService.createTaskQuery().taskId(taskId).singleResult()==null)
{
bok=false;
}
Map<String,Object> flowParas=new HashMap<>();
flowParas.putAll(paras);
taskService.complete(taskId,flowParas);
if (bok){
data.put("taskId",taskId);
res.put("msg","条件注入成功");
res.put("res","1");
}
else {
data.put("taskId",taskId);
res.put("msg","条件注入失败");
res.put("res","0");
}
res.put("data",data);
return res;
}
}
......@@ -1072,7 +1072,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.1.jre8</version>
<version>8.4.1.jre8</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
......
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