增加序列号

This commit is contained in:
jinqiming 2020-11-23 18:37:11 +08:00
parent 082ddf5797
commit f81581ea11
29 changed files with 920 additions and 117 deletions

View File

@ -1,28 +1,17 @@
package com.snow.web.controller.flowable;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.snow.common.annotation.Log;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.enums.BusinessType;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.flowable.domain.DeploymentDTO;
import com.snow.flowable.domain.DeploymentQueryDTO;
import com.snow.flowable.domain.DeploymentVO;
import com.snow.flowable.domain.TaskBaseDTO;
import com.snow.flowable.domain.*;
import com.snow.flowable.service.impl.FlowablePublishServiceImpl;
import com.snow.flowable.service.impl.FlowableServiceImpl;
import com.snow.framework.excel.FinanceAlipayFlowListener;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.FinanceAlipayFlow;
import com.snow.system.domain.FinanceAlipayFlowImport;
import com.snow.system.domain.SysUser;
import com.snow.system.service.IFinanceAlipayFlowService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.flowable.engine.repository.DeploymentQuery;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -95,7 +84,7 @@ public class FlowModelerController extends BaseController
{
startPage();
Long userId = ShiroUtils.getUserId();
List<Task> taskList = flowableService.findTasksByUserId(String.valueOf(userId), taskBaseDTO);
List<TaskVO> taskList = flowableService.findTasksByUserId(String.valueOf(userId), taskBaseDTO);
return getDataTable(taskList);
}

View File

@ -2,13 +2,16 @@ package com.snow.web.controller.system;
import java.util.List;
import com.snow.common.constant.SequenceContants;
import com.snow.flowable.domain.CompleteTaskDTO;
import com.snow.flowable.domain.StartProcessDTO;
import com.snow.flowable.service.impl.FlowableServiceImpl;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysSequenceService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
@ -44,6 +47,8 @@ public class SysOaLeaveController extends BaseController
@Autowired
private FlowableServiceImpl flowableService;
@Autowired
private ISysSequenceService sequenceService;
@RequiresPermissions("system:leave:view")
@GetMapping()
@ -100,14 +105,9 @@ public class SysOaLeaveController extends BaseController
{
SysUser sysUser = ShiroUtils.getSysUser();
StartProcessDTO startProcessDTO=new StartProcessDTO();
startProcessDTO.setBusinessKey(sysOaLeave.getName()+":"+"001");
startProcessDTO.setProcessDefinitionKey("snow_oa_leave");
startProcessDTO.setStartUserId(String.valueOf(sysUser.getUserId()));
ProcessInstance processInstance = flowableService.startProcessInstanceByKey(startProcessDTO);
sysOaLeave.setProcessInstanceId(processInstance.getProcessInstanceId());
String leaveNo = sequenceService.getNewSequenceNo(SequenceContants.OA_LEAVE_SEQUENCE);
sysOaLeave.setCreateBy(sysUser.getUserName());
sysOaLeave.setLeaveNo(leaveNo);
int i = sysOaLeaveService.insertSysOaLeave(sysOaLeave);
return toAjax(i);
}
@ -154,6 +154,21 @@ public class SysOaLeaveController extends BaseController
@ResponseBody
public AjaxResult editSave(SysOaLeave sysOaLeave)
{
SysUser sysUser = ShiroUtils.getSysUser();
SysOaLeave oldSysOaLeave = sysOaLeaveService.selectSysOaLeaveById(sysOaLeave.getId());
//发起审批
StartProcessDTO startProcessDTO=new StartProcessDTO();
startProcessDTO.setBusinessKey(oldSysOaLeave.getLeaveNo());
startProcessDTO.setProcessDefinitionKey("snow_oa_leave");
startProcessDTO.setStartUserId(String.valueOf(sysUser.getUserId()));
ProcessInstance processInstance = flowableService.startProcessInstanceByKey(startProcessDTO);
CompleteTaskDTO CompleteTaskDTO=new CompleteTaskDTO();
CompleteTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
flowableService.completeTask(CompleteTaskDTO);
sysOaLeave.setProcessStatus(1);
sysOaLeave.setCreateBy(sysUser.getUserName());
BeanUtils.copyProperties(sysOaLeave,oldSysOaLeave);
sysOaLeave.setProcessInstanceId(processInstance.getProcessInstanceId());
return toAjax(sysOaLeaveService.updateSysOaLeave(sysOaLeave));
}

