|
@@ -25,7 +25,6 @@ import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.impl.identity.Authentication;
|
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -127,9 +126,9 @@ public class TApproveReserveInvoiceController extends BaseController {
|
|
|
String applyUser = "";
|
|
|
for (String id : ids) {
|
|
|
TInvoiceBookingworkticket invoice = workService.getById(id);
|
|
|
- applyUser=invoice.getCreaterCode().toString();
|
|
|
- invoice.setStatus(0L);
|
|
|
- workService.updateById(invoice);
|
|
|
+ applyUser = invoice.getCreaterCode().toString();
|
|
|
+// invoice.setStatus(0L);
|
|
|
+// workService.updateById(invoice);
|
|
|
switch (invoice.getWorkArea()) {
|
|
|
case "310裂解区":
|
|
|
case "700开关锅炉":
|
|
@@ -165,60 +164,38 @@ public class TApproveReserveInvoiceController extends BaseController {
|
|
|
// devSupId = "10081";
|
|
|
break;
|
|
|
}
|
|
|
- if (DateUtils.dateTime(invoice.getCreatedate()).equals(DateUtils.dateTime(invoice.getWorkStartTime()))){
|
|
|
- tApproveReserveInvoice.setIsToday("1");
|
|
|
- }else {
|
|
|
- tApproveReserveInvoice.setIsToday("0");
|
|
|
- }
|
|
|
- List<TInvoiceWorkcontent> workcontents = invoiceWorkcontentMapper.selectTInvoiceWorkcontentBybookingticketId(Long.valueOf(invoice.getId()));
|
|
|
- for (TInvoiceWorkcontent tInvoiceWorkcontent : workcontents) {
|
|
|
- /* if (tInvoiceWorkcontent.getWorkType()==1L||tInvoiceWorkcontent.getWorkType()==15L){
|
|
|
- tApproveReserveInvoice.setIsSpecial("1");
|
|
|
- break;
|
|
|
- }
|
|
|
- else{
|
|
|
- tApproveReserveInvoice.setIsSpecial("0");
|
|
|
- }*/
|
|
|
- }
|
|
|
}
|
|
|
//开始工作流、监听
|
|
|
- Authentication.setAuthenticatedUserId(applyUser);
|
|
|
+ Authentication.setAuthenticatedUserId(applyUser);//设置当前申请人
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
variables.put("applyUser", applyUser);
|
|
|
variables.put("yhzgusers", tApproveReserveInvoice.getUserSupId().toString());//用户主管
|
|
|
variables.put("zzzgusers", devSupId);//装置主管
|
|
|
SysUser sysUser = new SysUser();
|
|
|
sysUser.setDeptId(103L);
|
|
|
- if ("1".equals(tApproveReserveInvoice.getIsToday())) {
|
|
|
- String devEngineerId="";
|
|
|
- sysUser.setRoleId(20003L);//装置工程师
|
|
|
- List<SysUser> sysUsers = iSysUserService.selectUserListByRoleAndDept(sysUser);
|
|
|
- if (CollectionUtils.isNotEmpty(sysUsers)) {
|
|
|
- for (SysUser user : sysUsers) {
|
|
|
- devEngineerId+=user.getUserId()+",";
|
|
|
- }
|
|
|
- devEngineerId = devEngineerId.substring(0, devEngineerId.length() - 1);
|
|
|
- variables.put("zzgcsusers", devEngineerId);//装置工程师
|
|
|
- }else{
|
|
|
- return AjaxResult.error("该部门不存在装置工程师");
|
|
|
- }
|
|
|
+
|
|
|
+ //添加装置工程师
|
|
|
+ String devEngineerId = "";
|
|
|
+ sysUser.setRoleId(20003L);//装置工程师
|
|
|
+ List<SysUser> sysUsers = iSysUserService.selectUserListByRoleAndDept(sysUser);
|
|
|
+ for (SysUser user : sysUsers) {
|
|
|
+ devEngineerId += user.getUserId() + ",";
|
|
|
}
|
|
|
- if ("1".equals(tApproveReserveInvoice.getIsSpecial())) {
|
|
|
- String managerconId="";
|
|
|
- sysUser.setRoleId(20013L);//装置副经理
|
|
|
- List<SysUser> sysUsers = iSysUserService.selectUserListByRoleAndDept(sysUser);
|
|
|
- sysUser.setRoleId(20006L);//装置经理
|
|
|
- sysUsers.addAll(iSysUserService.selectUserListByRoleAndDept(sysUser));
|
|
|
- if (CollectionUtils.isNotEmpty(sysUsers)) {
|
|
|
- for (SysUser user : sysUsers) {
|
|
|
- managerconId+=user.getUserId()+",";
|
|
|
- }
|
|
|
- managerconId = managerconId.substring(0, managerconId.length() - 1);
|
|
|
- variables.put("zzjlusers", managerconId);//装置经理
|
|
|
- }else{
|
|
|
- return AjaxResult.error("该部门不存在装置经理");
|
|
|
- }
|
|
|
+ devEngineerId = devEngineerId.substring(0, devEngineerId.length() - 1);
|
|
|
+ variables.put("zzgcsusers", devEngineerId);
|
|
|
+
|
|
|
+ //添加装置经理(副)
|
|
|
+ String managerconId = "";
|
|
|
+ sysUser.setRoleId(20013L);//装置副经理
|
|
|
+ sysUsers = iSysUserService.selectUserListByRoleAndDept(sysUser);
|
|
|
+ sysUser.setRoleId(20006L);//装置经理
|
|
|
+ sysUsers.addAll(iSysUserService.selectUserListByRoleAndDept(sysUser));
|
|
|
+ for (SysUser user : sysUsers) {
|
|
|
+ managerconId += user.getUserId() + ",";
|
|
|
}
|
|
|
+ managerconId = managerconId.substring(0, managerconId.length() - 1);
|
|
|
+ variables.put("zzjlusers", managerconId);
|
|
|
+
|
|
|
variables.put("yhzgTaskCreateListener", new YhzgTaskCreateListener());//用户主管监听发送邮件
|
|
|
variables.put("zzzgTaskCreateListener", new ZzzgTaskCreateListener());//装置主管监听发送邮件
|
|
|
variables.put("zzgcsTaskCreateListener", new ZzgcsTaskCreateListener());//装置工程师监听发送邮件
|
|
@@ -263,52 +240,30 @@ public class TApproveReserveInvoiceController extends BaseController {
|
|
|
}
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
List<TInvoiceWorkcontent> workcontents = invoiceWorkcontentMapper.selectTInvoiceWorkcontentBybookingticketId(Long.valueOf(invoice.getInvoiceId()));
|
|
|
- if (task.getName().equals("用户主管签字确认")) {
|
|
|
- invoice.setDevSupId(getUserId());
|
|
|
- invoiceBook.setStatus(2L);
|
|
|
- }
|
|
|
if (task.getName().equals("装置主管签字确认")) {
|
|
|
invoice.setDevSupId(getUserId());
|
|
|
- if (DateUtils.dateTime(invoiceBook.getCreatedate()).equals(DateUtils.dateTime(invoiceBook.getWorkStartTime()))) {
|
|
|
- invoiceBook.setStatus(5L);
|
|
|
- }else {
|
|
|
- for (TInvoiceWorkcontent workcontent : workcontents) {
|
|
|
- /* if (workcontent.getWorkType() == 1 || workcontent.getWorkType() == 15) {
|
|
|
- invoiceBook.setStatus(6L);
|
|
|
- break;
|
|
|
- } else {
|
|
|
- invoiceBook.setStatus(3L);
|
|
|
- }*/
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
if (task.getName().equals("装置工程师签字确认")) {
|
|
|
invoice.setDevEngineerId(getUserId());
|
|
|
- for (TInvoiceWorkcontent workcontent : workcontents) {
|
|
|
- /* if (workcontent.getWorkType() == 1 || workcontent.getWorkType() == 15) {
|
|
|
- invoiceBook.setStatus(6L);
|
|
|
- break;
|
|
|
- } else {
|
|
|
- invoiceBook.setStatus(3L);
|
|
|
- }*/
|
|
|
- }
|
|
|
}
|
|
|
if (task.getName().equals("装置经理签字确认")) {
|
|
|
invoice.setManagerconId(getUserId());
|
|
|
- invoiceBook.setStatus(3L);
|
|
|
}
|
|
|
if (DateUtils.dateTime(invoiceBook.getCreatedate()).equals(DateUtils.dateTime(invoiceBook.getWorkStartTime()))) {
|
|
|
param.put("istoday", "1");
|
|
|
+ out:for (TInvoiceWorkcontent workcontent : workcontents) {
|
|
|
+ for (String workType : workcontent.getWorkType().split(",")) {
|
|
|
+ if (workType.equals("1")||workType.equals("15")) {
|
|
|
+ param.put("isspecial", "1");
|
|
|
+ break out;
|
|
|
+ } else {
|
|
|
+ param.put("isspecial", "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
param.put("istoday", "0");
|
|
|
- }
|
|
|
- for (TInvoiceWorkcontent workcontent : workcontents) {
|
|
|
- /* if (workcontent.getWorkType() == 1 || workcontent.getWorkType() == 15) {
|
|
|
- param.put("isspecial", "1");
|
|
|
- break;
|
|
|
- } else {
|
|
|
- param.put("isspecial", "0");
|
|
|
- }*/
|
|
|
+ param.put("isspecial", "0");
|
|
|
}
|
|
|
param.put("condition", devTask.getCondition());
|
|
|
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|