Initial commit

This commit is contained in:
YoVinchen 2023-06-22 20:10:04 +08:00
parent 5abe7e8e44
commit 39a3866312
7 changed files with 122 additions and 9 deletions

View File

@ -0,0 +1,48 @@
package com.atguigu.process.controller.api;
import com.atguigu.common.result.Result;
import com.atguigu.model.process.ProcessType;
import com.atguigu.process.service.OaProcessTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* ClassName: ProcessController
* Package: com.atguigu.process.controller.api
*
* @author yovinchen
* @Create 2023/6/22 18:24
*/
@Api(tags = "审批流管理")
@RestController
@RequestMapping(value = "/admin/process")
@CrossOrigin//跨域
@SuppressWarnings({"unchecked", "rawtypes"})
public class ProcessController {
@Autowired
private OaProcessTypeService oaProcessTypeService;
/**
* 查询所有审批分类和每一个分类所有审批模版
*
* @return
*/
@ApiOperation(value = "获取全部审批分类及模板")
@GetMapping("findProcessType")
public Result findProcessType() {
List<ProcessType> list = oaProcessTypeService.findProcessType();
return Result.ok(list);
}
}

View File

@ -25,4 +25,9 @@ public interface OaProcessService extends IService<Process> {
*/
IPage<ProcessVo> selectPage(Page<ProcessVo> pageParam, ProcessQueryVo processQueryVo);
/**
* 部署流程定义
*/
void deployByZip(String deployPath);
}

View File

@ -3,6 +3,8 @@ package com.atguigu.process.service;
import com.atguigu.model.process.ProcessType;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 审批类型 服务类
@ -13,4 +15,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface OaProcessTypeService extends IService<ProcessType> {
/**
* 查询所有审批分类和每一个分类所有审批模版
*
* @return
*/
List<ProcessType> findProcessType();
}

View File

@ -1,7 +1,6 @@
package com.atguigu.process.service.impl;
import com.atguigu.model.process.Process;
import com.atguigu.model.process.ProcessType;
import com.atguigu.process.mapper.OaProcessMapper;
import com.atguigu.process.service.OaProcessService;
import com.atguigu.vo.process.ProcessQueryVo;
@ -9,9 +8,14 @@ import com.atguigu.vo.process.ProcessVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.zip.ZipInputStream;
/**
* <p>
* 审批类型 服务实现类
@ -23,6 +27,10 @@ import org.springframework.stereotype.Service;
@Service
public class OaProcessServiceImpl extends ServiceImpl<OaProcessMapper, Process> implements OaProcessService {
@Autowired
private RepositoryService repositoryService;
/**
* 获取分页列表
*
@ -33,7 +41,28 @@ public class OaProcessServiceImpl extends ServiceImpl<OaProcessMapper, Process>
//审批管理列表
@Override
public IPage<ProcessVo> selectPage(Page<ProcessVo> pageParam, ProcessQueryVo processQueryVo) {
IPage<ProcessVo> pageModel = baseMapper.selectPage(pageParam,processQueryVo);
IPage<ProcessVo> pageModel = baseMapper.selectPage(pageParam, processQueryVo);
return pageModel;
}
/**
* 部署流程定义
*
* @param deployPath
*/
@Override
public void deployByZip(String deployPath) {
// 定义zip输入流
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(deployPath);
ZipInputStream zipInputStream = null;
if (inputStream != null) {
zipInputStream = new ZipInputStream(inputStream);
}
// 流程部署
Deployment deployment = repositoryService.createDeployment().addZipInputStream(zipInputStream).deploy();
System.out.println("deployment.getId() = " + deployment.getId());
System.out.println("deployment.getName() = " + deployment.getName());
}
}

View File

@ -3,13 +3,16 @@ package com.atguigu.process.service.impl;
import com.atguigu.model.process.ProcessTemplate;
import com.atguigu.model.process.ProcessType;
import com.atguigu.process.mapper.OaProcessTemplateMapper;
import com.atguigu.process.service.OaProcessService;
import com.atguigu.process.service.OaProcessTemplateService;
import com.atguigu.process.service.OaProcessTypeService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
@ -30,6 +33,9 @@ public class OaProcessTemplateServiceImpl extends ServiceImpl<OaProcessTemplateM
@Resource
private OaProcessTypeService oaprocessTypeService;
@Autowired
private OaProcessService oaProcessService;
/**
* 分页查询审批模板把审批类型对应名称查询
*
@ -70,6 +76,9 @@ public class OaProcessTemplateServiceImpl extends ServiceImpl<OaProcessTemplateM
processTemplate.setStatus(1);
baseMapper.updateById(processTemplate);
//TODO 部署流程定义后续完善
//流程定义部署
if (StringUtils.isEmpty(processTemplate.getProcessDefinitionPath())) {
oaProcessService.deployByZip(processTemplate.getProcessDefinitionPath());
}
}
}

View File

@ -6,6 +6,8 @@ import com.atguigu.process.service.OaProcessTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 审批类型 服务实现类
@ -17,4 +19,16 @@ import org.springframework.stereotype.Service;
@Service
public class OaProcessTypeServiceImpl extends ServiceImpl<OaProcessTypeMapper, ProcessType> implements OaProcessTypeService {
/**
* 查询所有审批分类和每一个分类所有审批模版
*
* @return
*/
@Override
public List<ProcessType> findProcessType() {
return null;
}
}

View File

@ -10,12 +10,12 @@ spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://43.143.164.194:3306/guigu-oa?useSSL=false&useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true
username: admin
password: admin
# url: jdbc:mysql://localhost:3306/guigu-oa?useSSL=false&useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true
# username: root
# password: root
# url: jdbc:mysql://43.143.164.194:3306/guigu-oa?useSSL=false&useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true
# username: admin
# password: admin
url: jdbc:mysql://localhost:3306/guigu-oa?useSSL=false&useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true
username: root
password: root
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8