View File

@ -0,0 +1,126 @@
package com.snow.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.snow.common.annotation.Log;
import com.snow.common.enums.BusinessType;
import org.springframework.stereotype.Controller;
import com.snow.system.domain.SysSequence;
import com.snow.system.service.ISysSequenceService;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.common.core.page.TableDataInfo;
/**
* 系统序列设置Controller
*
* @author snow
* @date 2020-11-23
*/
@Controller
@RequestMapping("/system/sequence")
public class SysSequenceController extends BaseController
{
private String prefix = "system/sequence";
@Autowired
private ISysSequenceService sysSequenceService;
@RequiresPermissions("system:sequence:view")
@GetMapping()
public String sequence()
{
return prefix + "/sequence";
}
/**
* 查询系统序列设置列表
*/
@RequiresPermissions("system:sequence:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysSequence sysSequence)
{
startPage();
List<SysSequence> list = sysSequenceService.selectSysSequenceList(sysSequence);
return getDataTable(list);
}
/**
* 导出系统序列设置列表
*/
@RequiresPermissions("system:sequence:export")
@Log(title = "系统序列设置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysSequence sysSequence)
{
List<SysSequence> list = sysSequenceService.selectSysSequenceList(sysSequence);
ExcelUtil<SysSequence> util = new ExcelUtil<SysSequence>(SysSequence.class);
return util.exportExcel(list, "sequence");
}
/**
* 新增系统序列设置
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存系统序列设置
*/
@RequiresPermissions("system:sequence:add")
@Log(title = "系统序列设置", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysSequence sysSequence)
{
return toAjax(sysSequenceService.insertSysSequence(sysSequence));
}
/**
* 修改系统序列设置
*/
@GetMapping("/edit/{name}")
public String edit(@PathVariable("name") String name, ModelMap mmap)
{
SysSequence sysSequence = sysSequenceService.selectSysSequenceById(name);
mmap.put("sysSequence", sysSequence);
return prefix + "/edit";
}
/**
* 修改保存系统序列设置
*/
@RequiresPermissions("system:sequence:edit")
@Log(title = "系统序列设置", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysSequence sysSequence)
{
return toAjax(sysSequenceService.updateSysSequence(sysSequence));
}
/**
* 删除系统序列设置
*/
@RequiresPermissions("system:sequence:remove")
@Log(title = "系统序列设置", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysSequenceService.deleteSysSequenceByIds(ids));
}
}

View File

@ -75,6 +75,7 @@
<logger name="com.snow" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<logger name="org.flowable.task.service.impl.persistence.entity" level="DEBUG" />
<root level="info">
<appender-ref ref="console" />

View File

@ -68,8 +68,6 @@
var capitalStatusDatas = [[${@dict.getType('capital_status')}]];
var flowCategoryDatas = [[${@dict.getType('flow_category')}]];
var prefix = ctx + "modeler";
var getXmlUrl=prefix+'/getXml?id=';
var getFlowPicture=prefix+'/getFlowPicture?id=';
$(function() {
var options = {
url: prefix + "/list",
@ -137,9 +135,14 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
console.log(JSON.stringify(row.processDefinitionVO));
var processDefinition= row.processDefinitionVO;
// var getFlowPicture=prefix+'/getFlowPicture?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.diagramResourceName;
var getXmlUrl=prefix+'/getXml?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.resourceName;
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getXmlUrl+row.id+'&resourceName=snow_leave.bpmn20.xml" target="_blank" ><i class="fa fa-edit"></i>XML</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getFlowPicture+row.id+'&resourceName=snow_leave.bpmn20.xml" ><i class="fa fa-edit"></i>流程图</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + processDefinition.deploymentId + '\',\''+processDefinition.diagramResourceName+'\');"><i class="fa fa-edit"></i>流程图</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getXmlUrl+'" target="_blank"><i class="fa fa-eye"></i>XML</a> ');
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getFlowPicture+'" target="_blank" ><i class="fa fa-etsy" ></i>流程图</a> ');*/
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
@ -147,6 +150,16 @@
};
$.table.init(options);
});
/**
* 预览XML
* @param tableId
*/
function previewXml(deploymentId,resourceName) {
console.log(JSON.stringify(deploymentId));
var preViewUrl=prefix+'/getFlowPicture?id='+deploymentId+'&resourceName='+resourceName;
$.modal.openTab("预览流程图", preViewUrl);
}
</script>
</body>
<!-- 导入区域 -->

