优化项目
This commit is contained in:
parent
8e8b1d4e4c
commit
311bccfc09
|
@ -53,6 +53,7 @@ public class FlowController extends BaseController {
|
|||
AppForm appFrom = appFormService.getAppFrom(task.getProcessInstanceId());
|
||||
mmap.put("appFrom", appFrom);
|
||||
mmap.put("taskId", taskId);
|
||||
mmap.put("processInstanceId", task.getProcessInstanceId());
|
||||
return task.getFormKey();
|
||||
}
|
||||
|
||||
|
@ -118,7 +119,7 @@ public class FlowController extends BaseController {
|
|||
historicTaskInstanceDTO.setProcessInstanceId(processInstanceId);
|
||||
//historicTaskInstanceDTO.setProcessStatus(1);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceList= flowableService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
AppForm appFrom = appFormService.getAppFromBySerializable(processInstanceId);
|
||||
AppForm appFrom = appFormService.getAppFrom(processInstanceId);
|
||||
modelMap.put("historicTaskInstanceList",historicTaskInstanceList);
|
||||
modelMap.put("processInstanceId",processInstanceId);
|
||||
modelMap.put("busVarUrl",appFrom.getBusVarUrl());
|
||||
|
|
|
@ -82,7 +82,7 @@ public class PurchaseOrderController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 导出采购单主表列表
|
||||
* 导出采购单主表列表detail
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:export")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.EXPORT)
|
||||
|
@ -198,7 +198,7 @@ public class PurchaseOrderController extends BaseController
|
|||
BeanUtils.copyProperties(newPurchaseOrderMain,purchaseOrderForm);
|
||||
purchaseOrderForm.setBusinessKey(purchaseOrderMain.getOrderNo());
|
||||
purchaseOrderForm.setStartUserId(String.valueOf(sysUser.getUserId()));
|
||||
purchaseOrderForm.setBusVarJson(JSON.toJSONString(purchaseOrderForm));
|
||||
// purchaseOrderForm.setBusVarJson(JSON.toJSONString(purchaseOrderForm));
|
||||
purchaseOrderForm.setClassPackName(PurchaseOrderForm.class.getCanonicalName());
|
||||
purchaseOrderForm.setBusVarUrl("/system/purchaseOrder/detail");
|
||||
ProcessInstance processInstance = flowableService.startProcessInstanceByAppForm(purchaseOrderForm);
|
||||
|
|
|
@ -173,9 +173,7 @@ public class SysOaLeaveController extends BaseController
|
|||
BeanUtils.copyProperties(sysOaLeave,sysOaLeaveForm);
|
||||
sysOaLeaveForm.setBusinessKey(newSysOaLeave.getLeaveNo());
|
||||
sysOaLeaveForm.setStartUserId(String.valueOf(sysUser.getUserId()));
|
||||
sysOaLeaveForm.setBusVarJson(com.alibaba.fastjson.JSON.toJSONString(sysOaLeaveForm));
|
||||
sysOaLeaveForm.setClassPackName(SysOaLeaveForm.class.getCanonicalName());
|
||||
sysOaLeaveForm.setBusVarUrl("/system/leave/leaveDetail");
|
||||
sysOaLeaveForm.setBusVarUrl("/system/leave/detail");
|
||||
ProcessInstance processInstance = flowableService.startProcessInstanceByAppForm(sysOaLeaveForm);
|
||||
//提交
|
||||
CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
|
||||
|
@ -207,16 +205,6 @@ public class SysOaLeaveController extends BaseController
|
|||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 请假单详情
|
||||
*/
|
||||
@GetMapping("/leaveDetail")
|
||||
public String leaveDetail(@RequestParam("processInstanceId") String processInstanceId, ModelMap mmap)
|
||||
{
|
||||
SysOaLeaveForm appFrom = appFormService.getAppFromBySerializable(processInstanceId);
|
||||
mmap.put("sysOaLeave", appFrom);
|
||||
return prefix + "/leaveDetail";
|
||||
}
|
||||
/**
|
||||
* 删除请假单
|
||||
*/
|
||||
|
|
|
@ -39,12 +39,9 @@
|
|||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: select2-js" />
|
||||
<script th:inline="javascript">
|
||||
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
|
||||
|
||||
var detailFlag = [[${@permission.hasPermi('system:flow:myStartProcessDetail')}]];
|
||||
|
||||
var processInstanceStatusDatas = [[${@dict.getType('process_instance_status')}]];
|
||||
var prefix = ctx + "modeler";
|
||||
var prefixFlow = ctx + "flow";
|
||||
$(function() {
|
||||
var options = {
|
||||
|
@ -74,7 +71,8 @@
|
|||
title: '单号',
|
||||
formatter: function(value, row, index) {
|
||||
var fromDetailUrl= row.fromDetailUrl;
|
||||
return '<a class="success" href="' + fromDetailUrl+ '" >'+value+'</a> ';
|
||||
|
||||
return '<a class="success" href="javascript:void(0)" onclick="fromDetailUrl(\'' + fromDetailUrl+ '\')">'+value+'</a>'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -119,6 +117,10 @@
|
|||
$.modal.openTab("详情", preViewUrl);
|
||||
}
|
||||
|
||||
function fromDetailUrl(detailUrl) {
|
||||
$.modal.openTab("详情", detailUrl);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -195,7 +195,7 @@
|
|||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="cancelTask(\''+row.taskId+'\')"><i class="fa fa-edit"></i>处理</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.processInstanceId + '\')"><i class="fa fa-eye"></i>流程图</a>');
|
||||
/*actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.processInstanceId + '\')"><i class="fa fa-eye"></i>流程图</a>');*/
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
|
@ -211,7 +211,7 @@
|
|||
function getProcessDiagram(processInstanceId) {
|
||||
|
||||
var preViewUrl=prefix+'/getProcessDiagram?processInstanceId='+processInstanceId;
|
||||
$.modal.openTab("流程图", preViewUrl);
|
||||
$.modal.open("流程图", preViewUrl,500,500);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -11,32 +11,14 @@
|
|||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>文件的唯一索引:</label>
|
||||
<label>key:</label>
|
||||
<input type="text" name="key"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>文件名:</label>
|
||||
<input type="text" name="name"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>文件类型:</label>
|
||||
<select name="type">
|
||||
<option value="">所有</option>
|
||||
<option value="-1">代码生成请选择字典属性</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>文件大小:</label>
|
||||
<input type="text" name="size"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>文件访问链接:</label>
|
||||
<input type="text" name="url"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>逻辑删除:</label>
|
||||
<input type="text" name="isDelete"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
|
@ -47,12 +29,6 @@
|
|||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:file:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:file:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:file:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
|
@ -89,7 +65,7 @@
|
|||
},
|
||||
{
|
||||
field: 'key',
|
||||
title: '文件的唯一索引'
|
||||
title: 'key'
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
|
@ -105,22 +81,17 @@
|
|||
},
|
||||
{
|
||||
field: 'url',
|
||||
title: '文件访问链接'
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注'
|
||||
},
|
||||
{
|
||||
field: 'isDelete',
|
||||
title: '逻辑删除'
|
||||
title: '文件访问链接',
|
||||
formatter: function(value, row, index) {
|
||||
|
||||
return '<a class="success" href='+value+'>'+value+'</a>'
|
||||
}
|
||||
},
|
||||
{
|
||||
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-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
</div>
|
||||
<br/>
|
||||
<input class="form-control" type="hidden" name="taskId" th:value="*{taskId}"/>
|
||||
<input class="form-control" type="hidden" id="processInstanceId" name="processInstanceId" th:value="*{processInstanceId}"/>
|
||||
|
||||
<input class="form-control" type="hidden" name="businessKey" th:value="${appFrom.leaveNo}"/>
|
||||
<h4 class="form-header h4">请假信息</h4>
|
||||
<div class="form-group">
|
||||
|
@ -48,6 +50,10 @@
|
|||
<div class="form-control-static" th:text="${appFrom.applyPerson}">
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">流程图</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<img class="imgcode" width="85%"/>
|
||||
</div>
|
||||
<h4 class="form-header h4">填写信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">人事审批意见:</label>
|
||||
|
@ -71,6 +77,12 @@
|
|||
<th:block th:include="include :: jsonview-js" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
|
||||
$(function () {
|
||||
var processInstanceId= $("#processInstanceId").val();
|
||||
var url ="/modeler/getProcessDiagram?processInstanceId="+processInstanceId;
|
||||
$(".imgcode").attr("src", url);
|
||||
});
|
||||
$(function() {
|
||||
var reason = [[${appFrom.reason}]];
|
||||
console.log(reason);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</div>
|
||||
<br/>
|
||||
<input class="form-control" type="hidden" name="taskId" th:value="*{taskId}"/>
|
||||
<input class="form-control" type="hidden" id="processInstanceId" name="processInstanceId" th:value="*{processInstanceId}"/>
|
||||
<h4 class="form-header h4">请假信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">单号:</label>
|
||||
|
@ -47,6 +48,10 @@
|
|||
<div class="form-control-static" th:text="${appFrom.applyPerson}">
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">流程图</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<img class="imgcode" width="85%"/>
|
||||
</div>
|
||||
<h4 class="form-header h4">填写信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">主管审批意见:</label>
|
||||
|
@ -63,8 +68,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
|
@ -112,7 +115,11 @@
|
|||
$.operate.saveTab("/system/leave/managerFinishTask", data);
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
var processInstanceId= $("#processInstanceId").val();
|
||||
var url ="/modeler/getProcessDiagram?processInstanceId="+processInstanceId;
|
||||
$(".imgcode").attr("src", url);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -13,6 +13,7 @@
|
|||
<body class="white-bg" >
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<input class="form-control" type="hidden" name="taskId" th:value="*{taskId}"/>
|
||||
<input class="form-control" type="hidden" id="processInstanceId" name="processInstanceId" th:value="*{processInstanceId}"/>
|
||||
<input class="form-control" type="hidden" name="businessKey" th:value="${appFrom.orderNo}"/>
|
||||
<input name="id" th:value="${appFrom.id}" type="hidden">
|
||||
<br/>
|
||||
|
@ -70,6 +71,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<h4 class="form-header h4">流程图</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<img class="imgcode" width="85%"/>
|
||||
</div>
|
||||
<h4 class="form-header h4">填写信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审批结果:</label>
|
||||
|
@ -104,6 +109,11 @@
|
|||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
$(function () {
|
||||
var processInstanceId= $("#processInstanceId").val();
|
||||
var url ="/modeler/getProcessDiagram?processInstanceId="+processInstanceId;
|
||||
$(".imgcode").attr("src", url);
|
||||
});
|
||||
var files=new Array();
|
||||
$(".file-upload").each(function (i) {
|
||||
var val = $("input[name='" + this.id + "']").val();
|
||||
|
|
|
@ -33,11 +33,12 @@ public abstract class AppForm implements Serializable {
|
|||
/**
|
||||
* 业务数据json
|
||||
*/
|
||||
@Deprecated
|
||||
private String busVarJson;
|
||||
/**
|
||||
* 当前类的包名称
|
||||
*/
|
||||
@NotBlank(message = "当前类的包名称不能为空")
|
||||
@Deprecated
|
||||
private String classPackName;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,8 +9,6 @@ import com.snow.flowable.domain.AppForm;
|
|||
* @date 2020/12/7 10:19
|
||||
*/
|
||||
public interface AppFormService {
|
||||
<A extends AppForm> A getAppFrom(String classInfoJson,String className);
|
||||
<A extends AppForm> A getAppFrom(String classInfoJson,Class<A> className);
|
||||
|
||||
/**
|
||||
* 从流程中获取表单数据
|
||||
|
@ -18,7 +16,5 @@ public interface AppFormService {
|
|||
* @param <A>
|
||||
* @return
|
||||
*/
|
||||
<A extends AppForm> A getAppFromBySerializable(String processInstanceId);
|
||||
|
||||
<A extends AppForm> A getAppFrom(String processInstanceId);
|
||||
}
|
||||
|
|
|
@ -30,33 +30,13 @@ public class AppFormServiceImpl implements AppFormService {
|
|||
|
||||
|
||||
@Override
|
||||
public <A extends AppForm> A getAppFrom(String classInfoJson,String className) {
|
||||
return JSON.parseObject(classInfoJson, getFormClass(className));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A extends AppForm> A getAppFrom(String classInfoJson,Class<A> className) {
|
||||
return JSON.parseObject(classInfoJson, className);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <A extends AppForm> A getAppFromBySerializable(String processInstanceId) {
|
||||
public <A extends AppForm> A getAppFrom(String processInstanceId) {
|
||||
HistoricProcessInstance historicProcessInstance=flowableService.getHistoricProcessInstanceById(processInstanceId);
|
||||
return getVariable(historicProcessInstance, FlowConstants.APP_FORM);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public <A extends AppForm> A getAppFrom(String processInstanceId) {
|
||||
HistoricProcessInstance historicProcessInstance=flowableService.getHistoricProcessInstanceById(processInstanceId);
|
||||
String classInfoJson = getVariable(historicProcessInstance, FlowConstants.BUS_VAR);
|
||||
String classPackName = getVariable(historicProcessInstance, FlowConstants.CLASS_PACK_NAME);
|
||||
return getAppFrom(classInfoJson, classPackName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程变量
|
||||
* @param key
|
||||
|
@ -67,11 +47,4 @@ public class AppFormServiceImpl implements AppFormService {
|
|||
return (V)historicProcessInstance.getProcessVariables().get(key);
|
||||
}
|
||||
|
||||
private <A> Class<A> getFormClass(String className) {
|
||||
try {
|
||||
return (Class<A>) Class.forName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
paramMap.remove("busVarJson");
|
||||
identityService.setAuthenticatedUserId(startUserId);
|
||||
paramMap.put(FlowConstants.APP_FORM,appForm);
|
||||
paramMap.put(FlowConstants.BUS_VAR,appForm.getBusVarJson());
|
||||
//paramMap.put(FlowConstants.BUS_VAR,appForm.getBusVarJson());
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(appForm.getFlowDef().getCode(),appForm.getBusinessKey(),paramMap);
|
||||
|
||||
//这个方法最终使用一个ThreadLocal类型的变量进行存储,也就是与当前的线程绑定,所以流程实例启动完毕之后,需要设置为null,防止多线程的时候出问题。
|
||||
|
@ -762,8 +762,10 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
|
||||
Map<String, Object> processVariables = t.getProcessVariables();
|
||||
String url= Optional.ofNullable(String.valueOf(processVariables.get(FlowConstants.BUS_VAR_URL))).orElse("");
|
||||
//设置返回详情页
|
||||
if(!StringUtils.isEmpty(url)){
|
||||
t.setFromDetailUrl(url+"?processInstanceId="+t.getId());
|
||||
if(!StringUtils.isEmpty(processVariables.get("id")))
|
||||
t.setFromDetailUrl(url+"/"+processVariables.get("id"));
|
||||
}
|
||||
AppForm appForm=(AppForm)processVariables.get(FlowConstants.APP_FORM);
|
||||
t.setAppForm(appForm);
|
||||
|
@ -836,8 +838,10 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
}
|
||||
Map<String, Object> processVariables = t.getProcessVariables();
|
||||
String url= Optional.ofNullable(String.valueOf(processVariables.get(FlowConstants.BUS_VAR_URL))).orElse("");
|
||||
//设置返回详情页
|
||||
if(!StringUtils.isEmpty(url)){
|
||||
historicTaskInstanceVO.setFromDetailUrl(url+"?processInstanceId="+t.getProcessInstanceId());
|
||||
if(!StringUtils.isEmpty(processVariables.get("id")))
|
||||
historicTaskInstanceVO.setFromDetailUrl(url+"/"+processVariables.get("id"));
|
||||
}
|
||||
AppForm appForm=(AppForm)processVariables.get(FlowConstants.APP_FORM);
|
||||
historicTaskInstanceVO.setAppForm(appForm);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.snow.framework.storage;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.SysFile;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import com.snow.system.service.ISysFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
@ -50,7 +52,7 @@ public class StorageService {
|
|||
public SysFile store(InputStream inputStream, long contentLength, String contentType, String fileName) {
|
||||
String key = generateKey(fileName);
|
||||
storage.store(inputStream, contentLength, contentType, key);
|
||||
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
String url = generateUrl(key);
|
||||
SysFile storageInfo = new SysFile();
|
||||
storageInfo.setName(fileName);
|
||||
|
@ -58,6 +60,7 @@ public class StorageService {
|
|||
storageInfo.setType(contentType);
|
||||
storageInfo.setKey(key);
|
||||
storageInfo.setUrl(url);
|
||||
storageInfo.setCreateBy(sysUser.getUserName());
|
||||
sysFileService.insertSysFile(storageInfo);
|
||||
|
||||
return storageInfo;
|
||||
|
|
|
@ -6,10 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<resultMap type="SysFile" id="SysFileResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="file_key" column="key" />
|
||||
<result property="file_name" column="name" />
|
||||
<result property="file_type" column="type" />
|
||||
<result property="file_size" column="size" />
|
||||
<result column="file_key" property ="key" />
|
||||
<result column="file_name" property="name" />
|
||||
<result column="file_type" property="type" />
|
||||
<result column="file_size" property="size" />
|
||||
<result property="url" column="url" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
|
Loading…
Reference in New Issue