增加form表单

This commit is contained in:
459816669@qq.com 2021-03-27 15:05:05 +08:00
parent 97e606a575
commit 43cdb970b1
94 changed files with 6203 additions and 398 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
@ -99,7 +99,6 @@
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-from</artifactId>
<version>4.3.1</version>
</dependency>
</dependencies>

View File

@ -77,8 +77,7 @@ public class CommonController
{
try
{
String originalFilename = file.getOriginalFilename();
SysFile store = storageService.store(file.getInputStream(), file.getSize(), file.getContentType(), originalFilename);
SysFile store = storageService.store(file);
AjaxResult ajax = AjaxResult.success();
ajax.put("fileKey",store.getKey());
ajax.put("fileName", store.getName());

View File

@ -80,6 +80,10 @@ public class CallBackController {
if(StringUtils.isEmpty(type)){
return Constants.CALL_BACK_FAIL_RETURN;
}
//测试回调URL事件直接返回加密后的success即可
if(eventType.equals(DingTalkListenerType.CALL_BACK_CHECK_URL.getInfo())){
return dingTalkEncryptor.getEncryptedMap(Constants.CALL_BACK_SUCCESS_RETURN, timestamp, nonce);
}
//调用工厂模式异步处理数据
SyncSysInfoFactory syncSysInfoFactory = new SyncSysInfoFactory();
ISyncSysInfo iSyncSysInfo = syncSysInfoFactory.getSyncSysInfoService(type);

View File

@ -0,0 +1,198 @@
package com.snow.web.controller.dingtalk;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.dingtalk.api.response.OapiProcessinstanceGetResponse;
import com.snow.common.annotation.RepeatSubmit;
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.DingFlowTaskType;
import com.snow.dingtalk.model.DingFinishTaskRequest;
import com.snow.dingtalk.model.DingTaskVO;
import com.snow.dingtalk.model.FlowExecuteTaskRequest;
import com.snow.dingtalk.service.impl.DingOfficialFlowServiceImpl;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysDingHiTask;
import com.snow.system.domain.SysDingRuTask;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysDingHiTaskService;
import com.snow.system.service.ISysDingRuTaskService;
import com.snow.system.service.impl.SysUserServiceImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.stream.Collectors;
/**
* 钉钉任务Controller
*
* @author 没用的阿吉
* @date 2021-03-24
*/
@Controller
@RequestMapping("/ding/task")
public class DingTaskController extends BaseController
{
private String prefix = "ding/task";
@Autowired
private ISysDingRuTaskService sysDingRuTaskService;
@Autowired
private DingOfficialFlowServiceImpl dingOfficialFlowService;
@Autowired
private ISysDingHiTaskService sysDingHiTaskService;
@Autowired
private SysUserServiceImpl sysUserService;
@RequiresPermissions("ding:task:view")
@GetMapping()
public String task()
{
return prefix + "/task";
}
/**
* 查询钉钉运行任务列表
*/
@RequiresPermissions("ding:task:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysDingRuTask sysDingRuTask)
{
startPage();
SysUser sysUser = ShiroUtils.getSysUser();
sysDingRuTask.setAssignee(sysUser.getDingUserId());
//待办为处理中的
sysDingRuTask.setTaskState(DingFlowTaskType.RUNNING.getCode());
List<SysDingRuTask> list = sysDingRuTaskService.selectSysDingRuTaskList(sysDingRuTask);
return getDataTable(list);
}
/**
* 跳转完成任务界面
* @return
*/
@GetMapping("/toFinishTask")
public String toFinishTask(String taskId,ModelMap mmap)
{
SysDingRuTask sysDingRuTask = sysDingRuTaskService.selectSysDingRuTaskById(taskId);
OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceDetail = dingOfficialFlowService.getProcessInstanceDetail(sysDingRuTask.getProcInstId());
//获取表单值
List<OapiProcessinstanceGetResponse.FormComponentValueVo> formComponentValues = processInstanceDetail.getFormComponentValues();
mmap.put("formComponentValues",formComponentValues);
mmap.put("taskId",taskId);
mmap.put("processInstanceId",sysDingRuTask.getProcInstId());
mmap.put("processInstanceDetail",processInstanceDetail);
return prefix+"/checkDetail";
}
/**
* 完成任务
* @return
*/
@PostMapping("/finishTask")
@RequiresPermissions("ding:task:finishTask")
@ResponseBody
@RepeatSubmit
public AjaxResult finishTask(DingFinishTaskRequest finishTaskDTO)
{
SysUser sysUser = ShiroUtils.getSysUser();
finishTaskDTO.setUserId(sysUser.getDingUserId());
FlowExecuteTaskRequest flowExecuteTaskRequest=new FlowExecuteTaskRequest();
flowExecuteTaskRequest.setTaskId(Long.parseLong(finishTaskDTO.getTaskId()));
flowExecuteTaskRequest.setActionerUserid(sysUser.getDingUserId());
flowExecuteTaskRequest.setRemark(finishTaskDTO.getComment());
flowExecuteTaskRequest.setResult(finishTaskDTO.getIsPass()?"agree":"refuse");
flowExecuteTaskRequest.setProcessInstanceId(finishTaskDTO.getProcessInstanceId());
Boolean aBoolean = dingOfficialFlowService.executeProcessInstance(flowExecuteTaskRequest);
return AjaxResult.success(aBoolean);
}
/**
* 跳转我的已办
* @return
*/
@RequiresPermissions("ding:task:myTasked")
@GetMapping("/toMyTasked")
public String toMyTasked()
{
return prefix+"/myTasked";
}
/**
* 获取我办结的任务列表
* @param sysDingHiTask
* @return
*/
@RequiresPermissions("ding:task:myTasked")
@PostMapping("/getMyTaskedList")
@ResponseBody
public TableDataInfo getMyTaskedList(SysDingHiTask sysDingHiTask){
startPage();
SysUser sysUser = ShiroUtils.getSysUser();
sysDingHiTask.setAssignee(sysUser.getDingUserId());
sysDingHiTask.setTaskState(DingFlowTaskType.COMPLETED.getCode());
List<SysDingHiTask> list = sysDingHiTaskService.selectSysDingHiTaskList(sysDingHiTask);
return getDataTable(list);
}
/**
* 获取我的已办详情
* @param taskId
* @return
*/
@RequiresPermissions("ding:task:getTaskedDetail")
@GetMapping("/getTaskedDetail")
public String getTaskedDetail(String taskId,ModelMap mmap){
SysDingHiTask sysDingHiTask = sysDingHiTaskService.selectSysDingHiTaskById(taskId);
OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceDetail = dingOfficialFlowService.getProcessInstanceDetail(sysDingHiTask.getProcInstId());
//获取表单值
List<OapiProcessinstanceGetResponse.FormComponentValueVo> formComponentValues = processInstanceDetail.getFormComponentValues();
//获取任务节点
List<OapiProcessinstanceGetResponse.TaskTopVo> tasks = processInstanceDetail.getTasks();
DingTaskVO dingTaskVO=new DingTaskVO();
if(CollectionUtil.isNotEmpty(tasks)){
tasks.stream().filter(taskTopVo -> taskTopVo.getTaskid().equals(sysDingHiTask.getTaskId())).collect(Collectors.toList()).forEach(t->{
BeanUtil.copyProperties(t,dingTaskVO);
dingTaskVO.defaultTaskSpendTime();
SysUser sysUser = sysUserService.selectUserByDingUserId(t.getUserid());
dingTaskVO.setUserName(sysUser.getUserName());
dingTaskVO.setTaskStatus(DingFlowTaskType.getCode(t.getTaskStatus()).getInfo());
});
}
SysUser sysUser = sysUserService.selectUserByDingUserId(processInstanceDetail.getOriginatorUserid());
mmap.put("formComponentValues",formComponentValues);
mmap.put("tasks",dingTaskVO);
mmap.put("applyUserName",sysUser.getUserName());
mmap.put("processInstanceDetail",processInstanceDetail);
return prefix+"/myTaskedDetail";
}
}

View File

@ -1,19 +1,28 @@
package com.snow.web.controller.dingtalk;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.dingtalk.api.response.OapiProcessListbyuseridResponse;
import com.dingtalk.api.response.OapiProcessTemplateManageGetResponse;
import com.dingtalk.api.response.OapiProcessinstanceGetResponse;
import com.google.common.collect.Lists;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.PageDomain;
import com.snow.common.core.page.PageModel;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.core.page.TableSupport;
import com.snow.dingtalk.model.FlowExecuteTaskRequest;
import com.snow.dingtalk.model.FlowTerminateProcessInstanceRequest;
import com.snow.common.enums.DingFlowOperationType;
import com.snow.common.enums.DingFlowTaskType;
import com.snow.common.utils.DateUtils;
import com.snow.dingtalk.model.*;
import com.snow.dingtalk.service.impl.DingOfficialFlowServiceImpl;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysDingProcinst;
import com.snow.system.domain.SysDingRuTask;
import com.snow.system.domain.SysUser;
import com.snow.system.service.impl.SysDingProcinstServiceImpl;
import com.snow.system.service.impl.SysDingRuTaskServiceImpl;
import com.snow.system.service.impl.SysUserServiceImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -24,6 +33,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @program: snow
@ -40,8 +51,16 @@ public class OfficialFlowController extends BaseController {
@Autowired
private DingOfficialFlowServiceImpl dingOfficialFlowService;
@Autowired
private SysUserServiceImpl sysUserService;
@Autowired
private SysDingRuTaskServiceImpl sysDingRuTaskService;
@Autowired
private SysDingProcinstServiceImpl sysDingProcinstService;
/**
* 跳转钉钉官方流程模板
* 跳转钉钉当前用户可见的审批模板
* @return
*/
@RequiresPermissions("ding:officialFlow:getTemplateManageList")
@ -52,7 +71,7 @@ public class OfficialFlowController extends BaseController {
}
/**
* 获取钉钉官方流程模板
* 获取当前用户可见的审批模板
*/
@RequiresPermissions("ding:officialFlow:getTemplateManageList")
@PostMapping("/getProcessTemplateManageList")
@ -60,20 +79,49 @@ public class OfficialFlowController extends BaseController {
public TableDataInfo getProcessTemplateManageList()
{
SysUser sysUser = ShiroUtils.getSysUser();
List<OapiProcessTemplateManageGetResponse.ProcessSimpleVO> processTemplateManage = dingOfficialFlowService.getProcessTemplateManage(sysUser.getDingUserId());
return pageBySubList(processTemplateManage);
OapiProcessListbyuseridResponse.HomePageProcessTemplateVo homePageProcessTemplateVo = dingOfficialFlowService.getProcessListByUserId(sysUser.getDingUserId());
return pageBySubList(homePageProcessTemplateVo.getProcessList());
}
/**
* 跳转
* @param mmap
* 执行流程实例
* @param
* @return
*/
@RequiresPermissions("ding:officialFlow:getProcessListByUserId")
@GetMapping("/toProcessListByUserId")
public String toProcessListByUserId(ModelMap mmap){
return prefix+"/myDingTask";
@RequiresPermissions("ding:officialFlow:startProcessInstance")
@GetMapping("/startProcessInstance")
@ResponseBody
public AjaxResult startProcessInstance(){
SysUser sysUser = ShiroUtils.getSysUser();
StartFlowRequest startFlowRequest=new StartFlowRequest();
startFlowRequest.setProcessCode("PROC-DAF427F7-89E2-4496-9481-53FE56551E9F");
startFlowRequest.setOriginatorUserId(sysUser.getDingUserId());
startFlowRequest.setDeptId(sysUser.getDeptId());
List<StartFlowRequest.FormComponentValueVo> list=Lists.newArrayList();
StartFlowRequest.FormComponentValueVo formComponentValueVo=new StartFlowRequest.FormComponentValueVo();
formComponentValueVo.setName("商品编码");
formComponentValueVo.setValue("OA-SP10002");
list.add(formComponentValueVo);
StartFlowRequest.FormComponentValueVo formComponentValueVo0=new StartFlowRequest.FormComponentValueVo();
formComponentValueVo0.setName("商品名称");
formComponentValueVo0.setValue("测试商品");
list.add(formComponentValueVo0);
StartFlowRequest.FormComponentValueVo formComponentValueVo1=new StartFlowRequest.FormComponentValueVo();
formComponentValueVo1.setName("规格");
formComponentValueVo1.setValue("OO--XX");
list.add(formComponentValueVo1);
StartFlowRequest.FormComponentValueVo formComponentValueVo2=new StartFlowRequest.FormComponentValueVo();
formComponentValueVo2.setName("审核日期");
formComponentValueVo2.setValue(DateUtils.getDate());
list.add(formComponentValueVo2);
StartFlowRequest.FormComponentValueVo formComponentValueVo3=new StartFlowRequest.FormComponentValueVo();
formComponentValueVo3.setName("备注说明");
formComponentValueVo3.setValue("nova 8系列 我由我掌镜。nova 8 Pro前置Vlog视频双镜头66W超级快充120Hz环幕屏。");
list.add(formComponentValueVo3);
startFlowRequest.setFormComponentValueVoList(list);
String s = dingOfficialFlowService.startProcessInstance(startFlowRequest);
return AjaxResult.success(s);
}
/**
@ -84,7 +132,6 @@ public class OfficialFlowController extends BaseController {
@PostMapping("/getProcessListByUserId")
@ResponseBody
public TableDataInfo getProcessListByUserId(){
PageDomain pageDomain = TableSupport.buildPageRequest();
SysUser sysUser = ShiroUtils.getSysUser();
OapiProcessListbyuseridResponse.HomePageProcessTemplateVo processListByUserId = dingOfficialFlowService.getProcessListByUserId(sysUser.getDingUserId());
return pageBySubList(processListByUserId.getProcessList());
@ -118,10 +165,49 @@ public class OfficialFlowController extends BaseController {
//获取表单值
List<OapiProcessinstanceGetResponse.FormComponentValueVo> formComponentValues = processInstanceDetail.getFormComponentValues();
mmap.put("formComponentValues",formComponentValues);
//获取操作记录
List<OapiProcessinstanceGetResponse.OperationRecordsVo> operationRecords = processInstanceDetail.getOperationRecords();
List<DingOperationRecordVO> dingOperationRecordVOList=Lists.newArrayList();
if(CollectionUtil.isNotEmpty(operationRecords)){
operationRecords.forEach(t->{
DingOperationRecordVO dingOperationRecordVO=new DingOperationRecordVO();
BeanUtil.copyProperties(t,dingOperationRecordVO);
SysUser sysUser = sysUserService.selectUserByDingUserId(t.getUserid());
dingOperationRecordVO.setUserName(sysUser.getUserName());
dingOperationRecordVO.setOperationType(DingFlowOperationType.getType(t.getOperationType()).getCode());
String operationResult = t.getOperationResult();
if(operationResult.equals("AGREE")){
dingOperationRecordVO.setOperationResult("同意");
}else if(operationResult.equals("REFUSE")){
dingOperationRecordVO.setOperationResult("拒绝");
}else if(operationResult.equals("NONE")){
dingOperationRecordVO.setOperationResult(null);
}
dingOperationRecordVOList.add(dingOperationRecordVO);
});
}
//获取任务节点
List<OapiProcessinstanceGetResponse.TaskTopVo> tasks = processInstanceDetail.getTasks();
List<DingTaskVO> dingTaskVOList=Lists.newArrayList();
if(CollectionUtil.isNotEmpty(tasks)){
tasks.stream().filter(t->!t.getTaskStatus().equals(DingFlowTaskType.CANCELED.getCode())).collect(Collectors.toList()).forEach(t->{
DingTaskVO dingTaskVO=new DingTaskVO();
BeanUtil.copyProperties(t,dingTaskVO);
dingTaskVO.defaultTaskSpendTime();
SysUser sysUser = sysUserService.selectUserByDingUserId(t.getUserid());
dingTaskVO.setUserName(sysUser.getUserName());
dingTaskVO.setTaskStatus(DingFlowTaskType.getCode(t.getTaskStatus()).getInfo());
dingTaskVO.defaultTaskSpendTime();
dingTaskVOList.add(dingTaskVO);
});
}
mmap.put("formComponentValues",formComponentValues);
mmap.put("operationRecords",dingOperationRecordVOList);
mmap.put("tasks",dingTaskVOList);
mmap.put("processInstanceDetail",processInstanceDetail);
return prefix+"/checkDetail";
return prefix+"/myStartProcessDetail";
}
/**
@ -139,4 +225,36 @@ public class OfficialFlowController extends BaseController {
return AjaxResult.success(aBoolean);
}
/**
* 跳转我发起的流程
* @return
*/
@RequiresPermissions("ding:flow:getMyStartProcess")
@GetMapping("/toMyStartProcess")
public String getMyHistoricProcessInstance()
{
return prefix+"/myStartProcess";
}
/**
* 获取我的流程实例
* @param sysDingProcinst
* @return
*/
@RequiresPermissions("ding:flow:getMyStartProcess")
@PostMapping("/getMyStartProcessList")
@ResponseBody
public TableDataInfo getMyStartProcessList(SysDingProcinst sysDingProcinst){
startPage();
SysUser sysUser = ShiroUtils.getSysUser();
sysDingProcinst.setStartUserId(sysUser.getDingUserId());
List<SysDingProcinst> list = sysDingProcinstService.selectSysDingProcinstList(sysDingProcinst);
return getDataTable(list);
}
}

View File

@ -159,7 +159,7 @@ public class SysProfileController extends BaseController
{
if (!file.isEmpty())
{
SysFile store = storageService.store(file.getInputStream(), file.getSize(), file.getContentType(), file.getOriginalFilename());
SysFile store = storageService.store(file);
currentUser.setAvatar(store.getUrl());
if (userService.updateUserInfo(currentUser) > 0)
{

View File

@ -1,24 +1,10 @@
Application Version: ${snow.version}
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////
0000000 0000000 000000 000 0000000000 000 000
000 000 000 00 000 000 000 000 000 000 000
00 000 000 00 000 000 000 000 000 000
00 000 000 000 00 0000 000 000 000 000
000 0000 000 0000 0000 000 000 000 000 000
000000 000 00000 00 000 000 000 000 000 000
00 000 00 000 000 000 00 000 000
000 000 00 00 00 00 000 000 0000 0000 000 000
0000000 00000000 00000000 000 000 0000000000 0000000000

View File

@ -41,6 +41,21 @@
$(".adduser ul").animate({marginTop:-'.5'*a+'rem'},800)
},4300);
})
function current(){
var d=new Date(),
str='';
str +=d.getFullYear()+'年';   //获取当前年份
str +=d.getMonth()+1+'月';   //获取当前月份0——11
str +=d.getDate()+'日';
str +=d.getHours()+'时';
str +=d.getMinutes()+'分';
str +=d.getSeconds()+'秒';
return str;
}
setInterval(function(){$("#nowTime").html(current)},1000);
</script>
<body>
<div class="loading">
@ -48,7 +63,7 @@
</div>
<div class="head">
<h1>Ding-Flow可视化大屏</h1>
<div class="weather"><img th:src="@{/images/weather.png}"><span>多云转小雨</span><span th:text="${date}"></span></div>
<div class="weather"><img th:src="@{/images/weather.png}"><span>多云转小雨</span><span id="nowTime"></span></div>
</div>
<div class="mainbox">
<ul class="clearfix">

View File

@ -0,0 +1,120 @@
<!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="businessKey"/>
</li>
<li>
<label>实例标题:</label>
<input type="text" name="title"/>
</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-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:procinst: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 getProcessDetail = [[${@permission.hasPermi('ding:officialFlow:getProcessDetail')}]];
var prefix = ctx + "ding/officialFlow";
var dingProcStatus = [[${@dict.getType('ding_proc_status')}]];
var dingProcResult = [[${@dict.getType('ding_proc_result')}]];
$(function() {
var options = {
url: prefix + "/getMyStartProcessList",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "钉钉流程实例",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'businessKey',
title: '业务参数'
},
{
field: 'title',
title: '实例标题'
},
{
field: 'startTime',
title: '流程开始时间'
},
{
field: 'finishTime',
title: '流程结束时间'
},
{
field: 'processSpendTime',
title: '流程用时'
},
{
field: 'type',
title: '流程状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(dingProcStatus, value);
}
},
{
field: 'procResult',
title: '审批结果',
formatter: function(value, row, index) {
return $.table.selectDictLabel(dingProcResult, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-info btn-xs ' + getProcessDetail + '" href="javascript:void(0)" onclick="getProcessDetails(\'' + row.procInstId + '\')"><i class="fa fa-eye"></i>详情</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
function getProcessDetails(processInstanceId) {
var preViewUrl=prefix+'/getProcessInstanceDetail?processInstanceId='+processInstanceId;
$.modal.openTab("详情", preViewUrl);
}
</script>
</body>
</html>

View File

@ -0,0 +1,156 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<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" >
<h4 style=" color:#6379bb;">
<div class="row ">
<div class="col-xs-6 col-sm-4">
<label class="control-label" >单号:</label>
<label style="font-size: xx-small" class="control-label" th:text="${processInstanceDetail.businessId}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >标题:</label>
<label class=" control-label" th:text="${processInstanceDetail.title}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >所在部门:</label>
<label class="c control-label" th:text="${processInstanceDetail.originatorDeptName}"/>
</div>
</div>
</h4>
<div class="ibox float-e-margins">
<h4 class="form-header h4">业务表单</h4>
<div class="row" th:each="form,iterStat : ${formComponentValues}">
<div class="form-group">
<label class="col-sm-3 control-label" th:text="${form.name}"></label>
<div class="col-sm-8">
<span class="form-control" th:text="${form.value}"/>
</div>
</div>
</div>
</div>
<div class="ibox float-e-margins">
<h4 class="form-header h4">操作记录</h4>
<div class="vertical-container light-timeline light-dark">
<div class="vertical-timeline-block" th:each="record,iterStat : ${operationRecords}">
<div class="vertical-timeline-icon navy-bg">
<i class="fa fa-tasks"></i>
</div>
<div class="vertical-timeline-content ">
<!-- <h2 th:text="${record.taskName }"></h2>-->
<br class="form-group">
<div class="row">
<div class="col-md-4" th:if="${record.operationType} != ''">
<label >操作类型:</label>
<span th:text="${record.operationType}"></span>
</div>
<div class="col-md-4" th:if="${record.userid} != null">
<label >操作人:</label>
<span th:text="${record.userName}"></span>
</div>
<div class="col-md-4" th:if="${record.operationResult} != ''">
<label >操作结果:</label>
<span th:text="${record.operationResult}"></span>
</div>
</div>
</br>
<div class="row" >
<div class="col-md-12" th:if="${record.remark} != null">
<label>操作评论:</label>
<label>
<span th:text="${record.remark}"></span>
</label>
</div>
</div>
</br>
<div class="row">
<div class="col-md-12">
<span class="vertical-date">
<label>操作时间:</label> <small th:text="${#dates.format(record.date, 'yyyy-MM-dd HH:mm:ss')}"></small>
</span>
</div>
</div>
</br>
</div>
</div>
</div>
</div>
<div class="ibox float-e-margins form-horizontal">
<h4 class="form-header h4">审批节点</h4>
<div id="ibox-content">
<div id="vertical-timeline" class="vertical-container light-timeline light-dark">
<div class="vertical-timeline-block" th:each="task,iterStat : ${tasks}">
<div class="vertical-timeline-icon navy-bg">
<i class="fa fa-tasks"></i>
</div>
<div class="vertical-timeline-content ">
<h2 th:text="${task.activityId }"></h2>
<br class="form-group">
<div class="row">
<div class="col-md-4" th:if="${task.taskResult} == ''">
<label >审批结果:</label>
<span th:text="${task.taskResult}"></span>
</div>
<div class="col-md-4" th:if="${task.taskStatus} != ''">
<label >状态:</label>
<span th:text="${task.taskStatus}"></span>
</div>
<div class="col-md-4" th:if="${task.userid} != null">
<label >审批人:</label>
<span th:text="${task.userName}"></span>
</div>
<!-- <div class="col-md-4" th:if="${task.handleTaskTime} != null">
<label>任务历时:</label>
<label>
<span th:text="${task.handleTaskTime}"></span>
</label>
</div>-->
</div>
</br>
<div class="row">
<div class="col-md-12">
<span class="vertical-date">
<label>任务时间:</label> <small th:text="${#dates.format(task.createTime, 'yyyy-MM-dd HH:mm:ss')}"></small>
<label>~</label> <small th:text="${#dates.format(task.finishTime, 'yyyy-MM-dd HH:mm:ss')}"></small>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
/*
$(function () {
var processInstanceId= $("#processInstanceId").val();
var url ="/modeler/getProcessDiagram?processInstanceId="+processInstanceId;
$(".imgcode").attr("src", url);
});
function getProcessDiagram() {
var appId= $("#appId").val();
var busVarUrl= $("#busVarUrl").val();
$.modal.open('业务单', busVarUrl+"/"+appId);
}*/
</script>
</body>
</html>

View File

@ -16,18 +16,10 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="system:resign:add">
<i class="fa fa-plus"></i> 添加
</a>
<!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:resign:edit">
<i class="fa fa-edit"></i> 修改
</a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:resign:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:resign:export">
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:resign:export">
<i class="fa fa-download"></i> 导出
</a>
</a>-->
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -36,11 +28,6 @@
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:resign:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:resign:remove')}]];
var detailFlag = [[${@permission.hasPermi('system:resign:detail')}]];
var resignTypeDatas = [[${@dict.getType('sys_resign_type')}]];
var processStatusDatas = [[${@dict.getType('process_status')}]];
var prefix ="/ding/officialFlow";
$(function() {
@ -88,25 +75,6 @@
formatter: function(value, row, index) {
return $.table.changeDateFormat(value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
/*if(row.processStatus!=0) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="printPur(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> ');
}*/
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a> ');
if(row.processStatus==0) {
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('');
}
}]
};
$.table.init(options);

View File

@ -0,0 +1,126 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增钉钉运行任务')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-task-add">
<div class="form-group">
<label class="col-sm-3 control-label">版本号:</label>
<div class="col-sm-8">
<input name="rev" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">流程实例id</label>
<div class="col-sm-8">
<input name="procInstId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">钉钉流程code</label>
<div class="col-sm-8">
<input name="procCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">活动id</label>
<div class="col-sm-8">
<input name="activityId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务名称:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">父任务id</label>
<div class="col-sm-8">
<input name="parentTaskId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<textarea name="description" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务定义key</label>
<div class="col-sm-8">
<input name="taskDefKey" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">待办人:</label>
<div class="col-sm-8">
<input name="assignee" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">结束时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="finishTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务状态:</label>
<div class="col-sm-8">
<input name="taskState" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">分类:</label>
<div class="col-sm-8">
<input name="category" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务挂起状态:</label>
<div class="col-sm-8">
<input name="suspensionState" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租户id</label>
<div class="col-sm-8">
<input name="tenantId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">外部表单key</label>
<div class="col-sm-8">
<input name="formKey" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/task"
$("#form-task-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-task-add').serialize());
}
}
$("input[name='finishTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -12,30 +12,57 @@
</head>
<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.resignNo}"/>-->
<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 name="id" th:value="${appFrom.id}" type="hidden">-->
<br/>
<h2 class="form-header h2" >离职审批信息</h2>
<h2 class="form-header h2" >审批信息</h2>
<div class="row" th:each="form,iterStat : ${formComponentValues}">
<div class="col-xs-6 col-sm-8 col-md-offset-1">
<label th:text="${form.name}"></label>
<span th:text="${form.value}"/>
<div class="form-group">
<label class="col-sm-3 control-label" th:text="${form.name}"></label>
<div class="col-sm-8">
<span class="form-control" th:text="${form.value}"/>
</div>
</div>
</div>
<br/>
<th:block th:include="include :: approvalpage" />
<!--审批页-->
<div th:fragment="approvalpage">
<h4 class="form-header h4">填写信息</h4>
<div class="form-group">
<label class="col-sm-3 control-label">审批结果:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('process_check_status')}">
<input type="radio" th:id="${dict.dictCode}" name="isPass" th:value="${dict.dictValue}" required>
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">审批意见:</label>
<div class="col-sm-8">
<textarea name="comment" class="form-control"></textarea>
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-3 control-label">审批附件:</label>
<div class="col-sm-8">
<div class="file-loading">
<input class="form-control file-upload" id="files" name="file" type="file" multiple>
</div>
</div>
</div>-->
<div class="form-group">
<div class="col-sm-offset-6 col-sm-10">
<button type="button" class="btn btn-sm btn-success" onclick="submitCheckHandler()"><i class="fa fa-check"></i>提 交</button>&nbsp;
</div>
</div>
</div>
</form>
<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();
@ -73,7 +100,7 @@
}
}
console.log(data);
$.operate.saveTab("/flow/finishTask", data);
$.operate.saveTab("/ding/task/finishTask", data);
}
}
</script>

View File

@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改钉钉运行任务')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-task-edit" th:object="${sysDingRuTask}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">版本号:</label>
<div class="col-sm-8">
<input name="rev" th:field="*{rev}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">流程实例id</label>
<div class="col-sm-8">
<input name="procInstId" th:field="*{procInstId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">钉钉流程code</label>
<div class="col-sm-8">
<input name="procCode" th:field="*{procCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">活动id</label>
<div class="col-sm-8">
<input name="activityId" th:field="*{activityId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务名称:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">父任务id</label>
<div class="col-sm-8">
<input name="parentTaskId" th:field="*{parentTaskId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<textarea name="description" class="form-control">[[*{description}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务定义key</label>
<div class="col-sm-8">
<input name="taskDefKey" th:field="*{taskDefKey}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">待办人:</label>
<div class="col-sm-8">
<input name="assignee" th:field="*{assignee}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">结束时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="finishTime" th:value="${#dates.format(sysDingRuTask.finishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务状态:</label>
<div class="col-sm-8">
<input name="taskState" th:field="*{taskState}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">分类:</label>
<div class="col-sm-8">
<input name="category" th:field="*{category}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务挂起状态:</label>
<div class="col-sm-8">
<input name="suspensionState" th:field="*{suspensionState}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租户id</label>
<div class="col-sm-8">
<input name="tenantId" th:field="*{tenantId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">外部表单key</label>
<div class="col-sm-8">
<input name="formKey" th:field="*{formKey}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/task";
$("#form-task-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-task-edit').serialize());
}
}
$("input[name='finishTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,115 @@
<!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>流程code</label>
<input type="text" name="procCode"/>
</li>
<li>
<label>名称:</label>
<input type="text" name="name"/>
</li>
<li>
<label>任务结果:</label>
<input type="text" name="taskResult"/>
</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="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 getTaskedDetail = [[${@permission.hasPermi('ding:task:getTaskedDetail')}]];
var prefix = "/ding/task";
var dingTaskResult = [[${@dict.getType('ding_task_result')}]];
$(function() {
var options = {
url: prefix + "/getMyTaskedList",
modalName: "我的已办",
columns: [{
checkbox: true
},
{
field: 'id',
title: '',
visible: false
},
{
field: 'sysDingProcinst.title',
title: '流程名称'
},
{
field: 'sysDingProcinst.startUserName',
title: '流程发起人'
},
{
field: 'sysDingProcinst.startTime',
title: '流程发起时间'
},
{
field: 'taskResult',
title: '任务结果',
formatter: function (value, row, index) {
return $.table.selectDictLabel(dingTaskResult, value);
}
},
{
field: 'createTime',
title: '任务创建时间'
},
{
field: 'finishTime',
title: '任务结束时间'
},
{
field: 'taskSpendTime',
title: '任务历时'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + getTaskedDetail + '" href="javascript:void(0)" onclick="taskedDetail(\''+row.id+'\')"><i class="fa fa-eye"></i>详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
function taskedDetail(taskId) {
var preViewUrl=prefix+'/getTaskedDetail?taskId='+taskId;
$.modal.openTab("详情", preViewUrl);
}
</script>
</body>
</html>

View File

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" />
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet" />
<!-- bootstrap-table 表格插件样式 -->
<link th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
<link th:href="@{/css/animate.css}" rel="stylesheet" />
<link th:href="@{/css/style.css}" rel="stylesheet" />
<link th:href="@{/ruoyi/css/ry-ui.css}" rel="stylesheet" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg" >
<form class="form-horizontal m-t" >
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<h3 class="text-center" style="color:#6379bb " th:text="${processInstanceDetail.title}"></h3>
<div class="ibox float-e-margins">
<h2 class="form-header h2" >流程信息</h2>
<div class="row">
<div class="col-xs-1 col-sm-1"></div>
<div class="col-xs-5 col-sm-3">
<label class="control-label" >业务编号:</label>
<label style="font-size: x-small" class="control-label" th:text="${processInstanceDetail.businessId}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >申请人:</label>
<label class=" control-label" th:text="${applyUserName}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >所在部门:</label>
<label class="c control-label" th:text="${processInstanceDetail.originatorDeptName}"/>
</div>
</div>
<br/>
<div class="row ">
<div class="col-xs-1 col-sm-1"></div>
<div class="col-xs-5 col-sm-3">
<label class="control-label" >流程状态:</label>
<label class="c control-label" th:text="${@dict.getLabel('ding_proc_status', processInstanceDetail.status)}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >流程结果:</label>
<label style="font-size: x-small" class="control-label" th:text="${@dict.getLabel('ding_proc_result', processInstanceDetail.result)}"/>
</div>
</div>
<br/>
</div>
<div class="ibox float-e-margins">
<h2 class="form-header h2" >表单信息</h2>
<div class="row" th:each="form,iterStat : ${formComponentValues}">
<div class="form-group">
<label class="col-sm-3 control-label" th:text="${form.name}"></label>
<div class="col-sm-8">
<span class="form-control" th:text="${form.value}"/>
</div>
</div>
</div>
</div>
<div class="ibox float-e-margins">
<h4 class="form-header h4">任务信息</h4>
<div class="row">
<div class="col-xs-1 col-sm-1"></div>
<div class="col-xs-5 col-sm-3">
<label class="control-label" >任务编号:</label>
<label style="font-size: x-small" class="control-label" th:text="${tasks.taskid}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >创建时间:</label>
<label class=" control-label" th:text="${#dates.format(tasks.createTime, 'yyyy-MM-dd HH:mm:ss')}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >完成时间:</label>
<label class="control-label" th:text="${#dates.format(tasks.finishTime, 'yyyy-MM-dd HH:mm:ss')}"/>
</div>
</div>
<br/>
<div class="row ">
<div class="col-xs-1 col-sm-1"></div>
<div class="col-xs-5 col-sm-3">
<label class="control-label" >任务结果:</label>
<label class="control-label" th:text="${@dict.getLabel('ding_task_result', tasks.taskResult)}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >任务状态:</label>
<label class="control-label" th:text="${@dict.getLabel('ding_task_status', tasks.taskStatus)}"/>
</div>
<div class="col-xs-6 col-sm-4">
<label class="control-label" >任务用时:</label>
<label class=" control-label" th:text="${tasks.taskSpendTime}"/>
</div>
</div>
<br/>
</div>
</div>
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,138 @@
<!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>流程实例id</label>
<input type="text" name="procInstId"/>
</li>-->
<li>
<label>code</label>
<input type="text" name="procCode"/>
</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="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 todoList = [[${@permission.hasPermi('ding:task:todoList')}]];
var prefix = ctx + "ding/task";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "钉钉运行任务",
columns: [{
checkbox: true
},
{
field: 'id',
title: '任务id',
visible: false
},
/*{
field: 'sysDingProcinst.businessKey',
title: '业务id'
},*/ {
field: 'procCode',
title: '流程code',
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
field: 'sysDingProcinst.title',
title: '流程名称'
},
{
field: 'sysDingProcinst.startUserName',
title: '流程发起人'
},
{
field: 'sysDingProcinst.startTime',
title: '流程发起时间'
},
{
field: 'createTime',
title: '任务创建时间'
},
{
field: 'createTime',
title: '任务已用时',
formatter: function(value, row, index) {
run(value);
return '<label class="success" style="color: red" id="spendTime" ></label>'
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + todoList + '" href="javascript:void(0)" onclick="cancelTask(\''+row.id+'\')"><i class="fa fa-edit"></i>处理</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
function cancelTask(taskId) {
var preViewUrl=prefix+'/toFinishTask?taskId='+taskId;
$.modal.openTab("审批", preViewUrl);
}
//定时器
function run(enddate){
//如果enddate为后台传入的Date类型这里直接转化为毫秒数
enddate=new Date(enddate).getTime();
//以500毫秒的速度执行可以避免方法执行速度慢会影响展示效果的情况0
var time = 500;
setInterval("dateDif('"+enddate+"')",time);
}
//计算时间相差
function dateDif(enddate){
var date = new Date().getTime()-enddate;
var days = date / 1000 / 60 / 60 / 24;
var daysRound = Math.floor(days);
var hours = date/ 1000 / 60 / 60 - (24 * daysRound);
var hoursRound = Math.floor(hours);
var minutes = date / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
var minutesRound = Math.floor(minutes);
var seconds = date/ 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
var secondsRound = Math.floor(seconds);
var time = (daysRound+"天"+hoursRound +"时"+minutesRound+"分"+secondsRound+"秒");
$("#spendTime").text(time);
}
</script>
</body>
</html>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -87,6 +87,32 @@ public class Constants
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/**
* 本地文件上传key
*/
public static final String LOCAL_ADDRESS = "sys.local.file.address";
/**
* 阿里云accessKeyId
*/
public static final String ALIYUN_ACCESSKEYID = "sys.aliyun.file.accessKeyId";
/**
* 阿里云accessKeySecret
*/
public static final String ALIYUN_ACCESSKEYSECRET = "sys.aliyun.file.accessKeySecret";
/**
* 阿里云bucketName
*/
public static final String ALIYUN_BUCKETNAME= "sys.aliyun.file.bucketName";
/**
* 阿里云endpoint
*/
public static final String ALIYUN_ENDPOINT = "sys.aliyun.file.endpoint";
/**
* 资源映射路径 前缀
*/

View File

@ -0,0 +1,50 @@
package com.snow.common.enums;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-24 16:17
**/
public enum DingFlowOperationType {
EXECUTE_TASK_NORMAL("正常执行任务", "EXECUTE_TASK_NORMAL"),
EXECUTE_TASK_AGENT("代理人执行任务", "EXECUTE_TASK_AGENT"),
APPEND_TASK_BEFORE("前加签任务", "APPEND_TASK_BEFORE"),
APPEND_TASK_AFTER("后加签任务", "APPEND_TASK_AFTER"),
REDIRECT_TASK("转交任务", "REDIRECT_TASK"),
START_PROCESS_INSTANCE("发起流程实例", "START_PROCESS_INSTANCE"),
TERMINATE_PROCESS_INSTANCE("终止(撤销)流程实例", "TERMINATE_PROCESS_INSTANCE"),
FINISH_PROCESS_INSTANCE("结束流程实例", "FINISH_PROCESS_INSTANCE"),
ADD_REMARK("添加评论", "ADD_REMARK"),
REDIRECT_PROCESS("审批退回", "redirect_process");
private final String code;
private final String info;
DingFlowOperationType(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
public static DingFlowOperationType getType(String info) {
for (DingFlowOperationType dingFLowOperationType:DingFlowOperationType.values()){
if(dingFLowOperationType.getInfo().equals(info)){
return dingFLowOperationType;
}
}
return null;
}
}

View File

@ -0,0 +1,54 @@
package com.snow.common.enums;
/**
* @program: snow
* @description 钉钉任务类型
* @author: 没用的阿吉
* @create: 2021-03-24 16:17
**/
public enum DingFlowTaskType {
NEW("NEW", "未启动"),
RUNNING("RUNNING", "待处理"),
PAUSED("PAUSED", "暂停"),
CANCELED("CANCELED", "取消"),
COMPLETED("COMPLETED", "完成"),
TERMINATED("TERMINATED", "终止");
private final String code;
private final String info;
DingFlowTaskType(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
public static DingFlowTaskType getType(String info) {
for (DingFlowTaskType dingFLowOperationType:DingFlowTaskType.values()){
if(dingFLowOperationType.getInfo().equals(info)){
return dingFLowOperationType;
}
}
return null;
}
public static DingFlowTaskType getCode(String code) {
for (DingFlowTaskType dingFLowOperationType:DingFlowTaskType.values()){
if(dingFLowOperationType.getCode().equals(code)){
return dingFLowOperationType;
}
}
return null;
}
}

View File

@ -17,6 +17,8 @@ public enum DingTalkListenerType {
USER_DELETE(3,1,"user_leave_org"),
CALL_BACK_CHECK_URL(1,10, "check_url"),
CALL_BACK_REGISTER(1,10, "回调注册"),
CALL_BACK_UPDATE(2,10, "回调更新"),
@ -35,13 +37,13 @@ public enum DingTalkListenerType {
/**
* 审批任务开始结束转交
*/
BPMS_TASK_CHANGE(5,20,"bpms_instance_change"),
BPMS_TASK_CHANGE(5,20,"bpms_task_change"),
/**
*
* 审批实例开始结束
*/
BPMS_INSTANCE_CHANGE(5,20,"bpms_instance_change"),
BPMS_INSTANCE_CHANGE(6,20,"bpms_instance_change"),
ASYNCSEND_V2(10,20,"发送钉钉消息"),

View File

@ -0,0 +1,64 @@
package com.snow.common.enums;
/**
* @author qimingjin
* @Title: 表单组件类型
* @Description:
* @date 2020/9/18 10:18
*/
public enum FormComponentType {
TEXT_FIELD(1, "inputDom","TextField"),
TEXTAREA_FIELD(2, "textareaDom","TextareaField"),
DDDATE_FIELD(3, "dateDom","DDDateField"),
;
/**WORK_RECODE_CREATE
* 一级code
*/
private final Integer code;
/**
* 系统类型
*/
private final String sysType;
/**
* 钉钉类型
*/
private final String dingType;
FormComponentType(Integer code, String sysType, String dingType)
{
this.code = code;
this.sysType = sysType;
this.dingType=dingType;
}
public Integer getCode()
{
return code;
}
public String getSysType()
{
return sysType;
}
public String getDingType() {
return dingType;
}
public static FormComponentType getType(String sysType) {
for (FormComponentType formComponentType:FormComponentType.values()){
if(formComponentType.getSysType().equals(sysType)){
return formComponentType;
}
}
return null;
}
}

View File

@ -9,7 +9,7 @@ public class FileNameLengthLimitExceededException extends FileException
{
private static final long serialVersionUID = 1L;
public FileNameLengthLimitExceededException(int defaultFileNameLength)
public FileNameLengthLimitExceededException(long defaultFileNameLength)
{
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
}

View File

@ -158,4 +158,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
// long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟";
}
}

View File

@ -3,6 +3,7 @@ package com.snow.common.utils.file;
import java.io.File;
import java.io.IOException;
import cn.hutool.core.util.IdUtil;
import com.snow.common.config.Global;
import com.snow.common.constant.Constants;
import com.snow.common.exception.file.FileNameLengthLimitExceededException;
@ -36,6 +37,7 @@ public class FileUploadUtils
*/
private static String defaultBaseDir = Global.getProfile();
public static void setDefaultBaseDir(String defaultBaseDir)
{
FileUploadUtils.defaultBaseDir = defaultBaseDir;
@ -75,12 +77,9 @@ public class FileUploadUtils
*/
public static final String upload(String baseDir, MultipartFile file) throws IOException
{
try
{
try {
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
}
catch (Exception e)
{
} catch (Exception e) {
throw new IOException(e.getMessage(), e);
}
}
@ -98,20 +97,18 @@ public class FileUploadUtils
* @throws InvalidExtensionException 文件校验异常
*/
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException
{
int fileNamelength = file.getOriginalFilename().length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
{
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, InvalidExtensionException {
int fileNameLength = file.getOriginalFilename().length();
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
//文件大小和格式校验
assertAllowed(file, allowedExtension);
//编码文件名字
String fileName = extractFilename(file);
//创建file文件
File desc = getAbsoluteFile(baseDir, fileName);
//上传文件写到服务器上指定的文件
file.transferTo(desc);
String pathFileName = getPathFileName(baseDir, fileName);
return pathFileName;
@ -124,33 +121,40 @@ public class FileUploadUtils
{
String fileName = file.getOriginalFilename();
String extension = getExtension(file);
fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
fileName = DateUtils.datePath() + "/" + IdUtil.fastSimpleUUID() + "." + extension;
return fileName;
}
/**
* 创建File文件
* @param uploadDir
* @param fileName
* @return
* @throws IOException
*/
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
{
File desc = new File(uploadDir + File.separator + fileName);
if (!desc.getParentFile().exists())
{
desc.getParentFile().mkdirs();
}
if (!desc.exists())
{
desc.createNewFile();
if (!desc.getParentFile().exists())
{
desc.getParentFile().mkdirs();
}
}
return desc;
}
private static final String getPathFileName(String uploadDir, String fileName) throws IOException
{
int dirLastIndex = Global.getProfile().length() + 1;
int dirLastIndex = defaultBaseDir.length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
return pathFileName;
}
/**
* 文件大小校验
*
@ -159,40 +163,28 @@ public class FileUploadUtils
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws InvalidExtensionException
*/
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException
{
public static final void assertAllowed(MultipartFile file, String[] allowedExtension) throws InvalidExtensionException {
long size = file.getSize();
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE)
{
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) {
throw new FileNameLengthLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
String fileName = file.getOriginalFilename();
String extension = getExtension(file);
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
{
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
{
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
fileName);
}
else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
{
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
fileName);
}
else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
{
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
fileName);
}
else
{
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, fileName);
} else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, fileName);
} else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, fileName);
} else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
throw new InvalidExtensionException(allowedExtension, extension, fileName);
} else {
throw new InvalidExtensionException(allowedExtension, extension, fileName);
}
}
}
/**
@ -216,7 +208,7 @@ public class FileUploadUtils
/**
* 获取文件名的后缀
*
*
* @param file 表单文件
* @return 后缀名
*/

View File

@ -16,7 +16,7 @@ public class MimeTypeUtils
public static final String IMAGE_BMP = "image/bmp";
public static final String IMAGE_GIF = "image/gif";
public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
public static final String[] FLASH_EXTENSION = { "swf", "flv" };
@ -24,6 +24,8 @@ public class MimeTypeUtils
public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
"asf", "rm", "rmvb" };
public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" };
public static final String[] DEFAULT_ALLOWED_EXTENSION = {
// 图片
"bmp", "gif", "jpg", "jpeg", "png",
@ -31,6 +33,8 @@ public class MimeTypeUtils
"doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
// 压缩文件
"rar", "zip", "gz", "bz2",
// 视频格式
"mp4", "avi", "rmvb",
// pdf
"pdf" };

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -17,7 +17,6 @@
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-framework</artifactId>
<version>${snow.version}</version>
</dependency>
<dependency>
<groupId>com.taobao.top</groupId>

View File

@ -108,11 +108,18 @@ public class BaseConstantUrl {
* 钉钉官方流程
* *********************************************************/
public static final String SAVE_PROCESS="https://oapi.dingtalk.com/topapi/process/save";
/**
* 获取当前企业所有可管理的模版
*/
public static final String GET_PROCESS_TEMPLATE_MANAGE="https://oapi.dingtalk.com/topapi/process/template/manage/get";
/**
* 发起流程实例
*/
public static final String START_PROCESS_INSTANCE="https://oapi.dingtalk.com/topapi/processinstance/create";
/**
* 执行流程
*/

View File

@ -0,0 +1,62 @@
package com.snow.dingtalk.model;
import lombok.Data;
import java.io.Serializable;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-25 20:52
**/
@Data
public class DingFinishTaskRequest implements Serializable {
private static final long serialVersionUID = 4115040416030667805L;
/**
* 流程实例id
*/
private String processInstanceId;
/**
* 任务ID
*/
private String taskId;
/**
* 完成任务人
*/
private String userId;
/**
* 是否通过
*/
private Boolean isPass;
/**
* 是否通过
*/
private Boolean isStart;
/**
* 审批意见
*/
private String comment;
/**
* 是否修改业务参数
*/
private Boolean isUpdateBus=false;
public final static String IS_PASS="isPass";
public final static String IS_START="isStart";
public final static String FILES="files";
public final static String COMMENT="comment";
}

View File

@ -0,0 +1,67 @@
package com.snow.dingtalk.model;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-24 15:45
**/
@Data
public class DingOperationRecordVO implements Serializable {
private static final long serialVersionUID = -281729978382670599L;
/**
* AGREE同意
*
* REFUSE拒绝
*
* NONE
*/
private String operationResult;
/**
* EXECUTE_TASK_NORMAL正常执行任务
*
* EXECUTE_TASK_AGENT代理人执行任务
*
* APPEND_TASK_BEFORE前加签任务
*
* APPEND_TASK_AFTER后加签任务
*
* REDIRECT_TASK转交任务
*
* START_PROCESS_INSTANCE发起流程实例
*
* TERMINATE_PROCESS_INSTANCE终止(撤销)流程实例
*
* FINISH_PROCESS_INSTANCE结束流程实例
*
* ADD_REMARK添加评论
*
* redirect_process审批退回
*/
private String operationType;
/**
* 备注
*/
private String remark;
/**
* 操作人钉钉id
*/
private String userid;
private String userName;
/**
* 操作时间
*/
private Date date;
}

View File

@ -0,0 +1,67 @@
package com.snow.dingtalk.model;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.utils.StringUtils;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-26 16:21
**/
@Data
public class DingTaskVO implements Serializable {
private static final long serialVersionUID = -1459137869980975766L;
private String activityId;
private Date createTime;
private Date finishTime;
private String taskResult;
private String taskStatus;
/**
* 任务id
*/
private String taskid;
private String url;
/**
* 用户id
*/
private String userid;
/**
* 用户名称
*/
private String userName;
/**
* 任务花费时间
*/
private String taskSpendTime;
/**
* 任务花费时间赋值
* @return
*/
public String defaultTaskSpendTime() {
if(StringUtils.isNotNull(finishTime)){
setTaskSpendTime(DateUtil.formatBetween(createTime, finishTime, BetweenFormater.Level.SECOND));
}
return taskSpendTime;
}
}

View File

@ -0,0 +1,108 @@
package com.snow.dingtalk.model;
import com.dingtalk.api.request.OapiProcessSaveRequest;
import com.snow.common.enums.FormComponentType;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-21 19:40
**/
@Data
public class SaveFlowRequest implements Serializable {
private static final long serialVersionUID = -7038720879277547731L;
private String createInstanceMobileUrl;
private String createInstancePcUrl;
private String description;
private String dirId;
private Boolean disableFormEdit;
private Boolean disableStopProcessButton;
private Boolean fakeMode;
private List<FormComponentVo> formComponentList;
private Boolean hidden;
private String icon;
private String name;
private String originDirId;
private String processCode;
// private OapiProcessSaveRequest.ProcessConfig processConfig;
private String templateEditUrl;
private FormComponentType formComponentType;
@Data
public static class FormComponentVo implements Serializable {
private static final long serialVersionUID = -1887336939225262377L;
private String componentName;
private FormComponentPropVo props;
}
@Data
public static class FormComponentPropVo implements Serializable{
private static final long serialVersionUID = 6244866646550769755L;
private String actionName;
private String bizAlias;
private String bizType;
private Long choice;
private String content;
private Boolean duration;
private String format;
private String formula;
private String id;
private String label;
private String link;
private String notPrint;
private String notUpper;
private List<String> options;
private String placeholder;
private Boolean required;
private String unit;
}
}

View File

@ -0,0 +1,51 @@
package com.snow.dingtalk.model;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-23 13:36
**/
@Data
public class StartFlowRequest implements Serializable {
private static final long serialVersionUID = 792885986454419385L;
/**
* 发起人所在的部门如果发起人属于根部门-1
*/
private Long deptId;
/**
* 审批实例发起人的userid
*/
private String originatorUserId;
/**
* 审批流的唯一码
*
* process_code在审批流程编辑页面的URL中获取
*/
private String processCode;
private List<FormComponentValueVo> formComponentValueVoList;
@Data
public static class FormComponentValueVo implements Serializable{
private static final long serialVersionUID = 7297240924226083327L;
private String extValue;
private String name;
private String value;
}
}

View File

@ -7,6 +7,8 @@ import com.snow.common.core.page.PageDomain;
import com.snow.common.core.page.PageModel;
import com.snow.dingtalk.model.FlowExecuteTaskRequest;
import com.snow.dingtalk.model.FlowTerminateProcessInstanceRequest;
import com.snow.dingtalk.model.SaveFlowRequest;
import com.snow.dingtalk.model.StartFlowRequest;
import java.util.List;
@ -18,6 +20,19 @@ import java.util.List;
**/
public interface DingOfficialFlowService {
/**
* 创建审批模板
* @param saveFlowRequest
* @return
*/
String saveProcess(SaveFlowRequest saveFlowRequest);
/**
* 发起审批实例
* @return
*/
String startProcessInstance(StartFlowRequest startFlowRequest);
/**
* 获取当前企业所有可管理的模版
* @param userId
@ -54,4 +69,12 @@ public interface DingOfficialFlowService {
* @return
*/
Boolean terminateProcessInstance(FlowTerminateProcessInstanceRequest flowTerminateProcessInstanceRequest);
void bpmsInstanceChange();
void bpmsTaskChange();
}

View File

@ -5,14 +5,19 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.*;
import com.dingtalk.api.response.*;
import com.snow.common.constant.Constants;
import com.snow.common.exception.SyncDataException;
import com.snow.common.utils.StringUtils;
import com.snow.common.utils.bean.BeanUtils;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.dingtalk.common.BaseConstantUrl;
import com.snow.dingtalk.common.BaseService;
import com.snow.dingtalk.model.FlowExecuteTaskRequest;
import com.snow.dingtalk.model.FlowTerminateProcessInstanceRequest;
import com.snow.dingtalk.model.SaveFlowRequest;
import com.snow.dingtalk.model.StartFlowRequest;
import com.snow.dingtalk.service.DingOfficialFlowService;
import com.snow.system.service.impl.SysConfigServiceImpl;
import com.taobao.api.ApiException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -29,6 +34,106 @@ import java.util.List;
@Service
public class DingOfficialFlowServiceImpl extends BaseService implements DingOfficialFlowService {
private SysConfigServiceImpl isysConfigService=SpringUtils.getBean(SysConfigServiceImpl.class);
@Override
public String saveProcess(SaveFlowRequest saveFlowRequest) {
DingTalkClient client = new DefaultDingTalkClient(BaseConstantUrl.SAVE_PROCESS);
OapiProcessSaveRequest request = new OapiProcessSaveRequest();
OapiProcessSaveRequest.SaveProcessRequest saveProcessRequest = new OapiProcessSaveRequest.SaveProcessRequest();
// saveProcessRequest.setDisableFormEdit(true);
saveProcessRequest.setName(saveFlowRequest.getName());
saveProcessRequest.setProcessCode(saveProcessRequest.getProcessCode());
saveProcessRequest.setAgentid(Long.parseLong(isysConfigService.selectConfigByKey(Constants.AGENT_ID)));
saveProcessRequest.setFakeMode(true);
// List<OapiProcessSaveRequest.FormComponentVo> formComponentList = new ArrayList<>();
// 注意每种表单组件对应的componentName是固定的
List<OapiProcessSaveRequest.FormComponentVo> formComponentList = BeanUtils.transformList(saveFlowRequest.getFormComponentList(), OapiProcessSaveRequest.FormComponentVo.class);
/*if(formComponentType.getDingType().equals(FormComponentType.TEXT_FIELD.getDingType())){
// 单行文本框
OapiProcessSaveRequest.FormComponentVo singleInput = new OapiProcessSaveRequest.FormComponentVo();
singleInput.setComponentName(FormComponentType.TEXT_FIELD.getDingType());
OapiProcessSaveRequest.FormComponentPropVo singleInputProp = new OapiProcessSaveRequest.FormComponentPropVo();
singleInputProp.setRequired(saveFlowRequest.getRequired());
singleInputProp.setLabel("单行输入框");
singleInputProp.setPlaceholder("请输入");
singleInputProp.setId("TextField-J78F056R");
singleInput.setProps(singleInputProp);
formComponentList.add(singleInput);
}*/
// 多行文本框
/* OapiProcessSaveRequest.FormComponentVo multipleInput = new OapiProcessSaveRequest.FormComponentVo();
multipleInput.setComponentName("TextareaField");
OapiProcessSaveRequest.FormComponentPropVo multipleInputProp = new OapiProcessSaveRequest.FormComponentPropVo();
multipleInputProp.setRequired(true);
multipleInputProp.setLabel("多行输入框");
multipleInputProp.setPlaceholder("请输入");
multipleInputProp.setId("TextareaField-J78F056S");
multipleInput.setProps(multipleInputProp);
formComponentList.add(multipleInput);*/
// 日期
/* OapiProcessSaveRequest.FormComponentVo dateComponent = new OapiProcessSaveRequest.FormComponentVo();
dateComponent.setComponentName("DDDateField");
OapiProcessSaveRequest.FormComponentPropVo dateComponentProp = new OapiProcessSaveRequest.FormComponentPropVo();
dateComponentProp.setRequired(true);
dateComponentProp.setLabel("日期");
dateComponentProp.setPlaceholder("请选择");
dateComponentProp.setUnit("小时"); // 小时或天
dateComponentProp.setId("DDDateField-J8MTJZVE");
dateComponent.setProps(dateComponentProp);
formComponentList.add(dateComponent);*/
saveProcessRequest.setFormComponentList(formComponentList);
request.setSaveProcessRequest(saveProcessRequest);
try {
OapiProcessSaveResponse response = client.execute(request, getDingTalkToken());
if (response.getErrcode() != 0) {
throw new SyncDataException(JSON.toJSONString(request), response.getErrmsg());
}
return response.getResult().getProcessCode();
} catch (ApiException e) {
log.error("创建审批模板saveProcess异常{}", e.getMessage());
throw new SyncDataException(JSON.toJSONString(request), e.getErrMsg());
}
}
@Override
public String startProcessInstance(StartFlowRequest startFlowRequest) {
DingTalkClient client = new DefaultDingTalkClient(BaseConstantUrl.START_PROCESS_INSTANCE);
OapiProcessinstanceCreateRequest req = new OapiProcessinstanceCreateRequest();
req.setProcessCode(startFlowRequest.getProcessCode());
req.setOriginatorUserId(startFlowRequest.getOriginatorUserId());
req.setDeptId(startFlowRequest.getDeptId());
//req.setApprovers("manager01, manager02");
// req.setCcList("user2,user3");
//req.setCcPosition("START");
//组件赋值
List<OapiProcessinstanceCreateRequest.FormComponentValueVo> formComponentList = BeanUtils.transformList(startFlowRequest.getFormComponentValueVoList(), OapiProcessinstanceCreateRequest.FormComponentValueVo.class);
req.setFormComponentValues(formComponentList);
try {
OapiProcessinstanceCreateResponse response = client.execute(req, getDingTalkToken());
if (response.getErrcode() != 0) {
throw new SyncDataException(JSON.toJSONString(req), response.getErrmsg());
}
return response.getProcessInstanceId();
} catch (ApiException e) {
log.error("发起审批实例startProcessInstance异常{}", e.getMessage());
throw new SyncDataException(JSON.toJSONString(req), e.getErrMsg());
}
}
@Override
public List<OapiProcessTemplateManageGetResponse.ProcessSimpleVO> getProcessTemplateManage(String userId) {
@ -145,4 +250,14 @@ public class DingOfficialFlowServiceImpl extends BaseService implements DingOffi
}
}
@Override
public void bpmsInstanceChange() {
}
@Override
public void bpmsTaskChange() {
}
}

View File

@ -0,0 +1,274 @@
package com.snow.dingtalk.sync;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.dingtalk.api.response.OapiProcessinstanceGetResponse;
import com.snow.common.annotation.SyncLog;
import com.snow.common.enums.DingFlowTaskType;
import com.snow.common.enums.DingTalkListenerType;
import com.snow.common.enums.SyncLogType;
import com.snow.common.utils.StringUtils;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.dingtalk.service.impl.DingOfficialFlowServiceImpl;
import com.snow.system.domain.SysDingHiTask;
import com.snow.system.domain.SysDingProcinst;
import com.snow.system.domain.SysDingRuTask;
import com.snow.system.service.impl.SysDingHiTaskServiceImpl;
import com.snow.system.service.impl.SysDingProcinstServiceImpl;
import com.snow.system.service.impl.SysDingRuTaskServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-24 22:09
**/
@Component
@Slf4j
public class SyncFlowService implements ISyncSysInfo {
@Autowired
private SysDingProcinstServiceImpl sysDingProcinstService=SpringUtils.getBean(SysDingProcinstServiceImpl.class);
@Autowired
private DingOfficialFlowServiceImpl dingOfficialFlowService=SpringUtils.getBean(DingOfficialFlowServiceImpl.class);
@Autowired
private SysDingRuTaskServiceImpl sysDingRuTaskService=SpringUtils.getBean(SysDingRuTaskServiceImpl.class);
@Autowired
private SysDingHiTaskServiceImpl sysDingHiTaskService=SpringUtils.getBean(SysDingHiTaskServiceImpl.class);
@Override
@SyncLog(dingTalkListenerType = DingTalkListenerType.BPMS_INSTANCE_CHANGE,syncLogTpye = SyncLogType.SYNC_SYS)
public JSONObject SyncSysInfo(DingTalkListenerType dingTalkListenerType, JSONObject jsonObject) {
Integer code = dingTalkListenerType.getCode();
if(code.equals(DingTalkListenerType.BPMS_INSTANCE_CHANGE.getCode())){
handleSysInstance(jsonObject);
}else if(code.equals(DingTalkListenerType.BPMS_TASK_CHANGE.getCode())){
handleSysTask(jsonObject);
}
return null;
}
private void handleSysInstance(JSONObject jsonObject){
SysDingProcinst sysDingProcinst= jsonObject.toJavaObject(SysDingProcinst.class);
sysDingProcinst.setProcInstId(String.valueOf(jsonObject.get("processInstanceId")));
sysDingProcinst.setStartUserId(String.valueOf(jsonObject.get("staffId")));
sysDingProcinst.setDingUrl(String.valueOf(jsonObject.get("url")));
sysDingProcinst.setProcCode(String.valueOf(jsonObject.get("processCode")));
Optional.ofNullable(jsonObject.get("result")).ifPresent(t->sysDingProcinst.setProcResult(String.valueOf(jsonObject.get("result"))));
Optional.ofNullable(jsonObject.get("createTime")).ifPresent(t->sysDingProcinst.setStartTime(new Date((long)jsonObject.get("createTime"))));
Optional.ofNullable(jsonObject.get("finishTime")).ifPresent(t->sysDingProcinst.setFinishTime(new Date((long)jsonObject.get("finishTime"))));
String type = sysDingProcinst.getType();
switch (type){
//实例开始
case "start":
startDingSysInstance(sysDingProcinst);
break;
case "finish":
finishDingSysInstance(sysDingProcinst);
break;
//审批终止发起人撤销审批单
case "terminate":
break;
default:
}
}
/**
* 开始流程时的逻辑处理
* @param sysDingProcinst
*/
private void startDingSysInstance(SysDingProcinst sysDingProcinst){
String processInstanceId=sysDingProcinst.getProcInstId();
//添加流程实例记录
SysDingProcinst querySysDingProcinst = sysDingProcinstService.selectSysDingProcinstByProcInstId(sysDingProcinst.getProcInstId());
if(StringUtils.isNull(querySysDingProcinst)){
//查询流程详情保存下个节点待办
OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceDetail = dingOfficialFlowService.getProcessInstanceDetail(processInstanceId);
sysDingProcinst.setType(processInstanceDetail.getStatus());
sysDingProcinst.setBusinessKey(processInstanceDetail.getBusinessId());
//保存流程实例
sysDingProcinstService.insertSysDingProcinst(sysDingProcinst);
}
}
/**
* 结束流程时的逻辑处理
* @param sysDingProcinst
*/
private void finishDingSysInstance(SysDingProcinst sysDingProcinst){
String processInstanceId=sysDingProcinst.getProcInstId();
//查询流程详情保存下个节点待办
OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceDetail = dingOfficialFlowService.getProcessInstanceDetail(processInstanceId);
//更新审批实例
SysDingProcinst querySysDingProcinst = sysDingProcinstService.selectSysDingProcinstByProcInstId(processInstanceId);
if(StringUtils.isNotNull(querySysDingProcinst)){
sysDingProcinst.setId(querySysDingProcinst.getId());
sysDingProcinst.setType(processInstanceDetail.getStatus());
sysDingProcinstService.updateSysDingProcinst(sysDingProcinst);
}
}
private void handleSysTask(JSONObject jsonObject){
SysDingRuTask sysDingRuTask= jsonObject.toJavaObject(SysDingRuTask.class);
sysDingRuTask.setProcInstId(String.valueOf(jsonObject.get("processInstanceId")));
sysDingRuTask.setAssignee(String.valueOf(jsonObject.get("staffId")));
sysDingRuTask.setProcCode(String.valueOf(jsonObject.get("processCode")));
String type= String.valueOf(jsonObject.get("type"));
switch (type){
//实例开始
case "start":
startDingSysTask(sysDingRuTask);
break;
case "finish":
finishDingSysTask(sysDingRuTask);
break;
//当前节点有多个审批人并且是或签其中一个人执行了审批其他审批人会推送cancel类型事件
case "cancel":
finishDingSysTask(sysDingRuTask);
break;
default:
}
}
/**
* 任务开始运行表和历史表添加数据
* @param sysDingRuTask
*/
private void startDingSysTask(SysDingRuTask sysDingRuTask){
String procInstId = sysDingRuTask.getProcInstId();
//查询流程详情保存下个节点待办
OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceDetail = dingOfficialFlowService.getProcessInstanceDetail(procInstId);
//获取任务节点(写入钉钉待办表)
List<OapiProcessinstanceGetResponse.TaskTopVo> tasks = processInstanceDetail.getTasks();
if(CollectionUtil.isNotEmpty(tasks)){
tasks.stream().forEach(t->{
//第二步运行中的任务保存到本地表
if(t.getTaskStatus().equals(DingFlowTaskType.RUNNING.getCode())){
SysDingRuTask querySysDingRuTask = sysDingRuTaskService.selectSysDingRuTaskById(t.getTaskid());
if(StringUtils.isNull(querySysDingRuTask)){
saveDingRunTask(t,procInstId,sysDingRuTask.getProcCode());
}
SysDingHiTask sysDingHiTask = sysDingHiTaskService.selectSysDingHiTaskById(t.getTaskid());
if(StringUtils.isNull(sysDingHiTask)){
saveDingHiTask(t,procInstId,sysDingRuTask.getProcCode());
}
}
});
}
}
/**
* 任务完成删除运行中的表数据
* @param sysDingRuTask
*/
private void finishDingSysTask(SysDingRuTask sysDingRuTask){
String procInstId = sysDingRuTask.getProcInstId();
//查询流程详情保存下个节点待办
OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceDetail = dingOfficialFlowService.getProcessInstanceDetail(procInstId);
//获取任务节点(写入钉钉待办表)
List<OapiProcessinstanceGetResponse.TaskTopVo> tasks = processInstanceDetail.getTasks();
if(CollectionUtil.isNotEmpty(tasks)){
tasks.stream().forEach(t->{
//第二步删除运行中的任务更新历史任务表
if(t.getTaskStatus().equals(DingFlowTaskType.COMPLETED.getCode())){
SysDingRuTask querySysDingRuTask = sysDingRuTaskService.selectSysDingRuTaskById(t.getTaskid());
if(StringUtils.isNotNull(querySysDingRuTask)){
sysDingRuTaskService.deleteSysDingRuTaskById(querySysDingRuTask.getId());
SysDingHiTask sysDingHiTask=new SysDingHiTask();
sysDingHiTask.setId(t.getTaskid());
sysDingHiTask.setTaskResult(t.getTaskResult());
sysDingHiTask.setFinishTime(t.getFinishTime());
sysDingHiTask.setAssignee(t.getUserid());
sysDingHiTask.setTaskState(t.getTaskStatus());
sysDingHiTask.setDescription(processInstanceDetail.getTitle());
sysDingHiTaskService.updateSysDingHiTask(sysDingHiTask);
}
}
//当前节点有多个审批人并且是或签其中一个人执行了审批其他审批人会推送cancel类型事件修改运行表任务状态
else if(t.getTaskStatus().equals(DingFlowTaskType.CANCELED.getCode())){
SysDingRuTask sysDingRuTask1=new SysDingRuTask();
sysDingRuTask1.setId(t.getTaskid());
sysDingRuTask1.setTaskState(t.getTaskStatus());
sysDingRuTaskService.updateSysDingRuTask(sysDingRuTask1);
}
});
}
}
private void saveDingRunTask(OapiProcessinstanceGetResponse.TaskTopVo taskTopVo,String procInstId,String procCode){
try {
SysDingRuTask sysDingRuTask=new SysDingRuTask();
sysDingRuTask.setId(taskTopVo.getTaskid());
sysDingRuTask.setCreateTime(taskTopVo.getCreateTime());
sysDingRuTask.setActivityId(taskTopVo.getActivityId());
sysDingRuTask.setProcCode(procCode);
sysDingRuTask.setFinishTime(taskTopVo.getFinishTime());
sysDingRuTask.setAssignee(taskTopVo.getUserid());
sysDingRuTask.setTaskState(taskTopVo.getTaskStatus());
sysDingRuTask.setFormKey(taskTopVo.getUrl());
sysDingRuTask.setId(taskTopVo.getTaskid());
sysDingRuTask.setProcInstId(procInstId);
sysDingRuTaskService.insertSysDingRuTask(sysDingRuTask);
}catch (Exception e){
log.error("**************保存运行任务时候出现异常:{}",e.getMessage());
}
}
private void saveDingHiTask(OapiProcessinstanceGetResponse.TaskTopVo taskTopVo,String procInstId,String procCode){
try {
SysDingHiTask sysDingHiTask=new SysDingHiTask();
sysDingHiTask.setId(taskTopVo.getTaskid());
sysDingHiTask.setTaskId(taskTopVo.getTaskid());
sysDingHiTask.setTaskResult(taskTopVo.getTaskResult());
sysDingHiTask.setCreateTime(taskTopVo.getCreateTime());
sysDingHiTask.setActivityId(taskTopVo.getActivityId());
sysDingHiTask.setProcCode(procCode);
sysDingHiTask.setFinishTime(taskTopVo.getFinishTime());
sysDingHiTask.setAssignee(taskTopVo.getUserid());
sysDingHiTask.setTaskState(taskTopVo.getTaskStatus());
sysDingHiTask.setFormKey(taskTopVo.getUrl());
sysDingHiTask.setId(taskTopVo.getTaskid());
sysDingHiTask.setProcInstId(procInstId);
sysDingHiTaskService.insertSysDingHiTask(sysDingHiTask);
}catch (Exception e){
log.error("**************保存历史任务时候出现异常:{}",e.getMessage());
}
}
}

View File

@ -15,6 +15,8 @@ public class SyncSysInfoFactory {
Integer type = dingTalkListenerType.getType();
if(type==DingTalkListenerType.DEPARTMENT_CREATE.getType()){
return new SyncSysDepartmentService();
}else if(type==DingTalkListenerType.BPMS_TASK_CHANGE.getType()){
return new SyncFlowService();
}
return null;

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,7 +16,6 @@
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-dingtalk</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>

View File

@ -1,5 +1,6 @@
package com.snow.flowable.config;
import com.snow.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@ -30,6 +31,9 @@ public class ResourcesConfig implements WebMvcConfigurer
@Autowired
private CustomHandlerInterceptor customHandlerInterceptor;
@Autowired
private ISysConfigService configService;
/**
* 默认首页的设置当输入域名是可以自动跳转到默认指定的网页
*/
@ -42,8 +46,10 @@ public class ResourcesConfig implements WebMvcConfigurer
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
//获取配置的文件地址
String address= configService.selectConfigByKey(Constants.LOCAL_ADDRESS);
/** 本地文件上传路径 */
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + Global.getProfile() + "/");
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + address + "/");
/** swagger配置 */
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -1,5 +1,6 @@
package com.snow.framework.config;
import com.snow.common.constant.Constants;
import com.snow.framework.storage.AliyunStorage;
import com.snow.framework.storage.LocalStorage;
import com.snow.framework.storage.StorageService;
@ -42,20 +43,18 @@ public class StorageAutoConfiguration {
@Bean
public LocalStorage localStorage() {
LocalStorage localStorage = new LocalStorage();
String address= configService.selectConfigByKey("sys.local.file.address");
String path= configService.selectConfigByKey("sys.local.file.path");
String address= configService.selectConfigByKey(Constants.LOCAL_ADDRESS);
localStorage.setAddress(address);
localStorage.setStoragePath(path);
return localStorage;
}
@Bean
public AliyunStorage aliyunStorage() {
AliyunStorage aliyunStorage = new AliyunStorage();
String accessKeyId= configService.selectConfigByKey("sys.aliyun.file.accessKeyId");
String accessKeySecret= configService.selectConfigByKey("sys.aliyun.file.accessKeySecret");
String bucketName= configService.selectConfigByKey("sys.aliyun.file.bucketName");
String endpoint= configService.selectConfigByKey("sys.aliyun.file.endpoint");
String accessKeyId= configService.selectConfigByKey(Constants.ALIYUN_ACCESSKEYID);
String accessKeySecret= configService.selectConfigByKey(Constants.ALIYUN_ACCESSKEYSECRET);
String bucketName= configService.selectConfigByKey(Constants.ALIYUN_BUCKETNAME);
String endpoint= configService.selectConfigByKey(Constants.ALIYUN_ENDPOINT);
aliyunStorage.setAccessKeyId(accessKeyId);
aliyunStorage.setAccessKeySecret(accessKeySecret);
aliyunStorage.setBucketName(bucketName);

View File

@ -12,6 +12,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
import java.io.IOException;
@ -85,14 +86,14 @@ public class AliyunStorage implements Storage{
* 阿里云OSS对象存储简单上传实现
*/
@Override
public void store(InputStream inputStream, long contentLength, String contentType, String keyName) {
public void store(String keyName, MultipartFile file) {
try {
// 简单文件上传, 最大支持 5 GB, 适用于小文件上传, 建议 20M以下的文件使用该接口
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(contentLength);
objectMetadata.setContentType(contentType);
objectMetadata.setContentLength(file.getSize());
objectMetadata.setContentType(file.getContentType());
// 对象键Key是对象在存储桶中的唯一标识
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, file.getInputStream(), objectMetadata);
getOSSClient().putObject(putObjectRequest);
// 关闭OSSClient
getOSSClient().shutdown();

View File

@ -1,46 +1,47 @@
package com.snow.framework.storage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.snow.common.config.ServerConfig;
import com.snow.common.constant.Constants;
import com.snow.common.exception.file.FileNameLengthLimitExceededException;
import com.snow.common.exception.file.FileSizeLimitExceededException;
import com.snow.common.exception.file.InvalidExtensionException;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.StringUtils;
import com.snow.common.utils.file.FileUploadUtils;
import com.snow.common.utils.file.MimeTypeUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.stream.Stream;
/**
* @author qimingjin
* @Title:
* @Description:
* @date 2021/1/11 13:20
*/
@Slf4j
public class LocalStorage implements Storage {
private final Log logger = LogFactory.getLog(LocalStorage.class);
private String storagePath;
/**
* 本地文件上传地址
*/
private String address;
private Path rootLocation;
public String getStoragePath() {
return storagePath;
}
@Autowired
private ServerConfig serverConfig;
public void setStoragePath(String storagePath) {
this.storagePath = storagePath;
/**
* 默认大小 50M
*/
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
this.rootLocation = Paths.get(storagePath);
try {
Files.createDirectories(rootLocation);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
public String getAddress() {
return address;
@ -50,61 +51,210 @@ public class LocalStorage implements Storage {
this.address = address;
}
@Override
public void store(InputStream inputStream, long contentLength, String contentType, String keyName) {
try {
Files.copy(inputStream, rootLocation.resolve(keyName), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
throw new RuntimeException("Failed to store file " + keyName, e);
/**
* 以默认配置进行文件上传
*
* @param file 上传的文件
* @return 文件名称
* @throws Exception
*/
public final String upload(MultipartFile file) throws IOException
{
try
{
return upload(address, file,null, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
}
catch (Exception e)
{
throw new IOException(e.getMessage(), e);
}
}
/**
* 根据文件路径上传
*
* @param file 上传的文件
* @return 文件名称
* @throws IOException
*/
@Override
public void store(String keyName,MultipartFile file) {
try {
String url =address + "/upload";
upload(url, file,keyName, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidExtensionException e) {
e.printStackTrace();
}
}
/**
* 生成文件地址URL
* @param keyName
* @return
*/
@Override
public String generateUrl(String keyName) {
String url = serverConfig.getUrl()+getPathFileName(address + "/upload",DateUtils.datePath() + "/" +keyName) ;
return url;
}
/**
* 文件上传
*
* @param baseDir 相对应用的基目录
* @param file 上传的文件
* @param allowedExtension 上传文件类型
* @return 返回上传成功的文件名
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws FileNameLengthLimitExceededException 文件名太长
* @throws IOException 比如读写文件出错时
* @throws InvalidExtensionException 文件校验异常
*/
public String upload(String baseDir, MultipartFile file,String keyName, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, InvalidExtensionException {
int fileNameLength = file.getOriginalFilename().length();
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
//文件大小和格式校验
assertAllowed(file, allowedExtension);
//编码文件名字
String fileName = extractFilename(keyName);
//创建file文件
File desc = getAbsoluteFile(baseDir, fileName);
//上传文件写到服务器上指定的文件
file.transferTo(desc);
String pathFileName = getPathFileName(baseDir, fileName);
return pathFileName;
}
/**
* 编码文件名
*/
public static final String extractFilename(String keyName)
{
return DateUtils.datePath() + "/" + keyName;
}
/**
* 创建File文件
* @param uploadDir
* @param fileName
* @return
* @throws IOException
*/
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
{
File desc = new File(uploadDir + File.separator + fileName);
if (!desc.exists())
{
if (!desc.getParentFile().exists())
{
desc.getParentFile().mkdirs();
}
}
return desc;
}
private String getPathFileName(String uploadDir, String fileName)
{
int dirLastIndex = address.length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
return pathFileName;
}
/**
* 文件大小校验
*
* @param file 上传的文件
* @return
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws InvalidExtensionException
*/
public static final void assertAllowed(MultipartFile file, String[] allowedExtension) throws InvalidExtensionException {
long size = file.getSize();
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) {
throw new FileNameLengthLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
String fileName = file.getOriginalFilename();
String extension = getExtension(file);
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
{
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, fileName);
} else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, fileName);
} else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, fileName);
} else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
throw new InvalidExtensionException(allowedExtension, extension, fileName);
} else {
throw new InvalidExtensionException(allowedExtension, extension, fileName);
}
}
}
/**
* 判断MIME类型是否是允许的MIME类型
*
* @param extension
* @param allowedExtension
* @return
*/
public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
{
for (String str : allowedExtension)
{
if (str.equalsIgnoreCase(extension))
{
return true;
}
}
return false;
}
/**
* 获取文件名的后缀
*
* @param file 表单文件
* @return 后缀名
*/
public static final String getExtension(MultipartFile file)
{
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension))
{
extension = MimeTypeUtils.getExtension(file.getContentType());
}
return extension;
}
@Override
public Stream<Path> loadAll() {
try {
return Files.walk(rootLocation, 1)
.filter(path -> !path.equals(rootLocation))
.map(path -> rootLocation.relativize(path));
} catch (IOException e) {
throw new RuntimeException("Failed to read stored files", e);
}
return null;
}
@Override
public Path load(String filename) {
return rootLocation.resolve(filename);
public Path load(String keyName) {
return null;
}
@Override
public Resource loadAsResource(String filename) {
try {
Path file = load(filename);
Resource resource = new UrlResource(file.toUri());
if (resource.exists() || resource.isReadable()) {
return resource;
} else {
return null;
}
} catch (MalformedURLException e) {
logger.error(e.getMessage(), e);
return null;
}
public Resource loadAsResource(String keyName) {
return null;
}
@Override
public void delete(String filename) {
Path file = load(filename);
try {
Files.delete(file);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
public void delete(String keyName) {
@Override
public String generateUrl(String keyName) {
return address + keyName;
}
}

View File

@ -1,7 +1,9 @@
package com.snow.framework.storage;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.stream.Stream;
@ -16,13 +18,15 @@ public interface Storage {
/**
* 存储一个文件对象
*
* @param inputStream 文件输入流
* @param contentLength 文件长度
* @param contentType 文件类型
* @param file
* @param keyName 文件名
*/
void store(InputStream inputStream, long contentLength, String contentType, String keyName);
void store(String keyName, MultipartFile file);
/**
*
* @return
*/
Stream<Path> loadAll();
/**

View File

@ -7,6 +7,7 @@ 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;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.nio.file.Path;
@ -46,19 +47,19 @@ public class StorageService {
/**
* 存储一个文件对象
*
* @param inputStream 文件输入流
* @param contentLength 文件长度
* @param contentType 文件类型
* @param fileName 文件索引名
* @param file 文件输入流
*/
public SysFile store(InputStream inputStream, long contentLength, String contentType, String fileName) {
public SysFile store(MultipartFile file){
String fileName = file.getOriginalFilename();
String contentType = file.getContentType();
long size = file.getSize();
String key = generateKey(fileName);
storage.store(inputStream, contentLength, contentType, key);
storage.store(key,file);
SysUser sysUser = ShiroUtils.getSysUser();
String url = generateUrl(key);
SysFile storageInfo = new SysFile();
storageInfo.setName(fileName);
storageInfo.setSize(contentLength);
storageInfo.setSize(size);
storageInfo.setType(contentType);
storageInfo.setKey(key);
storageInfo.setUrl(url);

View File

@ -5,12 +5,11 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>snow-from</artifactId>
<version>4.3.1</version>
<dependencies>
@ -23,7 +22,7 @@
<!-- 通用工具-->
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-common</artifactId>
<artifactId>snow-framework</artifactId>
</dependency>
</dependencies>

View File

@ -1,14 +1,8 @@
package com.snow.from.controller;
import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import com.alibaba.fastjson.JSON;
import com.snow.common.core.domain.AjaxResult;
import com.snow.from.model.FromInfoDTO;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @program: snow
@ -123,32 +117,4 @@ public class FromController {
return "/common/select_settings";
}
/**
*
* 保存表单数据
* @param fromInfoDTO
* @return
*/
@PostMapping("/saveFromInfo")
@ResponseBody
public AjaxResult saveFromInfo(@RequestBody FromInfoDTO fromInfoDTO)
{
TimedCache<String, String> timedCache = CacheUtil.newTimedCache(7100);
timedCache.put("fromInfoData",JSON.toJSONString(fromInfoDTO));
return AjaxResult.success(fromInfoDTO);
}
@GetMapping("/getFromInfo")
@ResponseBody
public AjaxResult getFromInfo()
{
String f="{\"ortumJson\":[{\"frame\":\"Bootstrap\",\"children\":[],\"componentKey\":\"inputDom\",\"name\":\"input_1616296539862130a\",\"title\":\"名称\",\"html\":\"<div class=\\\"form-group ortum_item ortum_bootstrap_input row\\\" data-frame=\\\"Bootstrap\\\" data-componentkey=\\\"inputDom\\\" ortum_uuid=\\\"3a50665e-ed1f-8dc6-b804-aa6e4fe8a0c3\\\"> <label class=\\\"col-form-label col-2 ortum_display_NONE\\\">名称</label><input type=\\\"text\\\" title=\\\"名称\\\" name=\\\"input_1616296539862130a\\\" class=\\\"form-control col\\\" placeholder=\\\"请输入\\\" autocomplete=\\\"off\\\"></div>\",\"componentProperties\":\"{\\\"data\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"input_1616296539862130a\\\\\\\",\\\\\\\"defaultVal\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"verification\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"authority\\\\\\\":\\\\\\\"edit\\\\\\\",\\\\\\\"placeholder\\\\\\\":\\\\\\\"请输入\\\\\\\",\\\\\\\"cssClass\\\\\\\":\\\\\\\"form-control col\\\\\\\",\\\\\\\"hideLabel\\\\\\\":true,\\\\\\\"labelName\\\\\\\":\\\\\\\"名称\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"名称\\\\\\\",\\\\\\\"labelPosition\\\\\\\":\\\\\\\"rowLeft\\\\\\\",\\\\\\\"labelCSS\\\\\\\":\\\\\\\"col-form-label col-2 ortum_display_NONE\\\\\\\",\\\\\\\"onBefore\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"onAfter\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"onClick\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"onBlur\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"onInput\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"uuid\\\\\\\":\\\\\\\"3a50665e-ed1f-8dc6-b804-aa6e4fe8a0c3\\\\\\\",\\\\\\\"attributesArr\\\\\\\":\\\\\\\"[\\\\\\\\\\\\\\\"{\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"label\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"autocomplete\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"off\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"}\\\\\\\\\\\\\\\"]\\\\\\\"}\\\",\\\"inputChange\\\":\\\"[\\\\\\\"id\\\\\\\",\\\\\\\"name\\\\\\\",\\\\\\\"defaultVal\\\\\\\",\\\\\\\"verification\\\\\\\",\\\\\\\"placeholder\\\\\\\",\\\\\\\"cssClass\\\\\\\",\\\\\\\"labelName\\\\\\\",\\\\\\\"labelCSS\\\\\\\",\\\\\\\"title\\\\\\\"]\\\",\\\"clickChange\\\":\\\"[\\\\\\\"authority\\\\\\\",\\\\\\\"hideLabel\\\\\\\",\\\\\\\"labelPosition\\\\\\\"]\\\",\\\"purview\\\":\\\"{\\\\\\\"id\\\\\\\":3,\\\\\\\"name\\\\\\\":3,\\\\\\\"defaultVal\\\\\\\":3,\\\\\\\"verification\\\\\\\":3,\\\\\\\"authority\\\\\\\":3,\\\\\\\"placeholder\\\\\\\":3,\\\\\\\"cssClass\\\\\\\":3,\\\\\\\"hideLabel\\\\\\\":3,\\\\\\\"labelName\\\\\\\":3,\\\\\\\"labelPosition\\\\\\\":3,\\\\\\\"labelCSS\\\\\\\":3,\\\\\\\"title\\\\\\\":3}\\\",\\\"dataShowType\\\":\\\"{\\\\\\\"hideLabel\\\\\\\":\\\\\\\"switch\\\\\\\",\\\\\\\"authority\\\\\\\":\\\\\\\"checkbox\\\\\\\",\\\\\\\"labelPosition\\\\\\\":\\\\\\\"checkbox\\\\\\\"}\\\"}\",\"ortumChildren\":null,\"script\":\"\"}],\"ortumSet\":{}}";
return AjaxResult.success(f);
}
}

View File

@ -0,0 +1,123 @@
package com.snow.from.controller;
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.from.domain.SysFormField;
import com.snow.from.service.ISysFormFieldService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 单字段Controller
*
* @author 没用的阿吉
* @date 2021-03-21
*/
@Controller
@RequestMapping("/system/field")
public class SysFormFieldController extends BaseController
{
private String prefix = "system/field";
@Autowired
private ISysFormFieldService sysFormFieldService;
@RequiresPermissions("system:field:view")
@GetMapping()
public String field()
{
return prefix + "/field";
}
/**
* 查询单字段列表
*/
@RequiresPermissions("system:field:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysFormField sysFormField)
{
startPage();
List<SysFormField> list = sysFormFieldService.selectSysFormFieldList(sysFormField);
return getDataTable(list);
}
/**
* 导出单字段列表
*/
@RequiresPermissions("system:field:export")
@Log(title = "单字段", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysFormField sysFormField)
{
List<SysFormField> list = sysFormFieldService.selectSysFormFieldList(sysFormField);
ExcelUtil<SysFormField> util = new ExcelUtil<SysFormField>(SysFormField.class);
return util.exportExcel(list, "field");
}
/**
* 新增单字段
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存单字段
*/
@RequiresPermissions("system:field:add")
@Log(title = "单字段", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysFormField sysFormField)
{
return toAjax(sysFormFieldService.insertSysFormField(sysFormField));
}
/**
* 修改单字段
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
SysFormField sysFormField = sysFormFieldService.selectSysFormFieldById(id);
mmap.put("sysFormField", sysFormField);
return prefix + "/edit";
}
/**
* 修改保存单字段
*/
@RequiresPermissions("system:field:edit")
@Log(title = "单字段", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysFormField sysFormField)
{
return toAjax(sysFormFieldService.updateSysFormField(sysFormField));
}
/**
* 删除单字段
*/
@RequiresPermissions("system:field:remove")
@Log(title = "单字段", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysFormFieldService.deleteSysFormFieldByIds(ids));
}
}

View File

@ -0,0 +1,234 @@
package com.snow.from.controller;
import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import com.alibaba.fastjson.JSON;
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.StringUtils;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.framework.util.ShiroUtils;
import com.snow.from.domain.FieldContentDTO;
import com.snow.from.domain.FromInfoDTO;
import com.snow.from.domain.SysFormField;
import com.snow.from.domain.SysFormInstance;
import com.snow.from.service.ISysFormFieldService;
import com.snow.from.service.ISysFormInstanceService;
import com.snow.system.domain.SysUser;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 单实例Controller
*
* @author 没用的阿吉
* @date 2021-03-21
*/
@Controller
@RequestMapping("/from/instance")
public class SysFormInstanceController extends BaseController
{
private String prefix = "system/instance";
@Autowired
private ISysFormInstanceService sysFormInstanceService;
@Autowired
private ISysFormFieldService sysFormFieldService;
@RequiresPermissions("system:instance:view")
@GetMapping()
public String instance()
{
return prefix + "/instance";
}
/**
* 查询单实例列表
*/
@RequiresPermissions("system:instance:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysFormInstance sysFormInstance)
{
startPage();
List<SysFormInstance> list = sysFormInstanceService.selectSysFormInstanceList(sysFormInstance);
return getDataTable(list);
}
/**
* 导出单实例列表
*/
@RequiresPermissions("system:instance:export")
@Log(title = "单实例", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysFormInstance sysFormInstance)
{
List<SysFormInstance> list = sysFormInstanceService.selectSysFormInstanceList(sysFormInstance);
ExcelUtil<SysFormInstance> util = new ExcelUtil<SysFormInstance>(SysFormInstance.class);
return util.exportExcel(list, "instance");
}
/**
*
* 保存表单数据
* @param fromInfoDTO
* @return
*/
@PostMapping("/saveFromInfo")
@ResponseBody
@Transactional
public AjaxResult saveFromInfo(@RequestBody FromInfoDTO fromInfoDTO)
{
SysUser sysUser = ShiroUtils.getSysUser();
String contentHtml = fromInfoDTO.getContentHtml();
Object ortumJson = JSON.parseObject(contentHtml).get(FromInfoDTO.ORTUM_JSON);
List<FieldContentDTO> fieldContentDTOS = JSON.parseArray(JSON.toJSONString(ortumJson), FieldContentDTO.class);
if(fieldContentDTOS.size()==0){
return AjaxResult.error("还没有创建组件呢!");
}
SysFormInstance sysFormInstanceCode = sysFormInstanceService.selectSysFormInstanceByFormCode(fromInfoDTO.getFormCode());
if(StringUtils.isNotNull(sysFormInstanceCode)){
return AjaxResult.error(String.format("表单编号:%已存在",fromInfoDTO.getFormCode()));
}
SysFormInstance sysFormInstanceName = sysFormInstanceService.selectSysFormInstanceByFormCode(fromInfoDTO.getColumnName());
if(StringUtils.isNotNull(sysFormInstanceName)){
return AjaxResult.error(String.format("表单名称:%已存在",fromInfoDTO.getFormName()));
}
SysFormInstance sysFormInstance=new SysFormInstance();
sysFormInstance.setFormCode(fromInfoDTO.getFormCode());
sysFormInstance.setFormName(fromInfoDTO.getFormName());
sysFormInstance.setRev(Long.parseLong(fromInfoDTO.getVersion()));
sysFormInstance.setFromContentHtml(contentHtml);
sysFormInstance.setCreateBy(sysUser.getUserName());
sysFormInstance.setUpdateTime(new Date());
sysFormInstanceService.insertSysFormInstance(sysFormInstance);
fieldContentDTOS.stream().forEach(t->{
SysFormField sysFormField=new SysFormField();
sysFormField.setFromId(sysFormInstance.getId());
sysFormField.setFieldKey(t.getName());
sysFormField.setFieldName(t.getTitle());
sysFormField.setFieldType(t.getComponentKey());
sysFormField.setFieldHtml(t.getHtml());
sysFormField.setRev(sysFormInstance.getRev());
//组件属性
sysFormField.setRemark(t.getComponentProperties());
sysFormFieldService.insertSysFormField(sysFormField);
});
return AjaxResult.success(fromInfoDTO);
}
/**
* 预览
* @return
*/
@GetMapping("/fromPreview/{id}")
public String fromPreview(@PathVariable("id") Long id,ModelMap mmap)
{
mmap.put("formId",id);
return prefix+"/fromPreview";
}
/**
* 获取表单内容
* @param formId
* @return
*/
@GetMapping("/getFromInfo/{formId}")
@ResponseBody
public AjaxResult getFromInfo(@PathVariable("formId")Long formId)
{
FromInfoDTO fromInfoDTO=new FromInfoDTO();
SysFormInstance sysFormInstance = sysFormInstanceService.selectSysFormInstanceById(formId);
fromInfoDTO.setFormCode(sysFormInstance.getFormCode());
fromInfoDTO.setFormName(sysFormInstance.getFormName());
fromInfoDTO.setVersion(String.valueOf(sysFormInstance.getRev()));
fromInfoDTO.setId(String.valueOf(sysFormInstance.getId()));
SysFormField sysFormField=new SysFormField();
sysFormField.setFromId(formId);
List<SysFormField> sysFormFieldList = sysFormFieldService.selectSysFormFieldList(sysFormField);
if(CollectionUtil.isNotEmpty(sysFormFieldList)){
String columnID = sysFormFieldList.stream().map(SysFormField::getFieldKey).collect(Collectors.joining(","));
String columnName = sysFormFieldList.stream().map(SysFormField::getFieldName).collect(Collectors.joining(","));
fromInfoDTO.setColumnID(columnID);
fromInfoDTO.setColumnName(columnName);
fromInfoDTO.setContentHtml(sysFormInstance.getFromContentHtml());
fromInfoDTO.setEditor(sysFormInstance.getCreateBy());
fromInfoDTO.setEditTime(sysFormInstance.getUpdateTime());
}
return AjaxResult.success(fromInfoDTO);
}
/**
* 新增单实例
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存单实例
*/
@RequiresPermissions("system:instance:add")
@Log(title = "单实例", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysFormInstance sysFormInstance)
{
return toAjax(sysFormInstanceService.insertSysFormInstance(sysFormInstance));
}
/**
* 修改单实例
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
SysFormInstance sysFormInstance = sysFormInstanceService.selectSysFormInstanceById(id);
mmap.put("sysFormInstance", sysFormInstance);
return prefix + "/edit";
}
/**
* 修改保存单实例
*/
@RequiresPermissions("system:instance:edit")
@Log(title = "单实例", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysFormInstance sysFormInstance)
{
return toAjax(sysFormInstanceService.updateSysFormInstance(sysFormInstance));
}
/**
* 删除单实例
*/
@RequiresPermissions("system:instance:remove")
@Log(title = "单实例", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysFormInstanceService.deleteSysFormInstanceByIds(ids));
}
}

View File

@ -0,0 +1,42 @@
package com.snow.from.domain;
import lombok.Data;
import java.io.Serializable;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-21 13:49
**/
@Data
public class FieldContentDTO implements Serializable {
private static final long serialVersionUID = 5539925619264110377L;
private String frame;
private String componentKey;
private String name;
private String title;
/**
* 组件属性
*/
private String componentProperties;
private String html;
private String[] children;
private Object ortumChildren;
private String script;
}

View File

@ -1,4 +1,4 @@
package com.snow.from.model;
package com.snow.from.domain;
import lombok.Data;
@ -39,6 +39,7 @@ public class FromInfoDTO implements Serializable {
private String editor;
private Date editTime;
/**
@ -48,10 +49,14 @@ public class FromInfoDTO implements Serializable {
/**
* from表单name
*/
private Date formName;
private String formName;
/**
* 版本号
*/
private String version;
public static String ORTUM_JSON="ortumJson";
}

View File

@ -0,0 +1,53 @@
package com.snow.from.domain;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 单字段对象 sys_form_field
*
* @author 没用的阿吉
* @date 2021-03-21
*/
@Data
public class SysFormField extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 字段标识 */
@Excel(name = "字段标识")
private String fieldKey;
/** 字段名称 */
@Excel(name = "字段名称")
private String fieldName;
/** 字段类型 */
@Excel(name = "字段类型")
private String fieldType;
/** 字段html */
@Excel(name = "字段html")
private String fieldHtml;
/** 乐观锁版本号 */
@Excel(name = "乐观锁版本号")
private Long rev;
/** 租户ID */
@Excel(name = "租户ID")
private String tenantId;
/** 删除标识0--正常1--删除) */
@Excel(name = "删除标识", readConverterExp = "0=--正常1--删除")
private Long isDelete;
private Long fromId;
}

View File

@ -0,0 +1,52 @@
package com.snow.from.domain;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 单实例对象 sys_form_instance
*
* @author 没用的阿吉
* @date 2021-03-21
*/
@Data
public class SysFormInstance extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 表单定义code */
@Excel(name = "表单定义code")
private String formCode;
/** 表单名称 */
@Excel(name = "表单名称")
private String formName;
/**
* 表单内容
*/
private String fromContentHtml;
/** 表单url */
@Excel(name = "表单url")
private String fromUrl;
/** 乐观锁版本号 */
@Excel(name = "乐观锁版本号")
private Long rev;
/** 删除标识0--正常1--删除) */
@Excel(name = "删除标识", readConverterExp = "0=--正常1--删除")
private Long isDelete;
/** 租户ID */
@Excel(name = "租户ID")
private String tenantId;
}

View File

@ -0,0 +1,62 @@
package com.snow.from.mapper;
import com.snow.from.domain.SysFormField;
import java.util.List;
/**
* 单字段Mapper接口
*
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface SysFormFieldMapper
{
/**
* 查询单字段
*
* @param id 单字段ID
* @return 单字段
*/
public SysFormField selectSysFormFieldById(Long id);
/**
* 查询单字段列表
*
* @param sysFormField 单字段
* @return 单字段集合
*/
public List<SysFormField> selectSysFormFieldList(SysFormField sysFormField);
/**
* 新增单字段
*
* @param sysFormField 单字段
* @return 结果
*/
public int insertSysFormField(SysFormField sysFormField);
/**
* 修改单字段
*
* @param sysFormField 单字段
* @return 结果
*/
public int updateSysFormField(SysFormField sysFormField);
/**
* 删除单字段
*
* @param id 单字段ID
* @return 结果
*/
public int deleteSysFormFieldById(Long id);
/**
* 批量删除单字段
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormFieldByIds(String[] ids);
}

View File

@ -0,0 +1,76 @@
package com.snow.from.mapper;
import com.snow.from.domain.SysFormInstance;
import java.util.List;
/**
* 单实例Mapper接口
*
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface SysFormInstanceMapper
{
/**
* 查询单实例
*
* @param id 单实例ID
* @return 单实例
*/
public SysFormInstance selectSysFormInstanceById(Long id);
/**
* 查询单实例
* @param fromCode
* @return
*/
public SysFormInstance selectSysFormInstanceByFormCode(String fromCode);
/**
* 查询单实例
* @param fromName
* @return
*/
public SysFormInstance selectSysFormInstanceByFormName(String fromName);
/**
* 查询单实例列表
*
* @param sysFormInstance 单实例
* @return 单实例集合
*/
public List<SysFormInstance> selectSysFormInstanceList(SysFormInstance sysFormInstance);
/**
* 新增单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
public int insertSysFormInstance(SysFormInstance sysFormInstance);
/**
* 修改单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
public int updateSysFormInstance(SysFormInstance sysFormInstance);
/**
* 删除单实例
*
* @param id 单实例ID
* @return 结果
*/
public int deleteSysFormInstanceById(Long id);
/**
* 批量删除单实例
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormInstanceByIds(String[] ids);
}

View File

@ -0,0 +1,62 @@
package com.snow.from.service;
import com.snow.from.domain.SysFormField;
import java.util.List;
/**
* 单字段Service接口
*
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface ISysFormFieldService
{
/**
* 查询单字段
*
* @param id 单字段ID
* @return 单字段
*/
public SysFormField selectSysFormFieldById(Long id);
/**
* 查询单字段列表
*
* @param sysFormField 单字段
* @return 单字段集合
*/
public List<SysFormField> selectSysFormFieldList(SysFormField sysFormField);
/**
* 新增单字段
*
* @param sysFormField 单字段
* @return 结果
*/
public int insertSysFormField(SysFormField sysFormField);
/**
* 修改单字段
*
* @param sysFormField 单字段
* @return 结果
*/
public int updateSysFormField(SysFormField sysFormField);
/**
* 批量删除单字段
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormFieldByIds(String ids);
/**
* 删除单字段信息
*
* @param id 单字段ID
* @return 结果
*/
public int deleteSysFormFieldById(Long id);
}

View File

@ -0,0 +1,76 @@
package com.snow.from.service;
import com.snow.from.domain.SysFormInstance;
import java.util.List;
/**
* 单实例Service接口
*
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface ISysFormInstanceService
{
/**
* 查询单实例
*
* @param id 单实例ID
* @return 单实例
*/
public SysFormInstance selectSysFormInstanceById(Long id);
/**
*
* @param fromCode
* @return
*/
public SysFormInstance selectSysFormInstanceByFormCode(String fromCode);
/**
* 查询单实例
* @param fromName
* @return
*/
public SysFormInstance selectSysFormInstanceByFormName(String fromName);
/**
* 查询单实例列表
*
* @param sysFormInstance 单实例
* @return 单实例集合
*/
public List<SysFormInstance> selectSysFormInstanceList(SysFormInstance sysFormInstance);
/**
* 新增单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
public int insertSysFormInstance(SysFormInstance sysFormInstance);
/**
* 修改单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
public int updateSysFormInstance(SysFormInstance sysFormInstance);
/**
* 批量删除单实例
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormInstanceByIds(String ids);
/**
* 删除单实例信息
*
* @param id 单实例ID
* @return 结果
*/
public int deleteSysFormInstanceById(Long id);
}

View File

@ -0,0 +1,98 @@
package com.snow.from.service.impl;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.from.domain.SysFormField;
import com.snow.from.mapper.SysFormFieldMapper;
import com.snow.from.service.ISysFormFieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 单字段Service业务层处理
*
* @author 没用的阿吉
* @date 2021-03-21
*/
@Service
public class SysFormFieldServiceImpl implements ISysFormFieldService
{
@Autowired
private SysFormFieldMapper sysFormFieldMapper;
/**
* 查询单字段
*
* @param id 单字段ID
* @return 单字段
*/
@Override
public SysFormField selectSysFormFieldById(Long id)
{
return sysFormFieldMapper.selectSysFormFieldById(id);
}
/**
* 查询单字段列表
*
* @param sysFormField 单字段
* @return 单字段
*/
@Override
public List<SysFormField> selectSysFormFieldList(SysFormField sysFormField)
{
return sysFormFieldMapper.selectSysFormFieldList(sysFormField);
}
/**
* 新增单字段
*
* @param sysFormField 单字段
* @return 结果
*/
@Override
public int insertSysFormField(SysFormField sysFormField)
{
sysFormField.setCreateTime(DateUtils.getNowDate());
return sysFormFieldMapper.insertSysFormField(sysFormField);
}
/**
* 修改单字段
*
* @param sysFormField 单字段
* @return 结果
*/
@Override
public int updateSysFormField(SysFormField sysFormField)
{
sysFormField.setUpdateTime(DateUtils.getNowDate());
return sysFormFieldMapper.updateSysFormField(sysFormField);
}
/**
* 删除单字段对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysFormFieldByIds(String ids)
{
return sysFormFieldMapper.deleteSysFormFieldByIds(Convert.toStrArray(ids));
}
/**
* 删除单字段信息
*
* @param id 单字段ID
* @return 结果
*/
@Override
public int deleteSysFormFieldById(Long id)
{
return sysFormFieldMapper.deleteSysFormFieldById(id);
}
}

View File

@ -0,0 +1,107 @@
package com.snow.from.service.impl;
import java.util.List;
import com.snow.common.utils.DateUtils;
import com.snow.from.domain.SysFormInstance;
import com.snow.from.mapper.SysFormInstanceMapper;
import com.snow.from.service.ISysFormInstanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.common.core.text.Convert;
/**
* 单实例Service业务层处理
*
* @author 没用的阿吉
* @date 2021-03-21
*/
@Service
public class SysFormInstanceServiceImpl implements ISysFormInstanceService
{
@Autowired
private SysFormInstanceMapper sysFormInstanceMapper;
/**
* 查询单实例
*
* @param id 单实例ID
* @return 单实例
*/
@Override
public SysFormInstance selectSysFormInstanceById(Long id)
{
return sysFormInstanceMapper.selectSysFormInstanceById(id);
}
@Override
public SysFormInstance selectSysFormInstanceByFormCode(String fromCode) {
return sysFormInstanceMapper.selectSysFormInstanceByFormCode(fromCode);
}
@Override
public SysFormInstance selectSysFormInstanceByFormName(String fromName) {
return sysFormInstanceMapper.selectSysFormInstanceByFormName(fromName);
}
/**
* 查询单实例列表
*
* @param sysFormInstance 单实例
* @return 单实例
*/
@Override
public List<SysFormInstance> selectSysFormInstanceList(SysFormInstance sysFormInstance)
{
return sysFormInstanceMapper.selectSysFormInstanceList(sysFormInstance);
}
/**
* 新增单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
@Override
public int insertSysFormInstance(SysFormInstance sysFormInstance)
{
sysFormInstance.setCreateTime(DateUtils.getNowDate());
return sysFormInstanceMapper.insertSysFormInstance(sysFormInstance);
}
/**
* 修改单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
@Override
public int updateSysFormInstance(SysFormInstance sysFormInstance)
{
sysFormInstance.setUpdateTime(DateUtils.getNowDate());
return sysFormInstanceMapper.updateSysFormInstance(sysFormInstance);
}
/**
* 删除单实例对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysFormInstanceByIds(String ids)
{
return sysFormInstanceMapper.deleteSysFormInstanceByIds(Convert.toStrArray(ids));
}
/**
* 删除单实例信息
*
* @param id 单实例ID
* @return 结果
*/
@Override
public int deleteSysFormInstanceById(Long id)
{
return sysFormInstanceMapper.deleteSysFormInstanceById(id);
}
}

View File

@ -0,0 +1,114 @@
<?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.from.mapper.SysFormFieldMapper">
<resultMap type="SysFormField" id="SysFormFieldResult">
<result property="id" column="id_" />
<result property="fieldKey" column="field_key_" />
<result property="fieldName" column="field_name_" />
<result property="fieldType" column="field_type_" />
<result property="fieldHtml" column="field_html_" />
<result property="remark" column="remark_" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="rev" column="rev_" />
<result property="tenantId" column="tenant_id_" />
<result property="isDelete" column="is_delete" />
<result property="fromId" column="from_id" />
</resultMap>
<sql id="selectSysFormFieldVo">
select id_, field_key_, field_name_, field_type_, from_id,field_html_, remark_, create_by, create_time, update_time, update_by, rev_, tenant_id_, is_delete from sys_form_field
</sql>
<select id="selectSysFormFieldList" parameterType="SysFormField" resultMap="SysFormFieldResult">
<include refid="selectSysFormFieldVo"/>
<where>
<if test="fieldKey != null and fieldKey != ''"> and field_key_ = #{fieldKey}</if>
<if test="fieldName != null and fieldName != ''"> and field_name_ = #{fieldName}</if>
<if test="fieldType != null and fieldType != ''"> and field_type_ = #{fieldType}</if>
<if test="fieldHtml != null and fieldHtml != ''"> and field_html_ = #{fieldHtml}</if>
<if test="remark != null and remark != ''"> and remark_ = #{remark}</if>
<if test="rev != null "> and rev_ = #{rev}</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id_ = #{tenantId}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="fromId != null "> and from_id = #{fromId}</if>
</where>
</select>
<select id="selectSysFormFieldById" parameterType="Long" resultMap="SysFormFieldResult">
<include refid="selectSysFormFieldVo"/>
where id_ = #{id}
</select>
<insert id="insertSysFormField" parameterType="SysFormField" useGeneratedKeys="true" keyProperty="id">
insert into sys_form_field
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fieldKey != null and fieldKey != ''">field_key_,</if>
<if test="fieldName != null and fieldName != ''">field_name_,</if>
<if test="fieldType != null and fieldType != ''">field_type_,</if>
<if test="fieldHtml != null and fieldHtml != ''">field_html_,</if>
<if test="remark != null">remark_,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="rev != null">rev_,</if>
<if test="tenantId != null">tenant_id_,</if>
<if test="isDelete != null">is_delete,</if>
<if test="fromId != null ">from_id ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fieldKey != null and fieldKey != ''">#{fieldKey},</if>
<if test="fieldName != null and fieldName != ''">#{fieldName},</if>
<if test="fieldType != null and fieldType != ''">#{fieldType},</if>
<if test="fieldHtml != null and fieldHtml != ''">#{fieldHtml},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="rev != null">#{rev},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="fromId != null "> #{fromId}</if>
</trim>
</insert>
<update id="updateSysFormField" parameterType="SysFormField">
update sys_form_field
<trim prefix="SET" suffixOverrides=",">
<if test="fieldKey != null and fieldKey != ''">field_key_ = #{fieldKey},</if>
<if test="fieldName != null and fieldName != ''">field_name_ = #{fieldName},</if>
<if test="fieldType != null and fieldType != ''">field_type_ = #{fieldType},</if>
<if test="fieldHtml != null and fieldHtml != ''">field_html_ = #{fieldHtml},</if>
<if test="remark != null">remark_ = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="rev != null">rev_ = #{rev},</if>
<if test="tenantId != null">tenant_id_ = #{tenantId},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="fromId != null "> from_id = #{fromId},</if>
</trim>
where id_ = #{id}
</update>
<delete id="deleteSysFormFieldById" parameterType="Long">
delete from sys_form_field where id_ = #{id}
</delete>
<delete id="deleteSysFormFieldByIds" parameterType="String">
delete from sys_form_field where id_ in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,116 @@
<?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.from.mapper.SysFormInstanceMapper">
<resultMap type="SysFormInstance" id="SysFormInstanceResult">
<result property="id" column="id_" />
<result property="formCode" column="form_code_" />
<result property="formName" column="form_name_" />
<result property="fromUrl" column="from_url_" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="rev" column="rev_" />
<result property="isDelete" column="is_delete" />
<result property="tenantId" column="tenant_id_" />
<result property="fromContentHtml" column="from_content_html_" />
</resultMap>
<sql id="selectSysFormInstanceVo">
select id_, form_code_, form_name_, from_url_, create_by, from_content_html_,create_time, update_time, update_by, rev_, is_delete, tenant_id_ from sys_form_instance
</sql>
<select id="selectSysFormInstanceList" parameterType="SysFormInstance" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
<where>
<if test="formCode != null and formCode != ''"> and form_code_ = #{formCode}</if>
<if test="formName != null and formName != ''"> and form_name_ = #{formName}</if>
<if test="fromUrl != null and fromUrl != ''"> and from_url_ = #{fromUrl}</if>
<if test="rev != null "> and rev_ = #{rev}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id_ = #{tenantId}</if>
</where>
</select>
<select id="selectSysFormInstanceById" parameterType="Long" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
where id_ = #{id}
</select>
<select id="selectSysFormInstanceByFormCode" parameterType="String" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
where form_code_ = #{formCode}
</select>
<select id="selectSysFormInstanceByFormName" parameterType="String" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
where form_name_ = #{formName}
</select>
<insert id="insertSysFormInstance" parameterType="SysFormInstance" useGeneratedKeys="true" keyProperty="id">
insert into sys_form_instance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formCode != null and formCode != ''">form_code_,</if>
<if test="formName != null and formName != ''">form_name_,</if>
<if test="fromUrl != null and fromUrl != ''">from_url_,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="rev != null">rev_,</if>
<if test="isDelete != null">is_delete,</if>
<if test="tenantId != null">tenant_id_,</if>
<if test="fromContentHtml != null">from_content_html_,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formCode != null and formCode != ''">#{formCode},</if>
<if test="formName != null and formName != ''">#{formName},</if>
<if test="fromUrl != null and fromUrl != ''">#{fromUrl},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="rev != null">#{rev},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="fromContentHtml != null">#{fromContentHtml},</if>
</trim>
</insert>
<update id="updateSysFormInstance" parameterType="SysFormInstance">
update sys_form_instance
<trim prefix="SET" suffixOverrides=",">
<if test="formCode != null and formCode != ''">form_code_ = #{formCode},</if>
<if test="formName != null and formName != ''">form_name_ = #{formName},</if>
<if test="fromUrl != null and fromUrl != ''">from_url_ = #{fromUrl},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="rev != null">rev_ = #{rev},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="tenantId != null">tenant_id_ = #{tenantId},</if>
<if test="fromContentHtml != null">from_content_html_=#{fromContentHtml},</if>
</trim>
where id_ = #{id}
</update>
<delete id="deleteSysFormInstanceById" parameterType="Long">
delete from sys_form_instance where id_ = #{id}
</delete>
<delete id="deleteSysFormInstanceByIds" parameterType="String">
delete from sys_form_instance where id_ in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -85,29 +85,6 @@ $("#ortum_exchangeItemBtn").on("click",function(){
$("#ortum_exchangeA_tempObj").eq(0).replaceWith(Global.ortum_active_item);
$("#ortum_exchangeB_tempObj").eq(0).replaceWith(Global.ortum_replace_item);
}
/*if(activeItemParentDom.hasClass('ortum_bootstrap_td') && replaceItemParentDom.hasClass('ortum_bootstrap_td')){
BootstrapTable.sonOrtumItemNew(activeItemParentDom,$(Global.ortum_replace_item));
$(Global.ortum_replace_item).remove();//清除被替换组件
BootstrapTable.sonOrtumItemNew(replaceItemParentDom,$(Global.ortum_active_item));
$(Global.ortum_active_item).remove();//清除替换组件
}else if(!activeItemParentDom.hasClass('ortum_bootstrap_td') && replaceItemParentDom.hasClass('ortum_bootstrap_td')){
$(Global.ortum_active_item).eq(0).before("<div id='ortum_exchange_tempObj' class='ortum_display_NONE'></div>");
$("#ortum_exchange_tempObj").eq(0).replaceWith(Global.ortum_replace_item);
BootstrapTable.sonOrtumItemNew(replaceItemParentDom,$(Global.ortum_active_item));
$(Global.ortum_active_item).remove();//清除被替换组件
}else if(activeItemParentDom.hasClass('ortum_bootstrap_td') && !replaceItemParentDom.hasClass('ortum_bootstrap_td')){
$(Global.ortum_replace_item).eq(0).before("<div id='ortum_exchange_tempObj' class='ortum_display_NONE'></div>");
$("#ortum_exchange_tempObj").eq(0).replaceWith(Global.ortum_active_item)
BootstrapTable.sonOrtumItemNew(activeItemParentDom,$(Global.ortum_replace_item));
$(Global.ortum_replace_item).remove();//清除被替换组件
}else{
$(Global.ortum_replace_item).eq(0).before("<div id='ortum_exchangeA_tempObj' class='ortum_display_NONE'></div>");
$(Global.ortum_active_item).eq(0).before("<div id='ortum_exchangeB_tempObj' class='ortum_display_NONE'></div>");
$("#ortum_exchangeA_tempObj").eq(0).replaceWith(Global.ortum_active_item);
$("#ortum_exchangeB_tempObj").eq(0).replaceWith(Global.ortum_replace_item);
}*/
Global.ortum_replace_item = null;
Global.ortum_active_item = null;
@ -167,36 +144,9 @@ $(function(){
}
})
});
})
});
//getFormContentJson函数的返回值 从数组中获取 name和title数组
/*function getTitleAndNameFun(arr){
let nameArr = [];
let titleArr = [];
arr.forEach((item,index)=>{
if(!item.bindComponentName){//该组件没有绑定组件
if(item.name){
//只处理form组件
if(item.componentKey && require("settings").menuListDataJSON[item.componentKey].sort === "form"){
nameArr.push(item.name)
titleArr.push(item.title)
}else if(item.childrenType==="choose"){
nameArr.push(item.name)
titleArr.push(item.title)
};
if(item.children.length){
let backData = getTitleAndNameFun(item.children);
nameArr = nameArr.concat(backData.nameArr)
titleArr = titleArr.concat(backData.titleArr)
}
}
}
})
return {
titleArr:titleArr,
nameArr:nameArr,
};
}*/
let showTipSetTime;//定时器
@ -310,7 +260,6 @@ $('#ortum_table_act').on('click','.iconfont',function(e){
// debugger
let getTitleAndName = Feature.getTitleAndNameFun(ortumJson)//后端需要的数据
console.log("=======后端需要的数据============"+getTitleAndName);
let titleArr = getTitleAndName.titleArr;
let nameArr = getTitleAndName.nameArr;
@ -319,9 +268,6 @@ $('#ortum_table_act').on('click','.iconfont',function(e){
//获取localstore中的信息
let CATARC_INFO_SYS = window.localStorage.getItem("CATARC_INFO_SYS");
//let account = JSON.parse(CATARC_INFO_SYS).account;
//let usename = JSON.parse(account).usname;
let usename = "阿吉";
let ajaxJsom = {
columnID:nameArr.toString(),
columnName:titleArr.toString(),
@ -331,6 +277,7 @@ $('#ortum_table_act').on('click','.iconfont',function(e){
ortumSet:ortumSet,
ortumCss:ortumCss,
}),
ortumJson:ortumJson,
editor:"ortum",
// editTime:new Date(),
formCode:tableCode,
@ -345,7 +292,7 @@ $('#ortum_table_act').on('click','.iconfont',function(e){
}
//有formID时 校验版本号
formId && axios.get("/from/interface/saveFromInfo/"+formId)
formId && axios.get("/from/instance/saveFromInfo/"+formId)
.then(function (res) {
if(res.data.code==0){
if(!res.data.data){
@ -381,15 +328,16 @@ $('#ortum_table_act').on('click','.iconfont',function(e){
});
//无formID时 不检查版本号
console.log("-------ajaxJsom---------------"+JSON.stringify(ajaxJsom));
!formId && axios.post("/from/interface/saveFromInfo?_ts="+(new Date()).getTime(),ajaxJsom)
!formId && axios.post("/from/instance/saveFromInfo?_ts="+(new Date()).getTime(),ajaxJsom)
.then(function(res){
//alert(JSON.stringify(res))
if(res.data.code==0){
Assist.infoTip("保存成功");
closeItem();
//切换为编辑
switchTableAct("edit",{formName:res.data.data.formName,formCode:res.data.data.formCode,formId:res.data.data.id,version:res.data.data.version})
// switchTableAct("edit",{formName:res.data.data.formName,formCode:res.data.data.formCode,formId:res.data.data.id,version:res.data.data.version})
}else{
Assist.dangerTip(res.data.message);
Assist.dangerTip(res.data.msg);
}
})
.catch(function (error) {
@ -398,32 +346,7 @@ $('#ortum_table_act').on('click','.iconfont',function(e){
}).finally(function () {
showOrtumLoading(false);
});
/*ortumReq({
"url":"/catarc_infoSys/api/form?_ts=1603870623362",
"method":Settings.ortum_tableAct[actWay].way,
"header":{
"Content-Type": "application/json; charset=UTF-8",
},
"data":JSON.stringify(ajaxJsom),
"success":(xhr,e)=>{
console.log(xhr)
console.log(e)
if(xhr.status == 200){
let response = JSON.parse(xhr.response);
console.log(response)
response.ok && Assist.infoTip("保存成功")
!response.ok && Assist.dangerTip(response.message)
}else{
Assist.dangerTip("保存失败,状态码为"+xhr.status)
}
},
"error":(xhr,e)=>{
Assist.dangerTip("网络异常,保存失败");
console.log(xhr)
console.log(e)
},
})*/
})
});
return;
}
//编辑js
@ -552,4 +475,27 @@ window.onbeforeunload = function (e) {
return '请确定所做修改已经保存!';
};
var closeItem = function(dataId){
var topWindow = $(window.parent.document);
if($.common.isNotEmpty(dataId)){
window.parent.$.modal.closeLoading();
// 根据dataId关闭指定选项卡
$('.menuTab[data-id="' + dataId + '"]', topWindow).remove();
// 移除相应tab对应的内容区
$('.mainContent .RuoYi_iframe[data-id="' + dataId + '"]', topWindow).remove();
return;
}
var panelUrl = window.frameElement.getAttribute('data-panel');
$('.page-tabs-content .active i', topWindow).click();
if($.common.isNotEmpty(panelUrl)){
$('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active');
$('.mainContent .RuoYi_iframe', topWindow).each(function() {
if ($(this).data('id') == panelUrl) {
$(this).show().siblings('.RuoYi_iframe').hide();
return false;
}
});
}
}

View File

@ -635,5 +635,6 @@
</div>
<script th:src="@{../js/index.js}"></script>
<script th:src="@{/ruoyi/js/ry-ui.js}"></script>
</body>
</html>

View File

@ -260,31 +260,9 @@
<script>
// let prevArrJSON = window.opener.require("feature").getFormContentJson("id",{id:"ortum_field",win:window.opener.document});
let prevArrJSON = window.opener.require("feature").getFormContentJson("id",{id:"ortum_field",win:window.opener.document});
//let prevArrJSON = getFormContentJson("id",{id:"ortum_field",win:window.opener.document});
let prevArrJSON= axios.get("/from/interface/getFromInfo")
.then(function (res) {
// console.log("=========getFromInfo=========>"+JSON.stringify(res))
if(res.data.code==0){
prevArrJSON= JSON.parse(res.data.msg).ortumJson;
console.log("========后端返回的prevArrJSON======="+JSON.stringify(prevArrJSON));
//typeof callback === 'function' && callback.call(window,prevArrJSON);
//return prevArrJSON;
}else{
Assist.dangerTip(res.data.message)
}
})
.catch(function (error) {
if(!error || !error.noShowTip){
Assist.dangerTip("保存失败");
}
console.error(error);
});
//这个地方调用接口获取返回的html即可
console.log("========prevArrJSON======="+JSON.stringify(prevArrJSON));

View File

@ -0,0 +1,67 @@
<!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-field-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">字段标识:</label>
<div class="col-sm-8">
<input name="fieldKey" 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="fieldName" 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="fieldType" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">字段html</label>
<div class="col-sm-8">
<input name="fieldHtml" 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="rev" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租户ID</label>
<div class="col-sm-8">
<input name="tenantId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">删除标识:</label>
<div class="col-sm-8">
<input name="isDelete" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/field"
$("#form-field-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-field-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,68 @@
<!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-field-edit" th:object="${sysFormField}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">字段标识:</label>
<div class="col-sm-8">
<input name="fieldKey" th:field="*{fieldKey}" 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="fieldName" th:field="*{fieldName}" 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="fieldType" th:field="*{fieldType}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">字段html</label>
<div class="col-sm-8">
<input name="fieldHtml" th:field="*{fieldHtml}" 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="rev" th:field="*{rev}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租户ID</label>
<div class="col-sm-8">
<input name="tenantId" th:field="*{tenantId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">删除标识:</label>
<div class="col-sm-8">
<input name="isDelete" th:field="*{isDelete}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/field";
$("#form-field-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-field-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,138 @@
<!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="fieldKey"/>
</li>
<li>
<label>字段名称:</label>
<input type="text" name="fieldName"/>
</li>
<li>
<label>字段类型:</label>
<input type="text" name="fieldType"/>
</li>
<li>
<label>字段html</label>
<input type="text" name="fieldHtml"/>
</li>
<li>
<label>乐观锁版本号:</label>
<input type="text" name="rev"/>
</li>
<li>
<label>租户ID</label>
<input type="text" name="tenantId"/>
</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>&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:field:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:field:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:field:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:field: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:field:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:field:remove')}]];
var prefix = ctx + "system/field";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "单字段",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'fieldKey',
title: '字段标识'
},
{
field: 'fieldName',
title: '字段名称'
},
{
field: 'fieldType',
title: '字段类型'
},
{
field: 'fieldHtml',
title: '字段html'
},
{
field: 'remark',
title: '字段备注'
},
{
field: 'rev',
title: '乐观锁版本号'
},
{
field: 'tenantId',
title: '租户ID'
},
{
field: 'isDelete',
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-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!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-instance-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">表单定义code</label>
<div class="col-sm-8">
<input name="formCode" 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="formName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">表单url</label>
<div class="col-sm-8">
<input name="fromUrl" 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="rev" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">删除标识:</label>
<div class="col-sm-8">
<input name="isDelete" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租户ID</label>
<div class="col-sm-8">
<input name="tenantId" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/instance"
$("#form-instance-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-instance-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,62 @@
<!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-instance-edit" th:object="${sysFormInstance}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">表单定义code</label>
<div class="col-sm-8">
<input name="formCode" th:field="*{formCode}" 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="formName" th:field="*{formName}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">表单url</label>
<div class="col-sm-8">
<input name="fromUrl" th:field="*{fromUrl}" 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="rev" th:field="*{rev}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">删除标识:</label>
<div class="col-sm-8">
<input name="isDelete" th:field="*{isDelete}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租户ID</label>
<div class="col-sm-8">
<input name="tenantId" th:field="*{tenantId}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/instance";
$("#form-instance-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-instance-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,414 @@
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>ortum</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" th:href="@{../../..//css/index.css}">
<link rel="stylesheet" th:href="@{../../../css/bootstrap.css}">
<link rel="stylesheet" th:href="@{../../../css/custom.css}">
<link rel="stylesheet" th:href="@{../../../css/iconfont/iconfont.css}">
<!-- 滚动条样式 -->
<link rel="stylesheet" th:href="@{../../../lib/mCustonScrollbar/jquery.mCustomScrollbar.css}">
<!-- 引入bootstrap css-->
<link rel="stylesheet" th:href="@{https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css}" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script th:src="@{../../../lib/jquery.min.js}"></script>
<script th:src="@{../../../lib/axios.min.js}"></script>
<!-- 滚动条js -->
<script th:src="@{../../../lib/mCustonScrollbar/jquery.mCustomScrollbar.concat.min.js}"></script>
<!-- 引入bootstrap js -->
<!--<script src="https://cdn.jsdelivr.net/npm/popper.js"></script>-->
<script th:src="@{https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js}" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script th:src="@{https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js}" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script th:src="@{../../../lib/ortumReq.js}"></script>
<style>
#ortum_form_Modal_body input::-webkit-input-placeholder,#ortum_form_Modal_body textarea::-webkit-input-placeholder {
color: #77777773;
font-size: 14px;
}
#ortum_form_Modal_body input,#ortum_form_Modal_body select,#ortum_form_Modal_body textarea{
font-size: 14px;
padding-left: 10px;
}
#ortum_form_Modal_body input:disabled,#ortum_form_Modal_body select:disabled{
color: black;
}
/* 表头样式 */
#ortum_form_Modal_body #ortum_field_preview>.ortum_bootstrap_h:nth-child(1) .ortum_bootstrap_hDom {
background: #224F85 !important;
color: #fff !important;
height: 40px;
line-height: 40px;
padding: 0px;
font-size: 16px;
}
.row .ortum_boot_col_default {
border-right: 1px solid #fff;
}
/* label样式 */
.ortum_bootstrap_label_cssClass {
padding-left: 15px;
}
/* input */
.ortum_bootstrap_grid .ortum_boot_col_default .ortum_bootstrap_input{
width: 90%;
}
.ortum_bootstrap_grid .ortum_boot_col_default .form-control {
border-radius: 0 !important;
margin: 3.5px 0!important;
height: 30px;
line-height: 30px;
}
/* select样式 */
.ortum_bootstrap_grid .ortum_boot_col_default .ortum_bootstrap_select {
width: 90%;
}
.ortum_bootstrap_grid .ortum_boot_col_default .ortum_bootstrap_select .custom-select {
border-radius: 0px !important;
height: 30px;
line-height: 30px;
font-size: 16px;
padding: 0px;
margin:3.5px 0;
}
/* textarea */
.ortum_bootstrap_grid .ortum_boot_col_default .ortum_bootstrap_textarea{
width: 96%;
}
.ortum_bootstrap_grid .ortum_boot_col_default .ortum_bootstrap_textarea textarea{
height: auto!important;
}
.ortum_bootstrap_td #ortum_form_Modal_body #ortum_field_preview>.ortum_item {
margin-top: 2px !important;
margin-bottom: 2px !important;
}
#ortum_form_Modal_body #ortum_field_preview>.ortum_item:nth-child(2n) {
background: #fafafa !important;
}
#ortum_form_Modal_body #ortum_field_preview>.ortum_item:nth-child(2n+1) {
background: rgba(245, 244, 244, 1) !important;
}
/* 表格样式 */
.ortum_bootstrap_table .ortum_bootstrap_th {
border-color: #fff;
}
.ortum_bootstrap_table .ortum_bootstrap_td {
border-color: #fff;
}
.ortum_bootstrap_table .form-control {
border-radius: 0px !important;
height: 30px;
width: 90%;
}
.ortum_bootstrap_table .ortum_bootstrap_thead tr th span {
font-size: 16px;
font-weight: 500;
color: #000;
}
.ortum_bootstrap_table .ortum_bootstrap_thead tr th:nth-child(1) {
min-width: 40px;
}
/* 提交按钮样式 */
#ortum_preview_submit {
background: #007bff;
color: #fff;
border-radius: 0px;
}
.col,
.col-2 {
padding-right: 0px;
padding-left: 0px;
}
/*option意见*/
.optionContainer{
background-color:rgba(245,244,244,1);
}
.optionContainer > .row{
margin: 0;
}
.optionTitle{border: 2px solid white;display: flex;align-items: center;}
.optionContent{padding: 0 10px;border: 1px solid white;}
.optionText{line-height: 30px;height: 90px}
.optionSpan{display: block;white-space: pre-line;word-break: break-all;word-wrap: break-word;}
.optionTimeAndName{display: flex;flex-direction: column;justify-content: center;align-items: flex-end;border-bottom: 2px solid white;}
.optionContent .optionTimeAndName:last-of-type{
border-bottom:none;
}
</style>
</head>
<body>
<!--<div class="dropdown">
<span class="dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">交换</span>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>-->
<input type="hidden" id="formId" th:value="${formId}" name="formId">
<div id="ortum_form_Modal_body" class="container" style="margin: auto">
</div>
<div style="text-align: center" class="p-2">
<button type="button" class="btn btn-outline-primary" id="ortum_preview_submit">提交</button>
</div>
<script>
let getDomContextFormData = function(domId,settings={id:true,dataset:true,}){
let formData = {}
let form = document.getElementById(domId);
let elements = new Array();
let inputElements = form.getElementsByTagName('input');
let selectElements = form.getElementsByTagName('select');
let textareaElements = form.getElementsByTagName('textarea');
let includeId = false;//表单有id包含id的key
let includeDataSet = false;//包含data属性
if(Object.prototype.toString.call(settings).slice(8,-1) === "Object"){
settings.id && (includeId = true);
settings.dataset && (includeDataSet = true);
}
Array.prototype.forEach.call(inputElements,(item)=>{
if(!item.name)return;//不存在name不进行赋值
if(includeDataSet){
for(let dataKey in item.dataset){
if(item.dataset.hasOwnProperty(dataKey)){
formData[item.name+"_"+dataKey] = item.dataset[dataKey];
};
}
};
let type = item.type.toLowerCase();
switch (type){
case "radio":
includeId && item.checked && item.id && (formData[item.id] = item.value);
item.checked && item.name && (formData[item.name] = item.value);
break;
case "checkbox":
if(item.name && item.name.indexOf("switch") != -1){
includeId && item.checked && item.id && (formData[item.id] = item.value);
item.checked && (formData[item.name] = true);
!item.checked && (formData[item.name] = false);
}else{
item.name && item.checked && (formData[item.name] ? formData[item.name].push(item.value) : formData[item.name]=[item.value]);
includeId && item.id && item.checked && (formData[item.id] ? formData[item.id].push(item.value) : formData[item.id]=[item.value]);
};
break;
default:
includeId && item.id && (formData[item.id] = item.value);
item.name && (formData[item.name] = item.value);
break;
}
})
Array.prototype.forEach.call(selectElements,(item)=>{
includeId && item.id && (formData[item.id] = item.value);
if(!item.name)return;//不存在name不进行赋值
if(includeDataSet){
for(let dataKey in item.dataset){
if(item.dataset.hasOwnProperty(dataKey)){
formData[item.name+"_"+dataKey] = item.dataset[dataKey];
}
}
};
formData[item.name] = item.value;
})
Array.prototype.forEach.call(textareaElements,(item)=>{
includeId && item.id && (formData[item.id] = item.value);
if(!item.name)return;//不存在name不进行赋值
if(includeDataSet){
for(let dataKey in item.dataset){
if(item.dataset.hasOwnProperty(dataKey)){
formData[item.name+"_"+dataKey] = item.dataset[dataKey];
}
}
};
formData[item.name] = item.value;
})
return formData;
};
$("#ortum_preview_submit").on('click',function(e){
let formData = getDomContextFormData("ortum_form_Modal_body");
// console.log(formData)
alert(JSON.stringify(formData))
return false;
});
</script>
<script>
var formId=$("#formId").val();
axios.get("/from/instance/getFromInfo/"+formId)
.then(function (res) {
// console.log("=========getFromInfo=========>"+JSON.stringify(res))
if(res.data.code==0){
let prevArrJSON= JSON.parse(res.data.data.contentHtml).ortumJson;
console.log("========后端返回的prevArrJSON======="+JSON.stringify(prevArrJSON));
setPrevArrJSON(prevArrJSON);
}else{
Assist.dangerTip(res.data.message)
}
})
.catch(function (error) {
if(!error || !error.noShowTip){
// Assist.dangerTip("保存失败");
}
console.error(error);
});
function setPrevArrJSON(prevArrJSON) {
let prevDom = $('<div id="ortum_field_preview"></div>');
let cssDomSet = [];
let scriptDomSet = [];
//待渲染权限的树
let rendPowerArr = [];
//从json渲染成dom
function renderJson(prevArrJSON,parentDom,way="append") {
for(let item of prevArrJSON){
let domItem = item;
let htmlDom;
if(item.childrenType == "choose" && item.chooseFun){
(typeof item.chooseFun !=="function") && (item.chooseFun = Function('return ' + item.chooseFun)());
domItem = item.chooseFun(parentDom);
};
htmlDom = $(domItem.html);
if(domItem.children && domItem.children.length){
renderJson(domItem.children,htmlDom,"replace");
};
//特殊处理Bootstrap_tableDom
if(domItem.frame == "Bootstrap" && (domItem.componentKey == "tableDom" || domItem.componentKey == "newTableDom")){
$(htmlDom).prop("ortum-childrenArr-info",domItem.children);//tr中组件的信息
$(htmlDom).prop("ortum_tbodyTr_info",domItem.ortum_tbodyTr_info);//tr信息
};
switch (way) {
case "replace":
if(parentDom.find("ortum_children").length && /[\d]+$/.test(domItem.ortumChildren)){
parentDom.find("ortum_children[data-order="+ domItem.ortumChildren +"]").eq(0).replaceWith(htmlDom);
}else if(parentDom.find("ortum_children").length){
parentDom.find("ortum_children").eq(0).replaceWith(htmlDom);
};
break;
default:
parentDom.append(htmlDom);
break;
};
rendPowerArr.push({
dom:htmlDom,
name:domItem.name
})
domItem.css && cssDomSet.push(domItem.css);
if(domItem.script){
domItem.script.babel ? scriptDomSet.push(domItem.script.babel) : scriptDomSet.push(domItem.script)
}
}
}
renderJson(prevArrJSON,prevDom);
$("#ortum_form_Modal_body").html(prevDom);
cssDomSet.forEach((item,index)=>{
$(document.head).append(item);
})
scriptDomSet.forEach((item,index)=>{
$(document.body).append(item);
});
let purviewJson={
"checkbox_21561456456456456":1,
"radio_1252314543323":4,
"table_1605100578804af1b_tfoot_1":3,
"table_1605100578804af1b_tfoot_2":3,
"table_1605100578804af1b_tfoot_4":1,
"table_1605100578804af1b_1_1":1,
"table_1605100578804af1b_2_1":0,
"table_1605100578804af1b_3_1":1,
"table_1605100578804af1b_4_1":3,
"table_1605100578804af1b_5_1":4,
"table_1605100578804af1b_6_1":1,
"table_1605100578804af1b_7_1":2,
"table_1605100578804af1b_8_1":1,
"table_1605100578804af1b_9_1":3,
"table_1605100578804af1b_10_1":3,
"table_1605100578804af1b_11_1":2,
};
let priArr = {
0:"hide",
1:"read",
2:"edit",
3:"required",
4:"readAndReq",
};
function setDomQ(outDom,formDom,name,priVal){
//TODO 完善ortum_bindcomponentname关联组件的权限控制
switch (priVal) {
case "hide":
$(outDom).hide();
$("*[ortum_bindcomponentname="+ name +"]").parents(".ortum_item").eq(0).hide();
//特殊处理table
if(/^table/.test(name)){
let cellIndex = outDom.parents("td")[0].cellIndex;
$(outDom).parents("table").eq(0).find("tr td:nth-of-type("+ (cellIndex+1) +")").hide();
$(outDom).parents("table").eq(0).find("tr th:nth-of-type("+ (cellIndex+1) +")").hide();
};
break;
case "read":
$(formDom).attr("disabled","disabled");
$("*[ortum_bindcomponentname="+ name +"]").parents(".ortum_item").eq(0).show();
break;
case "edit":
$(formDom).removeAttr("disabled");
$("*[ortum_bindcomponentname="+ name +"]").parents(".ortum_item").eq(0).show();
break;
case "required":
$(formDom).attr("ortum_verify","required");
$("*[ortum_bindcomponentname="+ name +"]").parents(".ortum_item").eq(0).show();
break;
case "readAndReq":
$(formDom).attr("disabled","disabled");
$(formDom).attr("ortum_verify","required");
$("*[ortum_bindcomponentname="+ name +"]").parents(".ortum_item").eq(0).show();
break;
default:
break;
}
}
function setQ(dom,name,priJson) {
let hasNameDom = $(dom).find("*[name="+ name +"]");
if(priJson.hasOwnProperty(name)){
$(dom).attr("ortum_authority",priJson[name]);//绑定权限值
setDomQ(dom,hasNameDom,name,priArr[priJson[name]])
};
};
//开始渲染权限
rendPowerArr.forEach(function(item){
setQ(item.dom,item.name,purviewJson)
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,106 @@
<!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>表单定义code</label>
<input type="text" name="formCode"/>
</li>
<li>
<label>表单名称:</label>
<input type="text" name="formName"/>
</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="designFrom()" shiro:hasPermission="system:instance:add">
<i class="fa fa-plus"></i> 设计表单
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:instance:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:instance:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:instance: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:instance:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:instance:remove')}]];
var prefix = ctx + "from/instance";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "表单",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'formCode',
title: '表单定义code'
},
{
field: 'formName',
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" href="javascript:void(0)" onclick="fromDetail(\'' + 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('');
}
}]
};
$.table.init(options);
});
function fromDetail(id) {
var detailUrl="/from/instance/fromPreview/"+id;
$.modal.openTab("详情", detailUrl);
}
function designFrom() {
var detailUrl="/from/interface";
$.modal.openTab("设计表单", detailUrl);
}
</script>
</body>
</html>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -29,11 +29,10 @@
</exclusions>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-framework</artifactId>
<version>4.3.1</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>snow</artifactId>
<groupId>com.snow</groupId>
<version>4.3.1</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -21,7 +21,6 @@
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-common</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -0,0 +1,77 @@
package com.snow.system.domain;
import java.util.Date;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 对象 sys_ding_hi_task
*
* @author
* @date 2021-03-24
*/
@Data
public class SysDingHiTask extends BaseEntity
{
private static final long serialVersionUID = 1L;
private String id;
private String taskId;
private Long rev;
private String procInstId;
private String procCode;
private String activityId;
private String name;
private String parentTaskId;
private String taskResult;
private String taskState;
private String taskDefKey;
private String description;
private String assignee;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date finishTime;
private String category;
private Long suspensionState;
private String tenantId;
private String formKey;
/**
* 任务历时
*/
private String taskSpendTime;
private SysDingProcinst sysDingProcinst;
}

View File

@ -0,0 +1,99 @@
package com.snow.system.domain;
import java.util.Date;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 钉钉流程实例对象 sys_ding_procinst
*
* @author 没用的阿吉
* @date 2021-03-24
*/
@Data
public class SysDingProcinst extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 版本号 */
@Excel(name = "版本号")
private Long rev;
/** 流程实例id */
@Excel(name = "流程实例id")
private String procInstId;
/** 业务参数 */
@Excel(name = "业务参数")
private String businessKey;
/** 审批实例对应的企业 */
@Excel(name = "审批实例对应的企业")
private String corpId;
/** 流程开始时间 */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "流程开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 流程结束时间 */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "流程结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date finishTime;
/** 事件类型 */
@Excel(name = "事件类型")
private String eventType;
/** finish审批正常结束同意或拒绝terminate审批终止发起人撤销审批单 */
@Excel(name = "finish审批正常结束", readConverterExp = "同=意或拒绝")
private String type;
/** 实例标题 */
@Excel(name = "实例标题")
private String title;
/** 审批模板的唯一码 */
@Excel(name = "审批模板的唯一码")
private String procCode;
/** 租户id */
@Excel(name = "租户id")
private String tenantId;
/** null */
@Excel(name = "null")
private String name;
/** 审批实例url可在钉钉内跳转到审批页面 */
@Excel(name = "审批实例url可在钉钉内跳转到审批页面")
private String dingUrl;
/** 正常结束时result为agree拒绝时result为refuse审批终止时没这个值 */
@Excel(name = "正常结束时result为agree拒绝时result为refuse审批终止时没这个值")
private String procResult;
/**
* 流程发起人钉钉ID
*/
private String startUserId;
/**
*流程发起人名字
*/
private String startUserName;
/**
* 流程用时
*/
private String processSpendTime;
}

View File

@ -0,0 +1,88 @@
package com.snow.system.domain;
import java.util.Date;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 钉钉运行任务对象 sys_ding_ru_task
*
* @author 没用的阿吉
* @date 2021-03-24
*/
@Data
public class SysDingRuTask extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 任务id来自钉钉taskId */
private String id;
/** 版本号 */
@Excel(name = "版本号")
private Long rev;
/** 流程实例id */
@Excel(name = "流程实例id")
private String procInstId;
/** 钉钉流程code */
@Excel(name = "钉钉流程code")
private String procCode;
/** 活动id */
@Excel(name = "活动id")
private String activityId;
/** 任务名称 */
@Excel(name = "任务名称")
private String name;
/** 父任务id */
@Excel(name = "父任务id")
private String parentTaskId;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 任务定义key */
@Excel(name = "任务定义key")
private String taskDefKey;
/** 待办人 */
@Excel(name = "待办人")
private String assignee;
/** 结束时间 */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date finishTime;
/** 任务状态NEW未启动RUNNING处理中PAUSED暂停CANCELED取消COMPLETED完成TERMINATED终止 */
@Excel(name = "任务状态", readConverterExp = "N=EW未启动RUNNING处理中PAUSED暂停CANCELED取消COMPLETED完成TERMINATED终止")
private String taskState;
/** 分类 */
@Excel(name = "分类")
private String category;
/** 任务挂起状态0--正常1--挂起) */
@Excel(name = "任务挂起状态", readConverterExp = "0=--正常1--挂起")
private Long suspensionState;
/** 租户id */
@Excel(name = "租户id")
private String tenantId;
/** 外部表单key */
@Excel(name = "外部表单key")
private String formKey;
private SysDingProcinst sysDingProcinst;
}

View File

@ -0,0 +1,61 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.SysDingHiTask;
/**
* 历史任务Mapper接口
*
* @author 没用的阿吉
* @date 2021-03-24
*/
public interface SysDingHiTaskMapper
{
/**
* 查询历史任务
*
* @param id 历史任务ID
* @return 历史任务
*/
public SysDingHiTask selectSysDingHiTaskById(String id);
/**
* 查询历史任务列表
*
* @param sysDingHiTask 历史任务
* @return 历史任务集合
*/
public List<SysDingHiTask> selectSysDingHiTaskList(SysDingHiTask sysDingHiTask);
/**
* 新增历史任务
*
* @param sysDingHiTask 历史任务
* @return 结果
*/
public int insertSysDingHiTask(SysDingHiTask sysDingHiTask);
/**
* 修改历史任务
*
* @param sysDingHiTask 历史任务
* @return 结果
*/
public int updateSysDingHiTask(SysDingHiTask sysDingHiTask);
/**
* 删除历史任务
*
* @param id 历史任务ID
* @return 结果
*/
public int deleteSysDingHiTaskById(String id);
/**
* 批量删除历史任务
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDingHiTaskByIds(String[] ids);
}

View File

@ -0,0 +1,67 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.SysDingProcinst;
/**
* 钉钉流程实例Mapper接口
*
* @author 没用的阿吉
* @date 2021-03-24
*/
public interface SysDingProcinstMapper
{
/**
* 查询钉钉流程实例
*
* @param id 钉钉流程实例ID
* @return 钉钉流程实例
*/
public SysDingProcinst selectSysDingProcinstById(Long id);
/**
* 查询钉钉流程实例
* @param procInstId 钉钉流程实例ID
* @return 钉钉流程实例
*/
public SysDingProcinst selectSysDingProcinstByProcInstId(String procInstId);
/**
* 查询钉钉流程实例列表
*
* @param sysDingProcinst 钉钉流程实例
* @return 钉钉流程实例集合
*/
public List<SysDingProcinst> selectSysDingProcinstList(SysDingProcinst sysDingProcinst);
/**
* 新增钉钉流程实例
*
* @param sysDingProcinst 钉钉流程实例
* @return 结果
*/
public int insertSysDingProcinst(SysDingProcinst sysDingProcinst);
/**
* 修改钉钉流程实例
*
* @param sysDingProcinst 钉钉流程实例
* @return 结果
*/
public int updateSysDingProcinst(SysDingProcinst sysDingProcinst);
/**
* 删除钉钉流程实例
*
* @param id 钉钉流程实例ID
* @return 结果
*/
public int deleteSysDingProcinstById(Long id);
/**
* 批量删除钉钉流程实例
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDingProcinstByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.SysDingRuTask;
/**
* 钉钉运行任务Mapper接口
*
* @author 没用的阿吉
* @date 2021-03-24
*/
public interface SysDingRuTaskMapper
{
/**
* 查询钉钉运行任务
*
* @param id 钉钉运行任务ID
* @return 钉钉运行任务
*/
public SysDingRuTask selectSysDingRuTaskById(String id);
/**
* 查询钉钉运行任务列表
*
* @param sysDingRuTask 钉钉运行任务
* @return 钉钉运行任务集合
*/
public List<SysDingRuTask> selectSysDingRuTaskList(SysDingRuTask sysDingRuTask);
/**
* 新增钉钉运行任务
*
* @param sysDingRuTask 钉钉运行任务
* @return 结果
*/
public int insertSysDingRuTask(SysDingRuTask sysDingRuTask);
/**
* 修改钉钉运行任务
*
* @param sysDingRuTask 钉钉运行任务
* @return 结果
*/
public int updateSysDingRuTask(SysDingRuTask sysDingRuTask);
/**
* 删除钉钉运行任务
*
* @param id 钉钉运行任务ID
* @return 结果
*/
public int deleteSysDingRuTaskById(String id);
/**
* 批量删除钉钉运行任务
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDingRuTaskByIds(String[] ids);
}

View File

@ -83,6 +83,13 @@ public interface SysUserMapper
*/
public SysUser selectUserById(Long userId);
/**
* 通过用户dingUserId查询用户
* @param dingUserId
* @return
*/
public SysUser selectUserByDingUserId(String dingUserId);
/**
* 通过用户ID删除用户
*

View File

@ -0,0 +1,61 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysDingHiTask;
/**
* 历史任务Service接口
*
* @author 没用的阿吉
* @date 2021-03-24
*/
public interface ISysDingHiTaskService
{
/**
* 查询历史任务
*
* @param id 历史任务ID
* @return 历史任务
*/
public SysDingHiTask selectSysDingHiTaskById(String id);
/**
* 查询历史任务列表
*
* @param sysDingHiTask 历史任务
* @return 历史任务集合
*/
public List<SysDingHiTask> selectSysDingHiTaskList(SysDingHiTask sysDingHiTask);
/**
* 新增历史任务
*
* @param sysDingHiTask 历史任务
* @return 结果
*/
public int insertSysDingHiTask(SysDingHiTask sysDingHiTask);
/**
* 修改历史任务
*
* @param sysDingHiTask 历史任务
* @return 结果
*/
public int updateSysDingHiTask(SysDingHiTask sysDingHiTask);
/**
* 批量删除历史任务
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDingHiTaskByIds(String ids);
/**
* 删除历史任务信息
*
* @param id 历史任务ID
* @return 结果
*/
public int deleteSysDingHiTaskById(String id);
}

View File

@ -0,0 +1,67 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysDingProcinst;
/**
* 钉钉流程实例Service接口
*
* @author 没用的阿吉
* @date 2021-03-24
*/
public interface ISysDingProcinstService
{
/**
* 查询钉钉流程实例
*
* @param id 钉钉流程实例ID
* @return 钉钉流程实例
*/
public SysDingProcinst selectSysDingProcinstById(Long id);
/**
* 查询钉钉流程实例
* @param procInstId
* @return
*/
public SysDingProcinst selectSysDingProcinstByProcInstId(String procInstId);
/**
* 查询钉钉流程实例列表
*
* @param sysDingProcinst 钉钉流程实例
* @return 钉钉流程实例集合
*/
public List<SysDingProcinst> selectSysDingProcinstList(SysDingProcinst sysDingProcinst);
/**
* 新增钉钉流程实例
*
* @param sysDingProcinst 钉钉流程实例
* @return 结果
*/
public int insertSysDingProcinst(SysDingProcinst sysDingProcinst);
/**
* 修改钉钉流程实例
*
* @param sysDingProcinst 钉钉流程实例
* @return 结果
*/
public int updateSysDingProcinst(SysDingProcinst sysDingProcinst);
/**
* 批量删除钉钉流程实例
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDingProcinstByIds(String ids);
/**
* 删除钉钉流程实例信息
*
* @param id 钉钉流程实例ID
* @return 结果
*/
public int deleteSysDingProcinstById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysDingRuTask;
/**
* 钉钉运行任务Service接口
*
* @author 没用的阿吉
* @date 2021-03-24
*/
public interface ISysDingRuTaskService
{
/**
* 查询钉钉运行任务
*
* @param id 钉钉运行任务ID
* @return 钉钉运行任务
*/
public SysDingRuTask selectSysDingRuTaskById(String id);
/**
* 查询钉钉运行任务列表
*
* @param sysDingRuTask 钉钉运行任务
* @return 钉钉运行任务集合
*/
public List<SysDingRuTask> selectSysDingRuTaskList(SysDingRuTask sysDingRuTask);
/**
* 新增钉钉运行任务
*
* @param sysDingRuTask 钉钉运行任务
* @return 结果
*/
public int insertSysDingRuTask(SysDingRuTask sysDingRuTask);
/**
* 修改钉钉运行任务
*
* @param sysDingRuTask 钉钉运行任务
* @return 结果
*/
public int updateSysDingRuTask(SysDingRuTask sysDingRuTask);
/**
* 批量删除钉钉运行任务
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDingRuTaskByIds(String ids);
/**
* 删除钉钉运行任务信息
*
* @param id 钉钉运行任务ID
* @return 结果
*/
public int deleteSysDingRuTaskById(String id);
}

View File

@ -76,6 +76,13 @@ public interface ISysUserService
*/
public SysUser selectUserById(Long userId);
/**
* 通过用户dingUserId查询用户
* @param dingUserId
* @return
*/
public SysUser selectUserByDingUserId(String dingUserId);
/**
* 通过用户ID查询用户和角色关联
*

View File

@ -0,0 +1,130 @@
package com.snow.system.service.impl;
import java.util.List;
import java.util.Optional;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.StringUtils;
import com.snow.system.domain.SysDingProcinst;
import com.snow.system.domain.SysUser;
import com.snow.system.mapper.SysDingProcinstMapper;
import com.snow.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysDingHiTaskMapper;
import com.snow.system.domain.SysDingHiTask;
import com.snow.system.service.ISysDingHiTaskService;
import com.snow.common.core.text.Convert;
import javax.annotation.Resource;
/**
* 历史任务Service业务层处理
*
* @author 没用的阿吉
* @date 2021-03-24
*/
@Service
public class SysDingHiTaskServiceImpl implements ISysDingHiTaskService
{
@Resource
private SysDingHiTaskMapper sysDingHiTaskMapper;
@Autowired
private SysDingProcinstServiceImpl sysDingProcinstService;
@Resource
private SysUserMapper sysUserMapper;
/**
* 查询历史任务
*
* @param id 历史任务ID
* @return 历史任务
*/
@Override
public SysDingHiTask selectSysDingHiTaskById(String id)
{
return sysDingHiTaskMapper.selectSysDingHiTaskById(id);
}
/**
* 查询历史任务列表
*
* @param sysDingHiTask 历史任务
* @return 历史任务
*/
@Override
public List<SysDingHiTask> selectSysDingHiTaskList(SysDingHiTask sysDingHiTask)
{
List<SysDingHiTask> sysDingHiTaskList =sysDingHiTaskMapper.selectSysDingHiTaskList(sysDingHiTask);
sysDingHiTaskList.parallelStream().forEach(t->{
if(StringUtils.isNotNull(t.getProcInstId())){
SysDingProcinst sysDingProcinst = sysDingProcinstService.selectSysDingProcinstByProcInstId(t.getProcInstId());
Optional.ofNullable(sysDingProcinst).ifPresent(s->{
SysUser sysUser = sysUserMapper.selectUserByDingUserId(sysDingProcinst.getStartUserId());
sysDingProcinst.setStartUserName(sysUser.getUserName());
});
t.setSysDingProcinst(sysDingProcinst);
}
Optional.ofNullable(t.getFinishTime()).ifPresent(s->t.setTaskSpendTime( DateUtil.formatBetween(t.getCreateTime(), t.getFinishTime(), BetweenFormater.Level.SECOND)));
});
return sysDingHiTaskList;
}
/**
* 新增历史任务
*
* @param sysDingHiTask 历史任务
* @return 结果
*/
@Override
public int insertSysDingHiTask(SysDingHiTask sysDingHiTask)
{
return sysDingHiTaskMapper.insertSysDingHiTask(sysDingHiTask);
}
/**
* 修改历史任务
*
* @param sysDingHiTask 历史任务
* @return 结果
*/
@Override
public int updateSysDingHiTask(SysDingHiTask sysDingHiTask)
{
return sysDingHiTaskMapper.updateSysDingHiTask(sysDingHiTask);
}
/**
* 删除历史任务对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysDingHiTaskByIds(String ids)
{
return sysDingHiTaskMapper.deleteSysDingHiTaskByIds(Convert.toStrArray(ids));
}
/**
* 删除历史任务信息
*
* @param id 历史任务ID
* @return 结果
*/
@Override
public int deleteSysDingHiTaskById(String id)
{
return sysDingHiTaskMapper.deleteSysDingHiTaskById(id);
}
}

View File

@ -0,0 +1,118 @@
package com.snow.system.service.impl;
import java.util.List;
import java.util.Optional;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysDingProcinstMapper;
import com.snow.system.domain.SysDingProcinst;
import com.snow.system.service.ISysDingProcinstService;
import com.snow.common.core.text.Convert;
/**
* 钉钉流程实例Service业务层处理
*
* @author 没用的阿吉
* @date 2021-03-24
*/
@Service
public class SysDingProcinstServiceImpl implements ISysDingProcinstService
{
@Autowired
private SysDingProcinstMapper sysDingProcinstMapper;
/**
* 查询钉钉流程实例
*
* @param id 钉钉流程实例ID
* @return 钉钉流程实例
*/
@Override
public SysDingProcinst selectSysDingProcinstById(Long id)
{
return sysDingProcinstMapper.selectSysDingProcinstById(id);
}
/**
* 查询钉钉流程实例
* @param procInstId 钉钉流程实例ID
* @return
*/
public SysDingProcinst selectSysDingProcinstByProcInstId(String procInstId){
SysDingProcinst sysDingProcinst=sysDingProcinstMapper.selectSysDingProcinstByProcInstId(procInstId);
if(StringUtils.isNotNull(sysDingProcinst)){
Optional.ofNullable(sysDingProcinst.getFinishTime()).ifPresent(m->DateUtil.formatBetween(sysDingProcinst.getStartTime(),sysDingProcinst.getFinishTime(), BetweenFormater.Level.SECOND));
}
return sysDingProcinst;
}
/**
* 查询钉钉流程实例列表
*
* @param sysDingProcinst 钉钉流程实例
* @return 钉钉流程实例
*/
@Override
public List<SysDingProcinst> selectSysDingProcinstList(SysDingProcinst sysDingProcinst)
{
List<SysDingProcinst> sysDingProcinstList=sysDingProcinstMapper.selectSysDingProcinstList(sysDingProcinst);
sysDingProcinstList.forEach(t->
Optional.ofNullable(t.getFinishTime()).ifPresent(m->t.setProcessSpendTime(DateUtil.formatBetween(t.getStartTime(), t.getFinishTime(), BetweenFormater.Level.SECOND)))
);
return sysDingProcinstList;
}
/**
* 新增钉钉流程实例
*
* @param sysDingProcinst 钉钉流程实例
* @return 结果
*/
@Override
public int insertSysDingProcinst(SysDingProcinst sysDingProcinst)
{
return sysDingProcinstMapper.insertSysDingProcinst(sysDingProcinst);
}
/**
* 修改钉钉流程实例
*
* @param sysDingProcinst 钉钉流程实例
* @return 结果
*/
@Override
public int updateSysDingProcinst(SysDingProcinst sysDingProcinst)
{
return sysDingProcinstMapper.updateSysDingProcinst(sysDingProcinst);
}
/**
* 删除钉钉流程实例对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysDingProcinstByIds(String ids)
{
return sysDingProcinstMapper.deleteSysDingProcinstByIds(Convert.toStrArray(ids));
}
/**
* 删除钉钉流程实例信息
*
* @param id 钉钉流程实例ID
* @return 结果
*/
@Override
public int deleteSysDingProcinstById(Long id)
{
return sysDingProcinstMapper.deleteSysDingProcinstById(id);
}
}

View File

@ -0,0 +1,127 @@
package com.snow.system.service.impl;
import java.util.List;
import java.util.Optional;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.StringUtils;
import com.snow.system.domain.SysDingProcinst;
import com.snow.system.domain.SysUser;
import com.snow.system.mapper.SysDingProcinstMapper;
import com.snow.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysDingRuTaskMapper;
import com.snow.system.domain.SysDingRuTask;
import com.snow.system.service.ISysDingRuTaskService;
import com.snow.common.core.text.Convert;
/**
* 钉钉运行任务Service业务层处理
*
* @author 没用的阿吉
* @date 2021-03-24
*/
@Service
public class SysDingRuTaskServiceImpl implements ISysDingRuTaskService
{
@Autowired
private SysDingRuTaskMapper sysDingRuTaskMapper;
@Autowired
private SysDingProcinstMapper sysDingProcinstMapper;
@Autowired
private SysUserMapper sysUserMapper;
/**
* 查询钉钉运行任务
*
* @param id 钉钉运行任务ID
* @return 钉钉运行任务
*/
@Override
public SysDingRuTask selectSysDingRuTaskById(String id)
{
SysDingRuTask sysDingRuTask = sysDingRuTaskMapper.selectSysDingRuTaskById(id);
if(StringUtils.isNotNull(sysDingRuTask)&&StringUtils.isNotNull(sysDingRuTask.getProcInstId())){
SysDingProcinst sysDingProcinst = sysDingProcinstMapper.selectSysDingProcinstByProcInstId(sysDingRuTask.getProcInstId());
sysDingRuTask.setSysDingProcinst(sysDingProcinst);
}
return sysDingRuTask;
}
/**
* 查询钉钉运行任务列表
*
* @param sysDingRuTask 钉钉运行任务
* @return 钉钉运行任务
*/
@Override
public List<SysDingRuTask> selectSysDingRuTaskList(SysDingRuTask sysDingRuTask)
{
List<SysDingRuTask> sysDingRuTaskList=sysDingRuTaskMapper.selectSysDingRuTaskList(sysDingRuTask);
sysDingRuTaskList.parallelStream().forEach(t->{
if(StringUtils.isNotNull(t.getProcInstId())){
SysDingProcinst sysDingProcinst = sysDingProcinstMapper.selectSysDingProcinstByProcInstId(t.getProcInstId());
Optional.ofNullable(sysDingProcinst).ifPresent(s->{
SysUser sysUser = sysUserMapper.selectUserByDingUserId(sysDingProcinst.getStartUserId());
sysDingProcinst.setStartUserName(sysUser.getUserName());
});
t.setSysDingProcinst(sysDingProcinst);
}
});
return sysDingRuTaskList;
}
/**
* 新增钉钉运行任务
*
* @param sysDingRuTask 钉钉运行任务
* @return 结果
*/
@Override
public int insertSysDingRuTask(SysDingRuTask sysDingRuTask)
{
return sysDingRuTaskMapper.insertSysDingRuTask(sysDingRuTask);
}
/**
* 修改钉钉运行任务
*
* @param sysDingRuTask 钉钉运行任务
* @return 结果
*/
@Override
public int updateSysDingRuTask(SysDingRuTask sysDingRuTask)
{
return sysDingRuTaskMapper.updateSysDingRuTask(sysDingRuTask);
}
/**
* 删除钉钉运行任务对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysDingRuTaskByIds(String ids)
{
return sysDingRuTaskMapper.deleteSysDingRuTaskByIds(Convert.toStrArray(ids));
}
/**
* 删除钉钉运行任务信息
*
* @param id 钉钉运行任务ID
* @return 结果
*/
@Override
public int deleteSysDingRuTaskById(String id)
{
return sysDingRuTaskMapper.deleteSysDingRuTaskById(id);
}
}

View File

@ -154,6 +154,11 @@ public class SysUserServiceImpl implements ISysUserService
return userMapper.selectUserById(userId);
}
@Override
public SysUser selectUserByDingUserId(String dingUserId) {
return userMapper.selectUserByDingUserId(dingUserId);
}
/**
* 通过用户ID查询用户和角色关联
*

View File

@ -0,0 +1,144 @@
<?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.SysDingHiTaskMapper">
<resultMap type="SysDingHiTask" id="SysDingHiTaskResult">
<result property="id" column="ID_" />
<result property="taskId" column="TASK_ID_" />
<result property="rev" column="REV_" />
<result property="procInstId" column="PROC_INST_ID_" />
<result property="procCode" column="PROC_CODE_" />
<result property="activityId" column="ACTIVITY_ID_" />
<result property="name" column="NAME_" />
<result property="parentTaskId" column="PARENT_TASK_ID_" />
<result property="taskResult" column="TASK_RESULT_" />
<result property="taskState" column="TASK_STATE" />
<result property="description" column="DESCRIPTION_" />
<result property="taskDefKey" column="TASK_DEF_KEY_" />
<result property="assignee" column="ASSIGNEE_" />
<result property="createTime" column="CREATE_TIME_" />
<result property="finishTime" column="FINISH_TIME_" />
<result property="category" column="CATEGORY_" />
<result property="suspensionState" column="SUSPENSION_STATE_" />
<result property="tenantId" column="TENANT_ID_" />
<result property="formKey" column="FORM_KEY_" />
</resultMap>
<sql id="selectSysDingHiTaskVo">
select ID_, TASK_ID_, REV_, PROC_INST_ID_, PROC_CODE_, ACTIVITY_ID_, NAME_, PARENT_TASK_ID_, TASK_RESULT_, TASK_STATE, DESCRIPTION_, TASK_DEF_KEY_, ASSIGNEE_, CREATE_TIME_, FINISH_TIME_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_ from sys_ding_hi_task
</sql>
<select id="selectSysDingHiTaskList" parameterType="SysDingHiTask" resultMap="SysDingHiTaskResult">
<include refid="selectSysDingHiTaskVo"/>
<where>
<if test="taskId != null and taskId != ''"> and TASK_ID_ = #{taskId}</if>
<if test="rev != null "> and REV_ = #{rev}</if>
<if test="procInstId != null and procInstId != ''"> and PROC_INST_ID_ = #{procInstId}</if>
<if test="procCode != null and procCode != ''"> and PROC_CODE_ = #{procCode}</if>
<if test="activityId != null and activityId != ''"> and ACTIVITY_ID_ = #{activityId}</if>
<if test="name != null and name != ''"> and NAME_ = #{name}</if>
<if test="parentTaskId != null and parentTaskId != ''"> and PARENT_TASK_ID_ = #{parentTaskId}</if>
<if test="taskResult != null and taskResult != ''"> and TASK_RESULT_ = #{taskResult}</if>
<if test="taskState != null and taskState != ''"> and TASK_STATE = #{taskState}</if>
<if test="description != null and description != ''"> and DESCRIPTION_ = #{description}</if>
<if test="taskDefKey != null and taskDefKey != ''"> and TASK_DEF_KEY_ = #{taskDefKey}</if>
<if test="assignee != null and assignee != ''"> and ASSIGNEE_ = #{assignee}</if>
<if test="createTime != null "> and CREATE_TIME_ = #{createTime}</if>
<if test="finishTime != null "> and FINISH_TIME_ = #{finishTime}</if>
<if test="category != null and category != ''"> and CATEGORY_ = #{category}</if>
<if test="suspensionState != null "> and SUSPENSION_STATE_ = #{suspensionState}</if>
<if test="tenantId != null and tenantId != ''"> and TENANT_ID_ = #{tenantId}</if>
<if test="formKey != null and formKey != ''"> and FORM_KEY_ = #{formKey}</if>
</where>
</select>
<select id="selectSysDingHiTaskById" parameterType="String" resultMap="SysDingHiTaskResult">
<include refid="selectSysDingHiTaskVo"/>
where ID_ = #{id}
</select>
<insert id="insertSysDingHiTask" parameterType="SysDingHiTask">
insert into sys_ding_hi_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">ID_,</if>
<if test="taskId != null and taskId != ''">TASK_ID_,</if>
<if test="rev != null">REV_,</if>
<if test="procInstId != null">PROC_INST_ID_,</if>
<if test="procCode != null">PROC_CODE_,</if>
<if test="activityId != null">ACTIVITY_ID_,</if>
<if test="name != null">NAME_,</if>
<if test="parentTaskId != null">PARENT_TASK_ID_,</if>
<if test="taskResult != null and taskResult != ''">TASK_RESULT_,</if>
<if test="taskState != null">TASK_STATE,</if>
<if test="description != null">DESCRIPTION_,</if>
<if test="taskDefKey != null">TASK_DEF_KEY_,</if>
<if test="assignee != null">ASSIGNEE_,</if>
<if test="createTime != null">CREATE_TIME_,</if>
<if test="finishTime != null">FINISH_TIME_,</if>
<if test="category != null">CATEGORY_,</if>
<if test="suspensionState != null">SUSPENSION_STATE_,</if>
<if test="tenantId != null">TENANT_ID_,</if>
<if test="formKey != null">FORM_KEY_,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="taskId != null and taskId != ''">#{taskId},</if>
<if test="rev != null">#{rev},</if>
<if test="procInstId != null">#{procInstId},</if>
<if test="procCode != null">#{procCode},</if>
<if test="activityId != null">#{activityId},</if>
<if test="name != null">#{name},</if>
<if test="parentTaskId != null">#{parentTaskId},</if>
<if test="taskResult != null and taskResult != ''">#{taskResult},</if>
<if test="taskState != null">#{taskState},</if>
<if test="description != null">#{description},</if>
<if test="taskDefKey != null">#{taskDefKey},</if>
<if test="assignee != null">#{assignee},</if>
<if test="createTime != null">#{createTime},</if>
<if test="finishTime != null">#{finishTime},</if>
<if test="category != null">#{category},</if>
<if test="suspensionState != null">#{suspensionState},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="formKey != null">#{formKey},</if>
</trim>
</insert>
<update id="updateSysDingHiTask" parameterType="SysDingHiTask">
update sys_ding_hi_task
<trim prefix="SET" suffixOverrides=",">
<if test="taskId != null and taskId != ''">TASK_ID_ = #{taskId},</if>
<if test="rev != null">REV_ = #{rev},</if>
<if test="procInstId != null">PROC_INST_ID_ = #{procInstId},</if>
<if test="procCode != null">PROC_CODE_ = #{procCode},</if>
<if test="activityId != null">ACTIVITY_ID_ = #{activityId},</if>
<if test="name != null">NAME_ = #{name},</if>
<if test="parentTaskId != null">PARENT_TASK_ID_ = #{parentTaskId},</if>
<if test="taskResult != null and taskResult != ''">TASK_RESULT_ = #{taskResult},</if>
<if test="taskState != null">TASK_STATE = #{taskState},</if>
<if test="description != null">DESCRIPTION_ = #{description},</if>
<if test="taskDefKey != null">TASK_DEF_KEY_ = #{taskDefKey},</if>
<if test="assignee != null">ASSIGNEE_ = #{assignee},</if>
<if test="createTime != null">CREATE_TIME_ = #{createTime},</if>
<if test="finishTime != null">FINISH_TIME_ = #{finishTime},</if>
<if test="category != null">CATEGORY_ = #{category},</if>
<if test="suspensionState != null">SUSPENSION_STATE_ = #{suspensionState},</if>
<if test="tenantId != null">TENANT_ID_ = #{tenantId},</if>
<if test="formKey != null">FORM_KEY_ = #{formKey},</if>
</trim>
where ID_ = #{id}
</update>
<delete id="deleteSysDingHiTaskById" parameterType="String">
delete from sys_ding_hi_task where ID_ = #{id}
</delete>
<delete id="deleteSysDingHiTaskByIds" parameterType="String">
delete from sys_ding_hi_task where ID_ in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,132 @@
<?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.SysDingProcinstMapper">
<resultMap type="SysDingProcinst" id="SysDingProcinstResult">
<result property="id" column="ID_" />
<result property="rev" column="REV_" />
<result property="procInstId" column="PROC_INST_ID_" />
<result property="businessKey" column="BUSINESS_KEY_" />
<result property="corpId" column="CORP_ID_" />
<result property="startTime" column="START_TIME_" />
<result property="finishTime" column="FINISH_TIME_" />
<result property="eventType" column="EVENT_TYPE_" />
<result property="type" column="TYPE_" />
<result property="title" column="TITLE_" />
<result property="procCode" column="PROC_CODE" />
<result property="tenantId" column="TENANT_ID_" />
<result property="name" column="NAME_" />
<result property="dingUrl" column="DING_URL" />
<result property="procResult" column="PROC_RESULT_" />
<result property="startUserId" column="START_USER_ID_" />
</resultMap>
<sql id="selectSysDingProcinstVo">
select ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, START_USER_ID_,CORP_ID_, START_TIME_, FINISH_TIME_, EVENT_TYPE_, TYPE_, TITLE_, PROC_CODE, TENANT_ID_, NAME_, DING_URL, PROC_RESULT_ from sys_ding_procinst
</sql>
<select id="selectSysDingProcinstList" parameterType="SysDingProcinst" resultMap="SysDingProcinstResult">
<include refid="selectSysDingProcinstVo"/>
<where>
<if test="rev != null "> and REV_ = #{rev}</if>
<if test="procInstId != null and procInstId != ''"> and PROC_INST_ID_ = #{procInstId}</if>
<if test="businessKey != null and businessKey != ''"> and BUSINESS_KEY_ = #{businessKey}</if>
<if test="corpId != null and corpId != ''"> and CORP_ID_ = #{corpId}</if>
<if test="startTime != null "> and START_TIME_ = #{startTime}</if>
<if test="finishTime != null "> and FINISH_TIME_ = #{finishTime}</if>
<if test="eventType != null and eventType != ''"> and EVENT_TYPE_ = #{eventType}</if>
<if test="type != null and type != ''"> and TYPE_ = #{type}</if>
<if test="title != null and title != ''"> and TITLE_ = #{title}</if>
<if test="procCode != null and procCode != ''"> and PROC_CODE = #{procCode}</if>
<if test="tenantId != null and tenantId != ''"> and TENANT_ID_ = #{tenantId}</if>
<if test="name != null and name != ''"> and NAME_ = #{name}</if>
<if test="dingUrl != null and dingUrl != ''"> and DING_URL = #{dingUrl}</if>
<if test="procResult != null and procResult != ''"> and PROC_RESULT_ = #{procResult}</if>
<if test="startUserId != null and startUserId != ''"> and START_USER_ID_ = #{startUserId}</if>
</where>
</select>
<select id="selectSysDingProcinstById" parameterType="Long" resultMap="SysDingProcinstResult">
<include refid="selectSysDingProcinstVo"/>
where ID_ = #{id}
</select>
<select id="selectSysDingProcinstByProcInstId" parameterType="String" resultMap="SysDingProcinstResult">
<include refid="selectSysDingProcinstVo"/>
where PROC_INST_ID_ = #{procInstId}
</select>
<insert id="insertSysDingProcinst" parameterType="SysDingProcinst" useGeneratedKeys="true" keyProperty="id">
insert into sys_ding_procinst
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="rev != null">REV_,</if>
<if test="procInstId != null and procInstId != ''">PROC_INST_ID_,</if>
<if test="businessKey != null">BUSINESS_KEY_,</if>
<if test="corpId != null and corpId != ''">CORP_ID_,</if>
<if test="startTime != null">START_TIME_,</if>
<if test="finishTime != null">FINISH_TIME_,</if>
<if test="eventType != null">EVENT_TYPE_,</if>
<if test="type != null">TYPE_,</if>
<if test="title != null">TITLE_,</if>
<if test="procCode != null">PROC_CODE,</if>
<if test="tenantId != null">TENANT_ID_,</if>
<if test="name != null">NAME_,</if>
<if test="dingUrl != null">DING_URL,</if>
<if test="procResult != null">PROC_RESULT_,</if>
<if test="startUserId != null and startUserId != ''"> START_USER_ID_,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rev != null">#{rev},</if>
<if test="procInstId != null and procInstId != ''">#{procInstId},</if>
<if test="businessKey != null">#{businessKey},</if>
<if test="corpId != null and corpId != ''">#{corpId},</if>
<if test="startTime != null">#{startTime},</if>
<if test="finishTime != null">#{finishTime},</if>
<if test="eventType != null">#{eventType},</if>
<if test="type != null">#{type},</if>
<if test="title != null">#{title},</if>
<if test="procCode != null">#{procCode},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="name != null">#{name},</if>
<if test="dingUrl != null">#{dingUrl},</if>
<if test="procResult != null">#{procResult},</if>
<if test="startUserId != null and startUserId != ''"> #{startUserId},</if>
</trim>
</insert>
<update id="updateSysDingProcinst" parameterType="SysDingProcinst">
update sys_ding_procinst
<trim prefix="SET" suffixOverrides=",">
<if test="rev != null">REV_ = #{rev},</if>
<if test="procInstId != null and procInstId != ''">PROC_INST_ID_ = #{procInstId},</if>
<if test="businessKey != null">BUSINESS_KEY_ = #{businessKey},</if>
<if test="corpId != null and corpId != ''">CORP_ID_ = #{corpId},</if>
<if test="startTime != null">START_TIME_ = #{startTime},</if>
<if test="finishTime != null">FINISH_TIME_ = #{finishTime},</if>
<if test="eventType != null">EVENT_TYPE_ = #{eventType},</if>
<if test="type != null">TYPE_ = #{type},</if>
<if test="title != null">TITLE_ = #{title},</if>
<if test="procCode != null">PROC_CODE = #{procCode},</if>
<if test="tenantId != null">TENANT_ID_ = #{tenantId},</if>
<if test="name != null">NAME_ = #{name},</if>
<if test="dingUrl != null">DING_URL = #{dingUrl},</if>
<if test="procResult != null">PROC_RESULT_ = #{procResult},</if>
<if test="startUserId != null and startUserId != ''"> START_USER_ID_ = #{startUserId},</if>
</trim>
where ID_ = #{id}
</update>
<delete id="deleteSysDingProcinstById" parameterType="Long">
delete from sys_ding_procinst where ID_ = #{id}
</delete>
<delete id="deleteSysDingProcinstByIds" parameterType="String">
delete from sys_ding_procinst where ID_ in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,134 @@
<?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.SysDingRuTaskMapper">
<resultMap type="SysDingRuTask" id="SysDingRuTaskResult">
<result property="id" column="ID_" />
<result property="rev" column="REV_" />
<result property="procInstId" column="PROC_INST_ID_" />
<result property="procCode" column="PROC_CODE_" />
<result property="activityId" column="ACTIVITY_ID_" />
<result property="name" column="NAME_" />
<result property="parentTaskId" column="PARENT_TASK_ID_" />
<result property="description" column="DESCRIPTION_" />
<result property="taskDefKey" column="TASK_DEF_KEY_" />
<result property="assignee" column="ASSIGNEE_" />
<result property="createTime" column="CREATE_TIME_" />
<result property="finishTime" column="FINISH_TIME_" />
<result property="taskState" column="TASK_STATE" />
<result property="category" column="CATEGORY_" />
<result property="suspensionState" column="SUSPENSION_STATE_" />
<result property="tenantId" column="TENANT_ID_" />
<result property="formKey" column="FORM_KEY_" />
</resultMap>
<sql id="selectSysDingRuTaskVo">
select ID_, REV_, PROC_INST_ID_, PROC_CODE_, ACTIVITY_ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, TASK_DEF_KEY_, ASSIGNEE_, CREATE_TIME_, FINISH_TIME_, TASK_STATE, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_ from sys_ding_ru_task
</sql>
<select id="selectSysDingRuTaskList" parameterType="SysDingRuTask" resultMap="SysDingRuTaskResult">
<include refid="selectSysDingRuTaskVo"/>
<where>
<if test="rev != null "> and REV_ = #{rev}</if>
<if test="procInstId != null and procInstId != ''"> and PROC_INST_ID_ = #{procInstId}</if>
<if test="procCode != null and procCode != ''"> and PROC_CODE_ = #{procCode}</if>
<if test="activityId != null and activityId != ''"> and ACTIVITY_ID_ = #{activityId}</if>
<if test="name != null and name != ''"> and NAME_ = #{name}</if>
<if test="parentTaskId != null and parentTaskId != ''"> and PARENT_TASK_ID_ = #{parentTaskId}</if>
<if test="description != null and description != ''"> and DESCRIPTION_ = #{description}</if>
<if test="taskDefKey != null and taskDefKey != ''"> and TASK_DEF_KEY_ = #{taskDefKey}</if>
<if test="assignee != null and assignee != ''"> and ASSIGNEE_ = #{assignee}</if>
<if test="createTime != null "> and CREATE_TIME_ = #{createTime}</if>
<if test="finishTime != null "> and FINISH_TIME_ = #{finishTime}</if>
<if test="taskState != null and taskState != ''"> and TASK_STATE = #{taskState}</if>
<if test="category != null and category != ''"> and CATEGORY_ = #{category}</if>
<if test="suspensionState != null "> and SUSPENSION_STATE_ = #{suspensionState}</if>
<if test="tenantId != null and tenantId != ''"> and TENANT_ID_ = #{tenantId}</if>
<if test="formKey != null and formKey != ''"> and FORM_KEY_ = #{formKey}</if>
</where>
</select>
<select id="selectSysDingRuTaskById" parameterType="String" resultMap="SysDingRuTaskResult">
<include refid="selectSysDingRuTaskVo"/>
where ID_ = #{id}
</select>
<insert id="insertSysDingRuTask" parameterType="SysDingRuTask">
insert into sys_ding_ru_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">ID_,</if>
<if test="rev != null">REV_,</if>
<if test="procInstId != null">PROC_INST_ID_,</if>
<if test="procCode != null">PROC_CODE_,</if>
<if test="activityId != null">ACTIVITY_ID_,</if>
<if test="name != null">NAME_,</if>
<if test="parentTaskId != null">PARENT_TASK_ID_,</if>
<if test="description != null">DESCRIPTION_,</if>
<if test="taskDefKey != null">TASK_DEF_KEY_,</if>
<if test="assignee != null">ASSIGNEE_,</if>
<if test="createTime != null">CREATE_TIME_,</if>
<if test="finishTime != null">FINISH_TIME_,</if>
<if test="taskState != null">TASK_STATE,</if>
<if test="category != null">CATEGORY_,</if>
<if test="suspensionState != null">SUSPENSION_STATE_,</if>
<if test="tenantId != null">TENANT_ID_,</if>
<if test="formKey != null">FORM_KEY_,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="rev != null">#{rev},</if>
<if test="procInstId != null">#{procInstId},</if>
<if test="procCode != null">#{procCode},</if>
<if test="activityId != null">#{activityId},</if>
<if test="name != null">#{name},</if>
<if test="parentTaskId != null">#{parentTaskId},</if>
<if test="description != null">#{description},</if>
<if test="taskDefKey != null">#{taskDefKey},</if>
<if test="assignee != null">#{assignee},</if>
<if test="createTime != null">#{createTime},</if>
<if test="finishTime != null">#{finishTime},</if>
<if test="taskState != null">#{taskState},</if>
<if test="category != null">#{category},</if>
<if test="suspensionState != null">#{suspensionState},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="formKey != null">#{formKey},</if>
</trim>
</insert>
<update id="updateSysDingRuTask" parameterType="SysDingRuTask">
update sys_ding_ru_task
<trim prefix="SET" suffixOverrides=",">
REV_ = REV_+1,
<if test="procInstId != null">PROC_INST_ID_ = #{procInstId},</if>
<if test="procCode != null">PROC_CODE_ = #{procCode},</if>
<if test="activityId != null">ACTIVITY_ID_ = #{activityId},</if>
<if test="name != null">NAME_ = #{name},</if>
<if test="parentTaskId != null">PARENT_TASK_ID_ = #{parentTaskId},</if>
<if test="description != null">DESCRIPTION_ = #{description},</if>
<if test="taskDefKey != null">TASK_DEF_KEY_ = #{taskDefKey},</if>
<if test="assignee != null">ASSIGNEE_ = #{assignee},</if>
<if test="createTime != null">CREATE_TIME_ = #{createTime},</if>
<if test="finishTime != null">FINISH_TIME_ = #{finishTime},</if>
<if test="taskState != null">TASK_STATE = #{taskState},</if>
<if test="category != null">CATEGORY_ = #{category},</if>
<if test="suspensionState != null">SUSPENSION_STATE_ = #{suspensionState},</if>
<if test="tenantId != null">TENANT_ID_ = #{tenantId},</if>
<if test="formKey != null">FORM_KEY_ = #{formKey},</if>
</trim>
where ID_ = #{id}
</update>
<delete id="deleteSysDingRuTaskById" parameterType="String">
delete from sys_ding_ru_task where ID_ = #{id}
</delete>
<delete id="deleteSysDingRuTaskByIds" parameterType="String">
delete from sys_ding_ru_task where ID_ in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -187,6 +187,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="selectUserByDingUserId" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.ding_user_id = #{dingUserId}
</select>
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}