View File

@ -112,11 +112,11 @@
var incomeExpenditureTypeDatas = [[${@dict.getType('income_expenditure_type')}]];
var capitalStatusDatas = [[${@dict.getType('capital_status')}]];
var billTypeDatas = [[${@dict.getType('bill_type')}]];
var prefix = ctx + "system/flow";
var prefix = ctx + "modeler";
$(function() {
var options = {
url: prefix + "/list",
url: prefix + "/findTasksByUserId",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
@ -128,89 +128,42 @@
checkbox: false
},
{
field: 'id',
title: 'ID',
field: 'taskId',
title: 'taskId',
visible: false
},
{
field: 'tradeNo',
title: '交易号',
formatter: function(value, row, index) {
if(value==null||value==''){
return '';
}else {
return value.substr(0,8);
}
}
field: 'processDefinitionName',
title: '流程名称'
},
{
field: 'taskName',
title: '任务名称'
},
{
field: 'businessKey',
title: '单号'
},
{
field: 'orderNo',
title: '商家订单号',
formatter: function(value, row, index) {
if(value==null||value==''){
return '';
}else {
return value.substr(0,8);
}
}
field: 'startUserId',
title: '流程发起人'
},
{
field: 'goodsName',
title: '商品'
field: 'startTime',
title: '流程发起时间'
},
{
field: 'tradePrice',
title: '交易金额'
},
{
field: 'payTime',
title: '交易支付时间'
},
{
field: 'billType',
title: '账单类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(billTypeDatas, value);
}
},
{
field: 'tradeType',
title: '交易类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(tradeTypeDatas, value);
}
},
{
field: 'counterparty',
title: '交易对方'
field: 'createDate',
title: '任务创建时间'
},
{
field: 'tradeStatus',
title: '交易状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(tradeStatusDatas, value);
}
},
{
field: 'incomeExpenditureType',
title: '收支类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(incomeExpenditureTypeDatas, value);
}
},
{
field: 'belongUserName',
title: '所属人'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>处理</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

View File

@ -71,14 +71,14 @@
}
$("input[name='startTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
format: "yyyy-mm-dd hh:ii:ss",
minView: "hour",
autoclose: true
});
$("input[name='endTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
format: "yyyy-mm-dd hh:ii:ss",
minView: "hour",
autoclose: true
});

View File

@ -87,14 +87,14 @@
}
$("input[name='startTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
format: "yyyy-mm-dd hh:ii:ss",
minView: "hour",
autoclose: true
});
$("input[name='endTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
format: "yyyy-mm-dd hh:ii:ss",
minView: "hour",
autoclose: true
});

View File

@ -137,7 +137,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>发起申请</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增系统序列设置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sequence-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">当前值:</label>
<div class="col-sm-8">
<input name="currentValue" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">步幅:</label>
<div class="col-sm-8">
<input name="increment" class="form-control" type="text" required>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/sequence"
$("#form-sequence-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-sequence-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改系统序列设置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sequence-edit" th:object="${sysSequence}">
<input name="name" th:field="*{name}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">当前值:</label>
<div class="col-sm-8">
<input name="currentValue" th:field="*{currentValue}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">步幅:</label>
<div class="col-sm-8">
<input name="increment" th:field="*{increment}" class="form-control" type="text" required>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/sequence";
$("#form-sequence-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-sequence-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('系统序列设置列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>当前值:</label>
<input type="text" name="currentValue"/>
</li>
<li>
<label>步幅:</label>
<input type="text" name="increment"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:sequence:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:sequence:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:sequence:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:sequence:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:sequence:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:sequence:remove')}]];
var prefix = ctx + "system/sequence";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "系统序列设置",
columns: [{
checkbox: true
},
{
field: 'name',
title: '序列名称',
visible: false
},
{
field: 'currentValue',
title: '当前值'
},
{
field: 'increment',
title: '步幅'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.name + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.name + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,14 @@
package com.snow.common.constant;
/**
* @author qimingjin
* @Title: 序列号通用常量
* @Description:
* @date 2020/11/23 16:39
*/
public class SequenceContants {
/**
*请假
*/
public static final String OA_LEAVE_SEQUENCE = "OA_QJ";
}

View File

@ -3,6 +3,7 @@ package com.snow.flowable.config;
import org.flowable.common.engine.impl.EngineDeployer;
import org.flowable.engine.impl.rules.RulesDeployer;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@ -35,6 +36,11 @@ public class FlowableConfig {
add(new RulesDeployer());
}
});
//设置流程图显示乱码
configuration.setActivityFontName("宋体");
configuration.setLabelFontName("宋体");
configuration.setAnnotationFontName("宋体");
return configuration;
}
}

