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

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

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