提交 ccec6ef1 authored 作者: 黄夏豪's avatar 黄夏豪

[基础模块] 增加了BaseEntity 里面 放置了所有Entity的公共字段

上级 415db836
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version> <version>2.8.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency> </dependency>
<!--flowable整合springboot--> <!--flowable整合springboot-->
...@@ -106,32 +106,32 @@ ...@@ -106,32 +106,32 @@
</dependencies> </dependencies>
<build> <build>
<!-- <resources>--> <resources>
<!-- <resource>--> <resource>
<!-- <directory>src/main/java</directory>--> <directory>src/main/java</directory>
<!-- <includes>--> <includes>
<!-- <include>**/*</include>--> <include>**/*</include>
<!-- </includes>--> </includes>
<!-- <excludes>--> <excludes>
<!-- <exclude>**/.svn/*</exclude>--> <exclude>**/.svn/*</exclude>
<!-- </excludes>--> </excludes>
<!-- <filtering>false</filtering>--> <filtering>false</filtering>
<!-- </resource>--> </resource>
<!-- </resources>--> </resources>
<plugins> <plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- <plugin>--> <!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>--> <!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>--> <!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <source>1.8</source> &lt;!&ndash;指明源码用的Jdk版本&ndash;&gt;-->
<!-- <target>1.8</target> &lt;!&ndash;指明打包后的Jdk版本&ndash;&gt;-->
<!-- </configuration>-->
<!-- </plugin>--> <!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source> <!--指明源码用的Jdk版本-->
<target>1.8</target> <!--指明打包后的Jdk版本-->
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
......
package com.tykj.workflowcore.base.entity; package com.tykj.workflowcore.base.entity;
import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Date; import java.util.Date;
/** /**
* ClassName: BaseEntity * @author HuangXiahao
* Package: com.tykj.workflowcore.base.entity * @version V1.0
* Description: * @class BaseEntity
* Datetime: 2021/3/11 19:36 * @packageName com.example.demo.entity
* **/
* @Author: zsp
*/
@AllArgsConstructor
@NoArgsConstructor
@Data @Data
@MappedSuperclass
public abstract class BaseEntity { public abstract class BaseEntity {
private Date createTime; @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("主键")
protected Integer id;
@ApiModelProperty("创建时间")
@Temporal(TemporalType.TIMESTAMP)
protected Date createdTime;
@ApiModelProperty("修改时间")
@Temporal(TemporalType.TIMESTAMP)
protected Date updatedTime;
@ApiModelProperty("逻辑删除 0为 false 1为 true")
protected Integer deleted = 0;
private Date updateTime;
} }
...@@ -61,18 +61,6 @@ public class FlowsInfoController { ...@@ -61,18 +61,6 @@ public class FlowsInfoController {
public String editFlow(Long id){ public String editFlow(Long id){
return flowInfoService.editFlow(id).getFilePath(); return flowInfoService.editFlow(id).getFilePath();
} }
@GetMapping("/deploy")
@ApiOperation(value = "部署流程",notes = "部署成功")
public ResponseEntity deploy(Long id) throws FileNotFoundException {
//根据id 查询出flowsInfo
FlowsInfo flowsInfo = flowInfoService.findById(id);
if (flowsInfo.getState() == 0){
return ResultUtil.success(flowsInfo.getState(),"该流程已经被部署");
}
workFlowService.deployXml(flowsInfo);
return ResultUtil.success(flowsInfo.getState(),"流程部署成功");
}
@PostMapping("/saveXml") @PostMapping("/saveXml")
@ApiOperation(value = "保存xml以及其他流程信息") @ApiOperation(value = "保存xml以及其他流程信息")
......
...@@ -8,6 +8,7 @@ import lombok.AllArgsConstructor; ...@@ -8,6 +8,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
...@@ -29,12 +30,9 @@ import java.util.Date; ...@@ -29,12 +30,9 @@ import java.util.Date;
@Entity @Entity
@WorkFlowCoreNoScan @WorkFlowCoreNoScan
@SQLDelete(sql = "update flows_info set deleted = 1 where id = ?") @SQLDelete(sql = "update flows_info set deleted = 1 where id = ?")
@Where(clause = "deleted = 0")
@Api("流程表") @Api("流程表")
public class FlowsInfo extends BaseEntity { public class FlowsInfo extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("流程id")
private Long id;
@ApiModelProperty("发起人的Id") @ApiModelProperty("发起人的Id")
private Long userId; private Long userId;
...@@ -73,6 +71,4 @@ public class FlowsInfo extends BaseEntity { ...@@ -73,6 +71,4 @@ public class FlowsInfo extends BaseEntity {
* @params: 部署id * @params: 部署id
*/ */
private String deployId; private String deployId;
@ApiModelProperty("是否删除")
private Integer deleted = 0;
} }
package com.tykj.workflowcore.workflow_editer.service; package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.api.entity.InvokeRequest;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.vo.*; import com.tykj.workflowcore.workflow_editer.vo.*;
import org.flowable.task.api.Task;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -44,7 +42,7 @@ public interface WorkFlowService { ...@@ -44,7 +42,7 @@ public interface WorkFlowService {
* @param flowsInfo * @param flowsInfo
* @return 主键id * @return 主键id
*/ */
Long createFlow(@RequestBody FlowsInfo flowsInfo); Integer createFlow(@RequestBody FlowsInfo flowsInfo);
/** /**
* 部署xml流程文件 * 部署xml流程文件
...@@ -136,5 +134,7 @@ public interface WorkFlowService { ...@@ -136,5 +134,7 @@ public interface WorkFlowService {
* @return 任务已办列表 * @return 任务已办列表
*/ */
List<Object> findHistoryTask(String userId); List<Object> findHistoryTask(String userId);
} }
package com.tykj.workflowcore.workflow_editer.service.impl;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowRole;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowRoleType;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowUser;
import com.tykj.workflowcore.workflow_editer.service.UserService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* ClassName: UserService
* Package: com.tykj.service
* Description:
* Datetime: 2021/2/25 13:53
*
* @Author: zsp
*/
@Service
public class UserServiceImpl implements UserService {
@Override
public WorkFlowUser getCurrentUser() {
return null;
}
@Override
public List<WorkFlowUser> getAllUser() {
return null;
}
@Override
public List<WorkFlowRole> getAllRole(String roleType) {
return null;
}
@Override
public List<WorkFlowRoleType> getRoleType() {
return null;
}
}
...@@ -6,7 +6,6 @@ import com.tykj.workflowcore.api.entity.Parameter; ...@@ -6,7 +6,6 @@ import com.tykj.workflowcore.api.entity.Parameter;
import com.tykj.workflowcore.api.service.SpringBeanService; import com.tykj.workflowcore.api.service.SpringBeanService;
import com.tykj.workflowcore.workflow_editer.entity.*; import com.tykj.workflowcore.workflow_editer.entity.*;
import com.tykj.workflowcore.workflow_editer.mapper.FlowsInfoMapper; import com.tykj.workflowcore.workflow_editer.mapper.FlowsInfoMapper;
import com.tykj.workflowcore.workflow_editer.service.NodeInfoService;
import com.tykj.workflowcore.workflow_editer.service.UserService; import com.tykj.workflowcore.workflow_editer.service.UserService;
import com.tykj.workflowcore.workflow_editer.service.VariableStorageService; import com.tykj.workflowcore.workflow_editer.service.VariableStorageService;
import com.tykj.workflowcore.workflow_editer.service.WorkFlowService; import com.tykj.workflowcore.workflow_editer.service.WorkFlowService;
...@@ -23,7 +22,6 @@ import org.flowable.common.engine.impl.identity.Authentication; ...@@ -23,7 +22,6 @@ import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.*; import org.flowable.engine.*;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.repository.Deployment; import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.DeploymentBuilder;
import org.flowable.engine.runtime.Execution; import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.image.ProcessDiagramGenerator; import org.flowable.image.ProcessDiagramGenerator;
...@@ -31,8 +29,6 @@ import org.flowable.task.api.Task; ...@@ -31,8 +29,6 @@ import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery; import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -137,7 +133,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -137,7 +133,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
flowsInfo.setFlowKey(processId); flowsInfo.setFlowKey(processId);
flowsInfo.setFlowName(processName); flowsInfo.setFlowName(processName);
flowsInfo.setResourceName(file.getOriginalFilename()); flowsInfo.setResourceName(file.getOriginalFilename());
flowsInfo.setCreateTime(new Date()); flowsInfo.setCreatedTime(new Date());
//状态为未部署 //状态为未部署
flowsInfo.setState(1); flowsInfo.setState(1);
flowsInfo.setFilePath(realPath); flowsInfo.setFilePath(realPath);
...@@ -148,7 +144,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -148,7 +144,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override @Override
public void flowXml(@RequestBody FlowsInfoVo flowsInfoVo) { public void flowXml(@RequestBody FlowsInfoVo flowsInfoVo) {
Long id = flowsInfoVo.getId(); Integer id = flowsInfoVo.getId();
String flowKey = flowsInfoVo.getFlowKey(); String flowKey = flowsInfoVo.getFlowKey();
String fileXml = flowsInfoVo.getFileXml(); String fileXml = flowsInfoVo.getFileXml();
//生成xml文件 //生成xml文件
...@@ -194,24 +190,26 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -194,24 +190,26 @@ public class WorkFlowServiceImpl implements WorkFlowService {
FlowsInfo flowsInfo = new FlowsInfo(); FlowsInfo flowsInfo = new FlowsInfo();
BeanUtils.copyProperties(flowsInfoVo,flowsInfo); BeanUtils.copyProperties(flowsInfoVo,flowsInfo);
flowsInfo.setResourceName(flowKey+"bpmn20.xml"); flowsInfo.setResourceName(flowKey+"bpmn20.xml");
flowsInfo.setCreateTime(new Date()); flowsInfo.setCreatedTime(new Date());
//状态为未部署 //状态为未部署
flowsInfo.setState(1); flowsInfo.setState(1);
flowsInfo.setFilePath(classLoader.getResource("").getPath()+"/xml/"+flowKey+"bpmn20.xml"); flowsInfo.setFilePath(classLoader.getResource("").getPath()+"/xml/"+flowKey+"bpmn20.xml");
flowsInfo.setId(id); flowsInfo.setId(id);
//更新并保存 //更新并保存
flowsInfoMapper.save(flowsInfo); FlowsInfo save = flowsInfoMapper.save(flowsInfo);
//自动部署
deployXml(save);
} }
@Override @Override
public Long createFlow(FlowsInfo flowsInfo ) { public Integer createFlow(FlowsInfo flowsInfo ) {
FlowsInfo flowsInfo1 = flowsInfoMapper.save(flowsInfo); FlowsInfo flowsInfo1 = flowsInfoMapper.save(flowsInfo);
return flowsInfo1.getId(); return flowsInfo1.getId();
} }
@Override @Override
public void deployXml(FlowsInfo flowsInfo) throws FileNotFoundException { public void deployXml(FlowsInfo flowsInfo) {
Deployment deploy = null; Deployment deploy = null;
try { try {
deploy = repositoryService.createDeployment().addInputStream(flowsInfo.getResourceName(), deploy = repositoryService.createDeployment().addInputStream(flowsInfo.getResourceName(),
...@@ -353,9 +351,9 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -353,9 +351,9 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//先判断流程是否已经部署 //先判断流程是否已经部署
if(flowsInfo.getDeployId() != null){ if(flowsInfo.getDeployId() != null){
//已经部署了 (启用) //已经部署了 (启用)
repositoryService.deleteDeployment(flowsInfo.getDeployId(),true); repositoryService.deleteDeployment(flowsInfo.getDeployId());
} }
flowsInfo.setState(1); flowsInfo.setDeleted(1);
flowsInfoMapper.save(flowsInfo); flowsInfoMapper.save(flowsInfo);
} }
......
...@@ -26,7 +26,7 @@ import java.util.List; ...@@ -26,7 +26,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class FlowsInfoVo { public class FlowsInfoVo {
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
private Long id; private Integer id;
@ApiModelProperty("发起人的名字") @ApiModelProperty("发起人的名字")
private Long userName; private Long userName;
......
...@@ -2,7 +2,7 @@ spring: ...@@ -2,7 +2,7 @@ spring:
datasource: datasource:
username: root username: root
password: Huang123+ password: Huang123+
url: jdbc:mysql://47.106.142.73:3306/www?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&nullCatalogMeansCurrent=true url: jdbc:mysql://47.106.142.73:3306/www2?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&nullCatalogMeansCurrent=true
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
jpa: jpa:
show-sql: true show-sql: true
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论