会签功能开发
parent
b86b55f5f4
commit
f25b26d2c8
|
@ -4,10 +4,7 @@ import cn.palmte.work.bean.*;
|
|||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.pojo.ActHisTask;
|
||||
import cn.palmte.work.service.*;
|
||||
import cn.palmte.work.utils.ActUtil;
|
||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.*;
|
||||
import cn.palmte.work.utils.excel.ExportExcelUtils;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
@ -33,9 +30,7 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -551,10 +546,15 @@ public class ProjectController extends BaseController {
|
|||
|
||||
//审核记录
|
||||
List<ProjectTaskRecord> list = projectTaskRecordService.list(id);
|
||||
String huiQianFile = "";
|
||||
if (!list.isEmpty()) {
|
||||
Optional<ProjectTaskRecord> first = list.stream().filter(r -> StrKit.notBlank(r.getFileUrl())).max(Comparator.comparingInt(ProjectTaskRecord::getId));
|
||||
if (first.isPresent()) {
|
||||
huiQianFile = first.get().getFileUrl();
|
||||
}
|
||||
model.put("taskRecords", list);
|
||||
}
|
||||
|
||||
model.put("huiQianFile", huiQianFile);
|
||||
//当前审批任务
|
||||
Task currentTask = actUtil.getCurrentTask(project.getId());
|
||||
model.put("currentTaskName", currentTask==null ? "" : currentTask.getName());
|
||||
|
@ -577,8 +577,8 @@ public class ProjectController extends BaseController {
|
|||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/skipTask/{projectId}/{approvetype}")
|
||||
public ResponseMsg skipTask(@PathVariable int projectId, @PathVariable int approvetype) {
|
||||
return projectService.skipTask(projectId, approvetype);
|
||||
public ResponseMsg skipTask(@PathVariable int projectId, @PathVariable int approvetype, @RequestBody String json) {
|
||||
return projectService.skipTask(projectId, json, approvetype);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,4 +69,10 @@ public class ProjectTaskRecord {
|
|||
@Column(name = "task_index")
|
||||
private int taskIndex;
|
||||
|
||||
/**
|
||||
* 会签单文件访问地址
|
||||
*/
|
||||
@Column(name = "file_url")
|
||||
private String fileUrl;
|
||||
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ActProcInsService {
|
|||
taskService.complete(taskId);
|
||||
|
||||
projectTaskRecordService.saveTaskRecord(Integer.parseInt(instance.getBusinessKey()),
|
||||
task, ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus(), ActConstant.TASK_INDEX_FIRST_USER_TASK, comment);
|
||||
task, ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus(), ActConstant.TASK_INDEX_FIRST_USER_TASK, comment, "");
|
||||
|
||||
return instance.getId();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.ApproveStatusEnum;
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
|
||||
import cn.palmte.work.model.*;
|
||||
|
@ -58,10 +59,10 @@ public class ActTaskDefService {
|
|||
String message = json.getString("message");
|
||||
int type = json.getInteger("type");
|
||||
|
||||
completeTask(taskId, procInsId, message, type);
|
||||
completeTask(taskId, procInsId, message, type, "");
|
||||
}
|
||||
|
||||
private void completeTask(String taskId, String procInsId, String message, int type) {
|
||||
private void completeTask(String taskId, String procInsId, String message, int type, String fileUrl) {
|
||||
String userId = InterfaceUtil.getAdminId() + "";
|
||||
Authentication.setAuthenticatedUserId(userId);
|
||||
taskService.addComment(taskId, procInsId, message);
|
||||
|
@ -78,7 +79,7 @@ public class ActTaskDefService {
|
|||
|
||||
//保存审批记录
|
||||
projectTaskRecordService.saveTaskRecord(Integer.parseInt(processInstance.getBusinessKey()),
|
||||
currentTask, type, actTaskDef.getTaskIndex(), message);
|
||||
currentTask, type, actTaskDef.getTaskIndex(), message, fileUrl);
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,7 +93,7 @@ public class ActTaskDefService {
|
|||
public void completeTaskByProcInsId(String procInsId, int type, String comment) {
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
for (Task task : taskList) {
|
||||
completeTask(task.getId(), procInsId, comment, type);
|
||||
completeTask(task.getId(), procInsId, comment, type, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,19 +101,18 @@ public class ActTaskDefService {
|
|||
* 预算跳过剩下审批任务直接到执行董事节点
|
||||
* @param procInsId
|
||||
*/
|
||||
public void skipTaskByProcInsId(String procInsId) {
|
||||
public ResponseMsg skipTaskByProcInsId(String procInsId, String fileUrl, int approvetype) {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInsId).singleResult();
|
||||
if (ActConstant.PROCESS_DEFKEY_BUDGET.equals(processInstance.getProcessDefinitionKey())) {
|
||||
throw new RuntimeException("只有预算审批流程才能执行会签");
|
||||
if (!ActConstant.PROCESS_DEFKEY_BUDGET.equals(processInstance.getProcessDefinitionKey())) {
|
||||
return ResponseMsg.buildFailedMsg("只有预算审批流程才能执行会签");
|
||||
}
|
||||
|
||||
//完成当前任务
|
||||
Task task = taskService.createTaskQuery().processInstanceId(procInsId).singleResult();
|
||||
if ("执行董事".equals(task.getName())) {
|
||||
throw new RuntimeException("当前状态不能用会签功能,请使用审批功能。");
|
||||
return ResponseMsg.buildFailedMsg("当前状态不能用会签功能,请使用审批功能。");
|
||||
}
|
||||
completeTask(task.getId(), procInsId, "申请会签", ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus());
|
||||
|
||||
completeTask(task.getId(), procInsId, "申请会签", ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus(), fileUrl);
|
||||
|
||||
//非执行董事节点自动跳过
|
||||
task = taskService.createTaskQuery().processInstanceId(procInsId).singleResult();
|
||||
|
@ -120,6 +120,8 @@ public class ActTaskDefService {
|
|||
completeSkipTask(task, processInstance, "会签,任务自动审批通过", ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus());
|
||||
task = taskService.createTaskQuery().processInstanceId(procInsId).singleResult();
|
||||
}
|
||||
|
||||
return ResponseMsg.buildSuccessMsg("会签成功", approvetype);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -222,16 +222,25 @@ public class ProjectService {
|
|||
}
|
||||
|
||||
|
||||
public ResponseMsg skipTask(int projectId, int approvetype) {
|
||||
/**
|
||||
* 会签
|
||||
*
|
||||
* @param projectId
|
||||
* @param json
|
||||
* @param approvetype
|
||||
* @return
|
||||
*/
|
||||
public ResponseMsg skipTask(int projectId, String json, int approvetype) {
|
||||
List<ProjectInstanceRelation> relationList = projectInstanceRelationRepository.findByProjectIdOrderByCreateTimeDesc(projectId);
|
||||
if (relationList == null || relationList.isEmpty()) {
|
||||
return ResponseMsg.buildFailedMsg("会签失败");
|
||||
}
|
||||
|
||||
ProjectInstanceRelation projectInstanceRelation = relationList.get(0);
|
||||
actTaskDefService.skipTaskByProcInsId(projectInstanceRelation.getProcessInsId());
|
||||
JSONObject obj = JSON.parseObject(json);
|
||||
String fileUrl = obj.getString("fileUrl");
|
||||
|
||||
return ResponseMsg.buildSuccessMsg("会签成功", approvetype);
|
||||
ProjectInstanceRelation projectInstanceRelation = relationList.get(0);
|
||||
return actTaskDefService.skipTaskByProcInsId(projectInstanceRelation.getProcessInsId(), fileUrl, approvetype);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ProjectTaskRecordService {
|
|||
* @param status
|
||||
* @param comment
|
||||
*/
|
||||
public void saveTaskRecord(int projectId, Task task, int status, int taskIndex, String comment) {
|
||||
public void saveTaskRecord(int projectId, Task task, int status, int taskIndex, String comment, String fileUrl) {
|
||||
task.getProcessDefinitionId();
|
||||
ProjectTaskRecord record = new ProjectTaskRecord();
|
||||
record.setProjectId(projectId);
|
||||
|
@ -50,6 +50,7 @@ public class ProjectTaskRecordService {
|
|||
record.setAssigneeName(InterfaceUtil.getAdmin().getRealName());
|
||||
record.setTaskIndex(taskIndex);
|
||||
record.setCreateTime(new Date());
|
||||
record.setFileUrl(fileUrl);
|
||||
try {
|
||||
projectTaskRecordRepository.save(record);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -115,7 +115,7 @@ public class UploadUtil {
|
|||
boolean ispic = isPic(suffix);
|
||||
String dateString = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
//保存的新名字
|
||||
String newName = uuid + "." + suffix;
|
||||
String newName = prefix + "_" + DateKit.toStr(new Date(), "yyyyMMddHHmmss") + "." + suffix;
|
||||
result.setNewName(newName);
|
||||
|
||||
String path = "file/" + dateString + "/" + newName;
|
||||
|
|
|
@ -29,10 +29,10 @@ spring.freemarker.expose-session-attributes=true
|
|||
spring.freemarker.allow-request-override=true
|
||||
spring.freemarker.allow-session-override=true
|
||||
|
||||
multipart.maxFileSize=10Mb
|
||||
multipart.maxRequestSize=10Mb
|
||||
spring.http.multipart.maxFileSize=10Mb
|
||||
spring.http.multipart.maxRequestSize=10Mb
|
||||
multipart.maxFileSize=20Mb
|
||||
multipart.maxRequestSize=20Mb
|
||||
spring.http.multipart.maxFileSize=20Mb
|
||||
spring.http.multipart.maxRequestSize=20Mb
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -453,7 +453,9 @@
|
|||
|
||||
<div class="am-tabs-bd">
|
||||
<div class="am-tab-panel am-fade am-in" id="tab3">
|
||||
|
||||
<#if huiQianFile! !="">
|
||||
<div style="float: right"><a href="${huiQianFile}" download target="_blank">下载会签单</a></div>
|
||||
</#if>
|
||||
<div class="am-tabs am-margin" data-am-tabs id="subTab">
|
||||
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
||||
<li class="am-active"><a href="#tab35">预算信息</a></li>
|
||||
|
@ -1934,6 +1936,7 @@
|
|||
</div>
|
||||
<div class="time-axis-title">
|
||||
${node.taskComment}
|
||||
<#if node.fileUrl! !=""><a href="${node.fileUrl}" download target="_blank">下载会签单</a></#if>
|
||||
</div>
|
||||
</li>
|
||||
</#list>
|
||||
|
@ -2479,24 +2482,31 @@
|
|||
<div class="am-modal-bd" style="border-bottom: none">
|
||||
<form method="post" class="am-form" id="tmpForm" action="${base}/procurement/type/save">
|
||||
<div class="am-tabs am-margin" data-am-tabs>
|
||||
<div class="am-tabs-bd">
|
||||
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">会签单</div>
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-4 switch-button" style="height: 25px;">
|
||||
<label class="am-radio-inline">
|
||||
<input type="file" name="myFile" />
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-hide-sm-only am-u-md-1" style="color: red;"></div>
|
||||
<div class="am-u-sm-2 am-u-md-5 input-msg"></div>
|
||||
</div>
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>会签单</div>
|
||||
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input type="text" id="icon" name="icon" maxlength="500"
|
||||
value="" required
|
||||
placeholder="请上传会签单( *.gif,*.jpg,*.jpeg,*.png,*.pdf )"/>
|
||||
</div>
|
||||
|
||||
<div class="am-form-file am-text-xs">
|
||||
<button type="button" class="am-btn am-btn-primary am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 上传
|
||||
</button>
|
||||
<input id="fileupload_button_icon" type="file" name="files[]" multiple>
|
||||
</div>
|
||||
|
||||
<!-- The global progress bar -->
|
||||
<div id="progress-area-icon" class="am-margin-top-sm am-hide">
|
||||
<div id="progress-text-icon" class="am-text-xs am-text-right"></div>
|
||||
<div id="progress" class="am-progress am-progress-xs">
|
||||
<div class="am-progress-bar" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -2545,6 +2555,13 @@
|
|||
<script src="${base}/assets/js/project_budget_cost_project_manage.js"></script>
|
||||
<script src="${base}/assets/js/project_budget_plan.js"></script>
|
||||
<script src="${base}/layui/layui.js"></script>
|
||||
|
||||
<script src="${base}/common/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
|
||||
<script type="text/javascript" src="${base}/common/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="${base}/common/jQuery-File-Upload/js/jquery.fileupload.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/jquery.fileupload-process.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/jquery.fileupload-validate.js"></script>
|
||||
|
||||
</@defaultLayout.layout>
|
||||
|
||||
<script>
|
||||
|
@ -2577,8 +2594,79 @@
|
|||
$("#incomeAddBtn").click(function () {
|
||||
appendTrIncome();
|
||||
});
|
||||
|
||||
|
||||
//上传会签单
|
||||
generateFileupload('icon');
|
||||
});
|
||||
|
||||
|
||||
//上传会签单
|
||||
var generateFileupload = function (name) {
|
||||
var progressArea = $("#progress-area-" + name);//div
|
||||
var progressText = $("#progress-text-" + name);//进度条提示
|
||||
var progressBar = $(".am-progress-bar");//进度条
|
||||
|
||||
console.info(name);
|
||||
|
||||
$("#fileupload_button_" + name).fileupload({
|
||||
url: base + "/file/upload",
|
||||
dataType: 'json',
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf)$/i,
|
||||
maxFileSize: 10 * 1024 * 1024,
|
||||
maxNumberOfFiles: 1,
|
||||
messages: {
|
||||
maxFileSize: '最大允许上传的图片大小为10M',
|
||||
acceptFileTypes: '文件格式不正确,请上传gif、jpg、jpeg、png类型的图片文件'
|
||||
},
|
||||
start: function (e) {
|
||||
progressArea.removeClass("am-hide");
|
||||
progressText.removeClass("am-text-danger");
|
||||
progressText.html("");
|
||||
progressBar.css("width", "0%");
|
||||
},
|
||||
done: function (e, data) {
|
||||
console.log("--data-->"+ JSON.stringify(data.result.data));
|
||||
//设置服务器返回的url
|
||||
$("#" + name).val(data.result.data.url);
|
||||
setTimeout(function () {
|
||||
progressArea.addClass("am-hide");
|
||||
}, 1500);
|
||||
},
|
||||
progressall: function (e, data) {
|
||||
var progress = parseInt(data.loaded / data.total * 100, 10);
|
||||
console.log(progress);
|
||||
progressBar.css("width", progress + "%");
|
||||
progressText.html(progress + "%");
|
||||
},
|
||||
error: function (jqXHR2, textStatus, errorThrown) {
|
||||
progressArea.removeClass("am-hide");
|
||||
progressText.addClass("am-text-danger");
|
||||
progressText.html("imageupload error!");
|
||||
progressBar.css("width", "0%");
|
||||
setTimeout(function () {
|
||||
progressArea.addClass("am-hide");
|
||||
}, 2000);
|
||||
},
|
||||
fail: function (jqXHR2, textStatus) {
|
||||
progressArea.removeClass("am-hide");
|
||||
progressText.addClass("am-text-danger");
|
||||
progressText.html("imageupload fail!");
|
||||
progressBar.css("width", "0%");
|
||||
setTimeout(function () {
|
||||
progressArea.addClass("am-hide");
|
||||
}, 2000);
|
||||
},
|
||||
processfail: function (e, data) {
|
||||
var currentFile = data.files[data.index];
|
||||
if (data.files.error && currentFile.error) {
|
||||
parent.layer.msg(currentFile.error);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var completeTask = function (projectId) {
|
||||
var message = $("#doc-vld-ta-2").val();
|
||||
var approvetype = $("#type").val();
|
||||
|
@ -2618,10 +2706,17 @@
|
|||
};
|
||||
|
||||
|
||||
//会签
|
||||
var completeHuiQianTask = function (projectId) {
|
||||
var approvetype = $("#type").val();
|
||||
var fileUrl = $("#icon").val();
|
||||
if (fileUrl == '') {
|
||||
alert("请上传会签单");
|
||||
return;
|
||||
}
|
||||
var params = {
|
||||
message: ""
|
||||
message: "",
|
||||
fileUrl: fileUrl
|
||||
};
|
||||
$.ajax({
|
||||
url: '${base}/project/skipTask/' + projectId + "/" + approvetype,
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
</div>
|
||||
<div class="time-axis-title">
|
||||
${node.taskComment}
|
||||
<#if node.fileUrl! !=""><a href="${node.fileUrl}" download target="_blank">下载会签单</a></#if>
|
||||
</div>
|
||||
</li>
|
||||
</#list>
|
||||
|
|
Loading…
Reference in New Issue