View File

@ -1,6 +1,7 @@
package com.snow.flowable.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.flowable.engine.repository.ProcessDefinition;
@ -20,7 +21,7 @@ public class DeploymentVO implements Serializable {
private String name;
@JSONField(format = "YYYY-MM-DD hh:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date deploymentTime;
private String category;

View File

@ -0,0 +1,64 @@
package com.snow.flowable.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @author qimingjin
* @Title:
* @Description:
* ASSIGNEE_受理人task任务的受理人就是执行TASK的人这个又分两种情况有值NULL
* 1有值的情况XML流程里面定义的受理人TASK会直接填入这个人
* 2NULLXML没有指定受理人或者只指定了候选组
* 没有值的时候可以使用签收功能去指定受理人就是候选组里面谁签收谁就成了受理人
*OWNER_委托人受理人委托其他人操作该TASK的时候受理人就成了委托人OWNER_其他人就成了受理人ASSIGNEE_
* @date 2020/11/23 17:40
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TaskVO implements Serializable {
private String taskId;
private String taskName;
private String processDefinitionName;
private String description;
private String owner;
private String parentTaskId;
private String tenantId;
private String Assignee;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDate;
private String category;
private String formKey;
private String processInstanceId;
private String startUserId;
private String startUserName;
private String businessKey;
/**
* 任务发起时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
}

View File

@ -60,7 +60,7 @@ public interface FlowableService {
* @param taskBaseDTO
* @return
*/
List<Task> findTasksByUserId(String userId,TaskBaseDTO taskBaseDTO);
List<TaskVO> findTasksByUserId(String userId,TaskBaseDTO taskBaseDTO);
/**
* 完成任务

View File

@ -138,7 +138,9 @@ public class FlowableServiceImpl implements FlowableService {
InputStream inputStream = repositoryService.getResourceAsStream(id, resourceName);
b = IoUtil.readInputStream(inputStream, resourceName);
} else {
response.setHeader("Content-Type", "image/png");
//todo 输出的有乱码暂时没有解决办法
response.setHeader("Content-Type", "image/png;charset=UTF-8");
response.setCharacterEncoding("utf-8");
InputStream inputStream = repositoryService.getResourceAsStream(id, resourceName);
b = IoUtil.readInputStream(inputStream, resourceName);
}
@ -164,6 +166,8 @@ public class FlowableServiceImpl implements FlowableService {
}else {
processInstance = runtimeService.startProcessInstanceByKey(startProcessDTO.getProcessDefinitionKey(),startProcessDTO.getBusinessKey());
}
//这个方法最终使用一个ThreadLocal类型的变量进行存储也就是与当前的线程绑定所以流程实例启动完毕之后需要设置为null防止多线程的时候出问题
identityService.setAuthenticatedUserId(null);
return processInstance;
}
@ -179,18 +183,19 @@ public class FlowableServiceImpl implements FlowableService {
}
@Override
public List<Task> findTasksByUserId(String userId, TaskBaseDTO taskBaseDTO) {
public List<TaskVO> findTasksByUserId(String userId, TaskBaseDTO taskBaseDTO) {
//根据用户ID获取角色
List<SysRole> sysRoles = roleService.selectRolesByUserId(Long.parseLong(userId));
TaskQuery taskQuery = taskService.createTaskQuery()
.or()
.taskCandidateOrAssigned(userId);
//这个地方查询回去查询系统的用户组表希望的是查询自己的用户表
if(!CollectionUtils.isEmpty(sysRoles)) {
taskQuery.or()
.taskCandidateGroupIn(sysRoles.stream().map(t->{
List<String> roleIds = sysRoles.stream().map(t -> {
return String.valueOf(t.getRoleId());
}).collect(Collectors.toList()));
}).collect(Collectors.toList());
taskQuery.taskCandidateGroupIn(roleIds);
}
if(!StringUtils.isEmpty(taskBaseDTO.getProcessInstanceId())){
taskQuery.processInstanceId(taskBaseDTO.getProcessInstanceId());
@ -204,12 +209,32 @@ public class FlowableServiceImpl implements FlowableService {
if(StringUtils.isEmpty(taskBaseDTO.getDefinitionKey())){
taskQuery.processDefinitionKey(taskBaseDTO.getDefinitionKey());
}
return taskQuery.endOr()
.orderBy(TaskQueryProperty.CREATE_TIME)
List<Task> taskList = taskQuery.endOr()
.orderByTaskCreateTime()
.desc()
.listPage(taskBaseDTO.getFirstResult(), taskBaseDTO.getMaxResults());
List<TaskVO> taskVoList = taskList.stream().map(t -> {
TaskVO taskVO = new TaskVO();
taskVO.setTaskId(t.getId());
taskVO.setTaskName(t.getName());
taskVO.setProcessInstanceId(t.getProcessInstanceId());
taskVO.setCreateDate(t.getCreateTime());
taskVO.setFormKey(t.getFormKey());
taskVO.setParentTaskId(t.getParentTaskId());
taskVO.setAssignee(t.getAssignee());
taskVO.setOwner(t.getOwner());
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(t.getProcessInstanceId());
taskVO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
taskVO.setStartUserId(historicProcessInstance.getStartUserId());
taskVO.setBusinessKey(historicProcessInstance.getBusinessKey());
taskVO.setStartTime(historicProcessInstance.getStartTime());
return taskVO;
}).collect(Collectors.toList());
return taskVoList;
}
@Override
public void completeTask(CompleteTaskDTO completeTaskDTO) {
Task task = this.getTask(completeTaskDTO.getTaskId());
@ -295,4 +320,16 @@ public class FlowableServiceImpl implements FlowableService {
return historyService.createHistoricProcessInstanceQuery().finished()
.processInstanceId(processInstanceId).count() > 0;
}
public ProcessInstance getProcessInstanceById(String id){
return runtimeService.createProcessInstanceQuery()
.processInstanceId(id)
.singleResult();
}
public HistoricProcessInstance getHistoricProcessInstanceById(String id){
return historyService.createHistoricProcessInstanceQuery()
.processInstanceId(id)
.singleResult();
}
}

View File

@ -2,7 +2,7 @@
# 代码生成
gen:
# 作者
author: snow
author: 阿吉
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.snow.system
# 自动去除表前缀默认是false

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.snow.common.annotation.Log;
import com.snow.common.enums.BusinessType;
import org.springframework.stereotype.Controller;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.snow.common.core.controller.BaseController;

View File

@ -4,6 +4,10 @@ package ${packageName}.domain;
import ${import};
#end
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
#if($table.crud || $table.sub)
#elseif($table.tree)
#end
@ -36,6 +40,7 @@ public class ${ClassName} extends ${Entity}
#if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date')
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
@Excel(name = "${comment}")

View File

@ -4,7 +4,7 @@ package ${packageName}.domain;
import ${import};
#end
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* ${subTable.functionName}对象 ${subTableName}
*
@ -28,6 +28,7 @@ public class ${subClassName} extends BaseEntity
#if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date')
@JsonFormat(timezone = "GMT+8", pattern = "yyyyMMdd HH:mm:ss")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
@Excel(name = "${comment}")

View File

@ -1,6 +1,8 @@
package com.snow.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.annotation.Excel;
import com.snow.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -29,6 +31,7 @@ public class SysOaLeave extends BaseEntity
/** 开始时间 */
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 结束时间 */
@ -53,6 +56,9 @@ public class SysOaLeave extends BaseEntity
/** 附件 */
@Excel(name = "附件")
private String fileUrl;
/** 请假单号 */
@Excel(name = "请假单号")
private String leaveNo;
public void setId(Integer id)
{
@ -145,6 +151,14 @@ public class SysOaLeave extends BaseEntity
return fileUrl;
}
public String getLeaveNo() {
return leaveNo;
}
public void setLeaveNo(String leaveNo) {
this.leaveNo = leaveNo;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,65 @@
package com.snow.system.domain;
import com.snow.common.annotation.Excel;
import com.snow.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 系统序列设置对象 sys_sequence
*
* @author snow
* @date 2020-11-23
*/
public class SysSequence extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 序列名称 */
private String name;
/** 当前值 */
@Excel(name = "当前值")
private Long currentValue;
/** 步幅 */
@Excel(name = "步幅")
private Long increment;
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setCurrentValue(Long currentValue)
{
this.currentValue = currentValue;
}
public Long getCurrentValue()
{
return currentValue;
}
public void setIncrement(Long increment)
{
this.increment = increment;
}
public Long getIncrement()
{
return increment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("currentValue", getCurrentValue())
.append("increment", getIncrement())
.toString();
}
}

View File

@ -0,0 +1,68 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.SysSequence;
/**
* 系统序列设置Mapper接口
*
* @author snow
* @date 2020-11-23
*/
public interface SysSequenceMapper
{
/**
* 查询系统序列设置
*
* @param name 系统序列设置ID
* @return 系统序列设置
*/
public SysSequence selectSysSequenceById(String name);
/**
* 查询系统序列设置列表
*
* @param sysSequence 系统序列设置
* @return 系统序列设置集合
*/
public List<SysSequence> selectSysSequenceList(SysSequence sysSequence);
/**
* 新增系统序列设置
*
* @param sysSequence 系统序列设置
* @return 结果
*/
public int insertSysSequence(SysSequence sysSequence);
/**
* 修改系统序列设置
*
* @param sysSequence 系统序列设置
* @return 结果
*/
public int updateSysSequence(SysSequence sysSequence);
/**
* 获取下个序列值
* @param name
* @return
*/
public int getNextSequence(String name);
/**
* 删除系统序列设置
*
* @param name 系统序列设置ID
* @return 结果
*/
public int deleteSysSequenceById(String name);
/**
* 批量删除系统序列设置
*
* @param names 需要删除的数据ID
* @return 结果
*/
public int deleteSysSequenceByIds(String[] names);
}

View File

@ -0,0 +1,68 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysSequence;
/**
* 系统序列设置Service接口
*
* @author snow
* @date 2020-11-23
*/
public interface ISysSequenceService
{
/**
* 查询系统序列设置
*
* @param name 系统序列设置ID
* @return 系统序列设置
*/
public SysSequence selectSysSequenceById(String name);
/**
* 查询系统序列设置列表
*
* @param sysSequence 系统序列设置
* @return 系统序列设置集合
*/
public List<SysSequence> selectSysSequenceList(SysSequence sysSequence);
/**
* 新增系统序列设置
*
* @param sysSequence 系统序列设置
* @return 结果
*/
public int insertSysSequence(SysSequence sysSequence);
/**
* 修改系统序列设置
*
* @param sysSequence 系统序列设置
* @return 结果
*/
public int updateSysSequence(SysSequence sysSequence);
/**
* 批量删除系统序列设置
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysSequenceByIds(String ids);
/**
* 删除系统序列设置信息
*
* @param name 系统序列设置ID
* @return 结果
*/
public int deleteSysSequenceById(String name);
/**
* 获取新的序列号
* @param name
* @return
*/
String getNewSequenceNo(String name);
}

View File

@ -0,0 +1,118 @@
package com.snow.system.service.impl;
import java.util.Date;
import java.util.List;
import cn.hutool.core.date.DateUtil;
import com.snow.common.exception.BusinessException;
import com.snow.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysSequenceMapper;
import com.snow.system.domain.SysSequence;
import com.snow.system.service.ISysSequenceService;
import com.snow.common.core.text.Convert;
/**
* 系统序列设置Service业务层处理
*
* @author snow
* @date 2020-11-23
*/
@Service
public class SysSequenceServiceImpl implements ISysSequenceService
{
@Autowired
private SysSequenceMapper sysSequenceMapper;
/**
* 查询系统序列设置
*
* @param name 系统序列设置ID
* @return 系统序列设置
*/
@Override
public SysSequence selectSysSequenceById(String name)
{
return sysSequenceMapper.selectSysSequenceById(name);
}
/**
* 查询系统序列设置列表
*
* @param sysSequence 系统序列设置
* @return 系统序列设置
*/
@Override
public List<SysSequence> selectSysSequenceList(SysSequence sysSequence)
{
return sysSequenceMapper.selectSysSequenceList(sysSequence);
}
/**
* 新增系统序列设置
*
* @param sysSequence 系统序列设置
* @return 结果
*/
@Override
public int insertSysSequence(SysSequence sysSequence)
{
return sysSequenceMapper.insertSysSequence(sysSequence);
}
/**
* 修改系统序列设置
*
* @param sysSequence 系统序列设置
* @return 结果
*/
@Override
public int updateSysSequence(SysSequence sysSequence)
{
return sysSequenceMapper.updateSysSequence(sysSequence);
}
/**
* 删除系统序列设置对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysSequenceByIds(String ids)
{
return sysSequenceMapper.deleteSysSequenceByIds(Convert.toStrArray(ids));
}
/**
* 删除系统序列设置信息
*
* @param name 系统序列设置ID
* @return 结果
*/
@Override
public int deleteSysSequenceById(String name)
{
return sysSequenceMapper.deleteSysSequenceById(name);
}
/**
* 获取最新的序列化
* @param name
* @return
*/
@Override
public String getNewSequenceNo(String name) {
SysSequence sysSequence = selectSysSequenceById(name);
if(StringUtils.isNull(sysSequence)){
throw new BusinessException("该序列名称不存在");
}
int nextSequence = sysSequenceMapper.getNextSequence(name);
String date = DateUtil.format(new Date(), "yyyyMMdd");
StringBuilder sequenceNo=new StringBuilder(name);
sequenceNo.append(date);
sequenceNo.append(String.format("%04d",nextSequence));
return sequenceNo.toString();
}
}

View File

@ -20,15 +20,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
<result property="isDelete" column="is_delete" />
<result property="fileUrl" column="file_url" />
<result property="leaveNo" column="leave_no" />
</resultMap>
<sql id="selectSysOaLeaveVo">
select id, name, reason, start_time, end_time, process_status, process_instance_id, create_by, create_time, update_time, update_by, apply_person, remark, is_delete, file_url from sys_oa_leave
select id, name,leave_no, reason, start_time, end_time, process_status, process_instance_id, create_by, create_time, update_time, update_by, apply_person, remark, is_delete, file_url from sys_oa_leave
</sql>
<select id="selectSysOaLeaveList" parameterType="SysOaLeave" resultMap="SysOaLeaveResult">
<include refid="selectSysOaLeaveVo"/>
<where>
<if test="leaveNo != null and leaveNo != ''"> and leave_no like concat('%', #{leaveNo}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="reason != null and reason != ''"> and reason = #{reason}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
@ -49,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into sys_oa_leave
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="leaveNo != null and leaveNo != ''"> leave_no,</if>
<if test="reason != null">reason,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
@ -65,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="leaveNo != null ">#{leaveNo},</if>
<if test="reason != null">#{reason},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
@ -85,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_oa_leave
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="leaveNo != null ">leave_no=#{leaveNo},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.snow.system.mapper.SysSequenceMapper">
<resultMap type="SysSequence" id="SysSequenceResult">
<result property="name" column="name" />
<result property="currentValue" column="current_value" />
<result property="increment" column="increment" />
</resultMap>
<sql id="selectSysSequenceVo">
select name, current_value, increment from sys_sequence
</sql>
<select id="selectSysSequenceList" parameterType="SysSequence" resultMap="SysSequenceResult">
<include refid="selectSysSequenceVo"/>
<where>
<if test="currentValue != null "> and current_value = #{currentValue}</if>
<if test="increment != null "> and increment = #{increment}</if>
</where>
</select>
<select id="selectSysSequenceById" parameterType="String" resultMap="SysSequenceResult">
<include refid="selectSysSequenceVo"/>
where name = #{name}
</select>
<insert id="insertSysSequence" parameterType="SysSequence">
insert into sys_sequence
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="currentValue != null">current_value,</if>
<if test="increment != null">increment,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="currentValue != null">#{currentValue},</if>
<if test="increment != null">#{increment},</if>
</trim>
</insert>
<update id="updateSysSequence" parameterType="SysSequence">
update sys_sequence
<trim prefix="SET" suffixOverrides=",">
<if test="currentValue != null">current_value = #{currentValue},</if>
<if test="increment != null">increment = #{increment},</if>
</trim>
where name = #{name}
</update>
<update id="getNextSequence" parameterType="String">
UPDATE sys_sequence
SET current_value = current_value + increment
WHERE name = #{name}
</update>
<delete id="deleteSysSequenceById" parameterType="String">
delete from sys_sequence where name = #{name}
</delete>
<delete id="deleteSysSequenceByIds" parameterType="String">
delete from sys_sequence where name in
<foreach item="name" collection="array" open="(" separator="," close=")">
#{name}
</foreach>
</delete>
</mapper>