package com.idea.oa.flow2.controller; import com.github.pagehelper.PageInfo; import com.idea.oa.activiti.service.ProActiService; import com.idea.oa.apply.model.*; import com.idea.oa.apply.service.ApplyAddWorkTimeService; //import com.idea.oa.apply.service.ApplyOffWorkTimeService; import com.idea.oa.apply.util.constant.ConstantFlowType; import com.idea.oa.apply.util.service.RunerLoadOneService; import com.idea.oa.flow2.model.FlowMain; import com.idea.oa.flow2.model.FlowMainLog; import com.idea.oa.flow2.model.FlowMainPush; import com.idea.oa.flow2.model.FlowMainPushExample; import com.idea.oa.flow2.model.in.FlowMainIn; import com.idea.oa.flow2.model.in.PushEntrust; import com.idea.oa.flow2.model.out.FlowHistoryInfo; import com.idea.oa.flow2.model.out.FlowMainPushOut; import com.idea.oa.flow2.model.out.IMGFlowHistoryInfo; import com.idea.oa.flow2.service.FlowMainLogService; import com.idea.oa.flow2.service.FlowMainPushService; import com.idea.oa.flow2.service.FlowMainService; //import com.idea.oa.holidayManagement.model.HolidayManagement; //import com.idea.oa.holidayManagement.service.HolidayManagementService; //import com.idea.oa.outsource.model.OutOrderMain; //import com.idea.oa.outsource.model.OutOrderMainExample; //import com.idea.oa.outsource.model.OutOrderPay; //import com.idea.oa.outsource.model.OutOrderPayExample; //import com.idea.oa.outsource.service.OutOrderMainService; //import com.idea.oa.outsource.service.OutOrderPayService; //import com.idea.oa.workAttendance.service.WorkAttendanceLogService; import com.rockstar.common.base.BaseController; import com.rockstar.common.domain.AjaxResult; import com.rockstar.flow.exception.FlowException; import com.rockstar.flow.model.FlowDefinition; import com.rockstar.flow.service.FlowDefinitionService; import com.rockstar.flow.service.FlowService; import com.rockstar.frame.model.extend.DateTrans; import com.rockstar.frame.model.extend.TableSplitResult; import com.rockstar.frame.model.extend.Tablepar; import com.rockstar.shiro.util.ShiroUtils; import com.rockstar.util.StringUtils; import com.rockstar.util.UUIDUtils; import io.swagger.annotations.Api; import org.activiti.bpmn.model.SequenceFlow; import org.activiti.bpmn.model.UserTask; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.math.BigDecimal; import java.math.MathContext; import java.util.Date; import java.util.List; /** * Created by zt */ @Controller @RequestMapping(value = "FlowMainController") @Api(value = "申请流程/主表_主申请审核表") public class FlowMainController extends BaseController { // @Autowired // private WorkAttendanceLogService workAttendanceLogService; // @Autowired // private HolidayManagementService holidayManagementService; // @Autowired // private ApplyOffWorkTimeService applyOffWorkTimeService; @Autowired private ApplyAddWorkTimeService applyAddWorkTimeService; //上面是业务中的信息,嵌入的业务信息了,以后可以考虑搬离 @Autowired private RunerLoadOneService runerLoadOneService; @Autowired private FlowDefinitionService flowDefinitionService; @Autowired private FlowMainLogService flowMainLogService; @Autowired private ProActiService proActiService; //主表 @Autowired private FlowMainService modelService; @Autowired private FlowMainPushService flowMainPushService; @Autowired private FlowService flowService; // @Autowired // private OutOrderMainService outOrderMainService; // @Autowired // private OutOrderPayService outOrderPayService; /** * 通过flowMainId获取审核流程信息 * 2023年5月5日 * 先判断流程是否结束,如果没有计算就进行 *

* 作废==>增加获取本次申请的全部流程信息 * 改成:后续节点名称、处理人应该可以带出来,如果还没有审则审核结果显示为“处理中”,审核时间为空 * * @param flowMainId * @return */ @PostMapping(value = "getFlowHistroyByFlowMainId", produces = {"application/json;charset=UTF-8"}) @ResponseBody public List getFlowHistroyByFlowMainId(String flowMainId) { return modelService.getFlowHistroyByFlowMainId(flowMainId); } /** * 通过流程id获取流程当前所在节点和其他节点对应的状态 * * @param flowMainId * @return */ @PostMapping(value = "getIMGFlowHistroyByFlowMainId", produces = {"application/json;charset=UTF-8"}) @ResponseBody public List getIMGFlowHistroyByFlowMainId(String flowMainId) { return modelService.getIMGFlowHistroyByFlowMainId(flowMainId); } /** * 根据推送表的FlowMainPushId获取下一条线路怎么走,是返回上个节点还是返回申请人还是执行下个节点 * * @param flowMainPushId * @return */ @PostMapping(value = "getOutgoingFlowsByFlowMainPushId", produces = {"application/json;charset=UTF-8"}) @ResponseBody public List getOutgoingFlowsByFlowMainPushId(String flowMainPushId) { FlowMainPush flowMainPush = flowMainPushService.selectByPrimaryKey(flowMainPushId); // List nextCandidateGroupByDeploy = flowService.getNextCandidateGroupByDeploy(ConstantFlowType.USE_MONEY_DEPLOYMENTID, flowMainPush.getTaskId(), false); UserTask userTaskByTaskId = proActiService.getUserTaskByTaskId(flowMainPush.getTaskId()); List outgoingFlows = userTaskByTaskId.getOutgoingFlows(); // List userTasks = flowService.nextTasks(flowMainPush.getTaskId(), false); return outgoingFlows; } /** * 申请人撤回申请 * 申请人撤回申请 * * @param flowMainid * @return */ @PostMapping(value = "recallApply", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult recallApply(String flowMainid) { return modelService.recallApply(flowMainid); } /** * 流程监控室 撤回申请 * 申请人撤回申请 * * @param flowMainid * @return */ @PostMapping(value = "topRecallApply", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult topRecallApply(String flowMainid) { {//用的就是 return modelService.recallApply(flowMainid);的方法,就是 flowMainLog.setFlowPost(null);改了和flowMainLog.setRemark 和flowMain1.setRemark { if (StringUtils.isEmpty(flowMainid)) { return AjaxResult.error("数据不能为空"); } FlowMain flowMain = modelService.selectByPrimaryKey(flowMainid); //流转状态为审核中时,可以由发起人撤回。ok if (!flowMain.getFlowStatus().equals(1)) { return AjaxResult.error("流程状态不在审核中,请重新确认"); } String mypushUserKey = null; {//开始申请人撤回申请 //先搜索目前有哪些人在审核中 ,获取key // select * from flow_main_push WHERE flow_main_push.flow_main_id=#{flowMainId} and STATUS=0 FlowMainPushExample example = new FlowMainPushExample(); example.createCriteria().andFlowMainIdEqualTo(flowMain.getId()).andStatusEqualTo(0); List flowMainPushes = flowMainPushService.selectByExample(example); mypushUserKey = flowMainPushes.get(0).getPushUserKey(); //1.关闭所有推送人数据信息表 ok { flowMainPushService.updateStatusThreeByFlowMainId(ShiroUtils.getUser().getId(), flowMain.getId()); } //2.关闭主流程 ok {// 发起流程引擎操作 并结束该流程 try { flowService.deleteInstance(flowMain.getFlowId(), "流程监控室撤回申请_结束流程"); } catch (Exception e) { System.err.println("流程引擎异常"); e.printStackTrace(); // throw new RuntimeException(e); } } //3.关闭主流程表 ok //存入流程日志表的id String flowMainLogUuid = UUIDUtils.middleUUID(); { FlowMain flowMain1 = new FlowMain(); flowMain1.setId(flowMain.getId()); flowMain1.setFlowStatus(4);//申请状态(1审批中,2,退回发起人,3,已结束,4已撤回) flowMain1.setLastMainLogId(flowMainLogUuid); flowMain1.setUpdatedAt(new Date()); flowMain1.setUpdatedBy(ShiroUtils.getUser().getId()); flowMain1.setRemark(flowMain.getRemark() == null ? "" : (flowMain.getRemark() + ",") + "流程监控室撤回申请"); modelService.updateByPrimaryKeySelective(flowMain1); } //4 添加日志表 FlowMainLog flowMainLog = new FlowMainLog(); {//其表单对应的流转历史该节点审核结果显示为”发起人撤回” // flowMainLogUuid flowMainLog.setId(flowMainLogUuid); flowMainLog.setFlowMainId(flowMain.getId()); flowMainLog.setFormId(flowMain.getFormId()); flowMainLog.setAuditUser(ShiroUtils.getUser().getId()); flowMainLog.setAuditContent(null); flowMainLog.setAuditResult(null); //审批类型(0流程开始状态还是1流程审核状态还是2流程结束状态还是3申请人暂停状态4申请人结束状态,5监控室结束状态(撤回状态) flowMainLog.setAuditType("5"); flowMainLog.setFlowType(flowMain.getFlowType()); flowMainLog.setFlowPost(null);//当前流程邮递操作人(frame_user)id 去除岗位的设定 因为已经撤回了,所以不知道传什么 {// 需要工作流引擎的支持 flowMainLog.setFlowId(flowMain.getFlowId()); flowMainLog.setTaskId(null); flowMainLog.setNodeName("流程监控室_撤回"); flowMainLog.setPushUserKey(mypushUserKey);//发起人撤回时 当时的审核人所对应的角色 } // 下一环节操作人(审核人/委托人/退回申请人),列表例如:,张三,李四, // 因为感觉用不到,暂时不放进去 // flowMainLog.setNextPersons(); flowMainLog.setUpMainLogId(flowMain.getLastMainLogId()); flowMainLog.setCcList(null); flowMainLog.setCreatedAt(new Date()); flowMainLog.setCreatedBy(ShiroUtils.getUser().getId()); flowMainLog.setGroupId(ShiroUtils.getUser().getGroupId()); flowMainLog.setStatus(0); flowMainLog.setRemark("流程监控室撤回申请"); flowMainLogService.insertWithoutId(flowMainLog); } } return AjaxResult.success(); } } } //todo 查看审核人列表 /** * 流程监控室 委托办理 * * @param entity * @return */ @PostMapping(value = "topEntrustOperate", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult topEntrustOperate(PushEntrust entity) { if (StringUtils.isEmpty(entity.getFlowMainPushId())) { return AjaxResult.error("flowMainPushId数据不能为空"); } if (StringUtils.isEmpty(entity.getPushEntrustId())) { return AjaxResult.error("PushEntrustId数据不能为空"); } {// 进行委托 // 获取推送数据 FlowMainPush flowMainPush = flowMainPushService.selectByPrimaryKey(entity.getFlowMainPushId()); //1.0 判断推送人数据是否修改//1推送人数据修改成逻辑删除 { if (!flowMainPush.getStatus().equals(0)) { if (flowMainPush.getStatus().equals(1)) { return AjaxResult.error("已经在" + flowMainPush.getUpdatedAt() + "时操作过了,请重新确认"); } else if (flowMainPush.getStatus().equals(2)) { return AjaxResult.error("已经在" + flowMainPush.getUpdatedAt() + "时由其他审核人操作过了,请重新确认"); } } {//提前逻辑删除推送信息,保证数据不会因为同步操作出现冲突 FlowMainPush updateFlowMainPush = new FlowMainPush(); updateFlowMainPush.setId(flowMainPush.getId()); updateFlowMainPush.setStatus(1); updateFlowMainPush.setUpdatedAt(new Date()); updateFlowMainPush.setUpdatedBy(ShiroUtils.getUser().getId()); flowMainPushService.updateByPrimaryKeySelective(updateFlowMainPush); } } //2 添加日志 FlowMainLog flowMainLog = new FlowMainLog(); { //当前任务流程 目的是获取节点名称,存起来nodeName String nodeName = proActiService.getNodeName(flowMainPush); if (nodeName == null) { return AjaxResult.error("异常:没有找到对应的任务...请通知管理员"); } { //存入流程日志表的id String flowMainLogUuid = UUIDUtils.middleUUID(); flowMainLog.setId(flowMainLogUuid); flowMainLog.setFlowMainId(flowMainPush.getFlowMainId()); flowMainLog.setFormId(flowMainPush.getFormId()); flowMainLog.setAuditUser( ShiroUtils.getUser().getId() );//xxxx审批人id flowMainLog.setAuditContent("委托他人审核"); flowMainLog.setAuditResult("4"); //审批类型(0流程开始状态还是1流程审核状态还是2流程结束状态还是3申请人暂停状态4申请人结束状态 flowMainLog.setAuditType("1"); flowMainLog.setFlowType(flowMainPush.getFlowType()); flowMainLog.setFlowPost( flowMainPush.getFlowPost() );//xxxx当前流程邮递操作人(frame_user)id 去除岗位的设定 {// 需要工作流引擎的支持 flowMainLog.setFlowId(flowMainPush.getFlowId()); flowMainLog.setTaskId(flowMainPush.getTaskId()); flowMainLog.setNodeName(nodeName + "_流程监控室委托他人审核"); flowMainLog.setPushUserKey(flowMainPush.getPushUserKey()); } // 下一环节操作人(审核人/委托人/退回申请人),列表例如:,张三,李四, // 因为感觉用不到,暂时不放进去 // flowMainLog.setNextPersons(); flowMainLog.setUpMainLogId(flowMainPush.getUpMainLogId()); flowMainLog.setCcList(null); flowMainLog.setCreatedAt(new Date()); flowMainLog.setCreatedBy(ShiroUtils.getUser().getId()); flowMainLog.setGroupId(ShiroUtils.getUser().getGroupId()); flowMainLog.setStatus(0); flowMainLog.setRemark("流程监控委托操作"); flowMainLogService.insertWithoutId(flowMainLog); } } //3 添加新的推送人数据 { FlowMainPush newflowMainPush = new FlowMainPush(); newflowMainPush.setFlowMainId(flowMainPush.getFlowMainId()); newflowMainPush.setFormId(flowMainPush.getFormId()); {// 需要工作流引擎的支持 newflowMainPush.setPushUser(entity.getPushEntrustId());//推送人id' newflowMainPush.setPushUserKey(flowMainPush.getPushUserKey());//推送时彭总给的key值 newflowMainPush.setNodeName(flowMainPush.getNodeName() + "_流程监控室委托审核"); newflowMainPush.setPushType(flowMainPush.getPushType());//推送类型1单流程推送,2串联推送,3并联推送 newflowMainPush.setPushRole(2);//'推送人身份:1本人审核,2被委托人(代理审核人审核权限)', newflowMainPush.setFlowType(flowMainPush.getFlowType()); newflowMainPush.setFlowPost(flowMainPush.getFlowPost()); newflowMainPush.setFlowId(flowMainPush.getFlowId()); newflowMainPush.setTaskId(flowMainPush.getTaskId()); } newflowMainPush.setUpMainLogId(flowMainLog.getId()); newflowMainPush.setUpdatedAt(new Date()); newflowMainPush.setCreatedAt(newflowMainPush.getUpdatedAt()); newflowMainPush.setCreatedBy(ShiroUtils.getUser().getId()); newflowMainPush.setUpdatedBy(newflowMainPush.getCreatedBy()); newflowMainPush.setGroupId(ShiroUtils.getUser().getGroupId()); newflowMainPush.setStatus(0); newflowMainPush.setRemark("流程监控委托操作"); flowMainPushService.insert(newflowMainPush); } } return result(1); } /** * 委托办理 * * @param entity * @return */ @PostMapping(value = "entrustOperate", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult entrustOperate(PushEntrust entity) { if (StringUtils.isEmpty(entity.getFlowMainPushId())) { return AjaxResult.error("FlowMainPushid数据不能为空"); } if (StringUtils.isEmpty(entity.getPushEntrustId())) { return AjaxResult.error("PushEntrustId数据不能为空"); } {// 进行委托 // 获取推送数据 FlowMainPush flowMainPush = flowMainPushService.selectByPrimaryKey(entity.getFlowMainPushId()); //1.0 判断推送人数据是否修改//1推送人数据修改成逻辑删除 { if (!flowMainPush.getStatus().equals(0)) { if (flowMainPush.getStatus().equals(1)) { return AjaxResult.error("已经在" + flowMainPush.getUpdatedAt() + "时操作过了,请重新确认"); } else if (flowMainPush.getStatus().equals(2)) { return AjaxResult.error("已经在" + flowMainPush.getUpdatedAt() + "时由其他审核人操作过了,请重新确认"); } } {//提前逻辑删除推送信息,保证数据不会因为同步操作出现冲突 FlowMainPush updateFlowMainPush = new FlowMainPush(); updateFlowMainPush.setId(flowMainPush.getId()); updateFlowMainPush.setStatus(1); updateFlowMainPush.setUpdatedAt(new Date()); updateFlowMainPush.setUpdatedBy(ShiroUtils.getUser().getId()); flowMainPushService.updateByPrimaryKeySelective(updateFlowMainPush); } } //2 添加日志 FlowMainLog flowMainLog = new FlowMainLog(); { //当前任务流程 目的是获取节点名称,存起来nodeName String nodeName = proActiService.getNodeName(flowMainPush); if (nodeName == null) { return AjaxResult.error("异常:没有找到对应的任务...请通知管理员"); } { //存入流程日志表的id String flowMainLogUuid = UUIDUtils.middleUUID(); flowMainLog.setId(flowMainLogUuid); flowMainLog.setFlowMainId(flowMainPush.getFlowMainId()); flowMainLog.setFormId(flowMainPush.getFormId()); flowMainLog.setAuditUser(ShiroUtils.getUser().getId()); flowMainLog.setAuditContent("委托他人审核"); flowMainLog.setAuditResult("4"); //审批类型(0流程开始状态还是1流程审核状态还是2流程结束状态还是3申请人暂停状态4申请人结束状态 flowMainLog.setAuditType("1"); flowMainLog.setFlowType(flowMainPush.getFlowType()); flowMainLog.setFlowPost(ShiroUtils.getUser().getId()); {// 需要工作流引擎的支持 flowMainLog.setFlowId(flowMainPush.getFlowId()); flowMainLog.setTaskId(flowMainPush.getTaskId()); flowMainLog.setNodeName(nodeName + "_委托他人审核"); flowMainLog.setPushUserKey(flowMainPush.getPushUserKey()); } // 下一环节操作人(审核人/委托人/退回申请人),列表例如:,张三,李四, // 因为感觉用不到,暂时不放进去 // flowMainLog.setNextPersons(); flowMainLog.setUpMainLogId(flowMainPush.getUpMainLogId()); flowMainLog.setCcList(null); flowMainLog.setCreatedAt(new Date()); flowMainLog.setCreatedBy(ShiroUtils.getUser().getId()); flowMainLog.setGroupId(ShiroUtils.getUser().getGroupId()); flowMainLog.setStatus(0); flowMainLogService.insertWithoutId(flowMainLog); } } //3 添加新的推送人数据 { FlowMainPush newflowMainPush = new FlowMainPush(); newflowMainPush.setFlowMainId(flowMainPush.getFlowMainId()); newflowMainPush.setFormId(flowMainPush.getFormId()); {// 需要工作流引擎的支持 newflowMainPush.setPushUser(entity.getPushEntrustId());//推送人id' newflowMainPush.setPushUserKey(flowMainPush.getPushUserKey());//推送时彭总给的key值 newflowMainPush.setNodeName(flowMainPush.getNodeName() + "_委托审核"); newflowMainPush.setPushType(flowMainPush.getPushType());//推送类型1单流程推送,2串联推送,3并联推送 newflowMainPush.setPushRole(2);//'推送人身份:1本人审核,2被委托人(代理审核人审核权限)', newflowMainPush.setFlowType(flowMainPush.getFlowType()); newflowMainPush.setFlowPost(flowMainPush.getFlowPost()); newflowMainPush.setFlowId(flowMainPush.getFlowId()); newflowMainPush.setTaskId(flowMainPush.getTaskId()); } newflowMainPush.setUpMainLogId(flowMainLog.getId()); newflowMainPush.setUpdatedAt(new Date()); newflowMainPush.setCreatedAt(newflowMainPush.getUpdatedAt()); newflowMainPush.setCreatedBy(ShiroUtils.getUser().getId()); newflowMainPush.setUpdatedBy(newflowMainPush.getCreatedBy()); newflowMainPush.setGroupId(ShiroUtils.getUser().getGroupId()); newflowMainPush.setStatus(0); flowMainPushService.insert(newflowMainPush); } } return result(1); } //=====下面是查询============================================================================================= /** * 流程监控的查询 根据flowmainid获取当前审核人的信息 */ @PostMapping(value = "findPushInfoByFlowMainId", produces = {"application/json;charset=UTF-8"}) @ResponseBody public List findPushInfoByFlowMainId(String flowMainid) { List flowMainPushOutlist = flowMainPushService.findPushInfoByFlowMainId(flowMainid); return flowMainPushOutlist;//AjaxResult.success(flowMainPushOutlist); } //====================================================================================================== /** * 流程监控的查询 * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "applylistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object applylistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.myApplylistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 已办事项 ok * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 *

* applyUserName 申请人名称 * applyTheme 主题名称 * flowName 流程名称 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "hasDolistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object hasDolistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.hasDolistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 待办事项和委托代办事项 * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "toDolisAndEntrusttByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object toDolisAndEntrusttByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.toDolisAndEntrusttByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 待办事项和委托代办事项(统计总数量) * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param model * @param dt * @return */ @PostMapping(value = "numtoDolisAndEntrusttByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult numtoDolisAndEntrusttByInfo(FlowMainIn model, DateTrans dt) { Integer num = modelService.numtoDolisAndEntrusttByInfo(model, dt); return AjaxResult.success(num); } /** * 待办事项 * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "toDolistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object toDolistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.toDolistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 待办事项(统计总数量) * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param model * @param dt * @return */ @PostMapping(value = "numtoDolistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult numtoDolistByInfo(FlowMainIn model, DateTrans dt) { Integer num = modelService.numtoDolistByInfo(model, dt); return AjaxResult.success(num); } /** * 我的申请 ok * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "myApplylistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object myApplylistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.myApplylistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 抄送事项 ok * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "cclistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object cclistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.cclistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 委托代办事项 * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "entrustToDolistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object entrustToDolistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.entrustToDolistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 我的委托 ok * web端开始页面查询,不同类型, 流程名称,主题,发起人查询 * * @param tablepar * @param model * @param dt * @return */ @PostMapping(value = "myEntrustlistByInfo", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object myEntrustlistByInfo(Tablepar tablepar, FlowMainIn model, DateTrans dt) { PageInfo page = modelService.myEntrustlistByInfo(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } //=============================================================================================================== @PostMapping(value = "list", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object list(Tablepar tablepar, FlowMain model, DateTrans dt) { PageInfo page = modelService.list(tablepar, model, dt); TableSplitResult result = new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } @PostMapping(value = "listAll", produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object listAll(FlowMain model, DateTrans dt) { return modelService.listAll(model, dt); } // @PostMapping(value = "add", produces = {"application/json;charset=UTF-8"}) // @ResponseBody // public AjaxResult add(FlowMain record) { // record.setCreatedAt(new Date()); // int result = modelService.insert(record); // return result(result); // } /** * 流程监控_进行删除操作 * * @param id * @return */ @PostMapping(value = "remove/{id}", produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult remove(@PathVariable("id") String id) { // int result = modelService.deleteByPrimaryKey(id); FlowMain flowMain = modelService.selectByPrimaryKey(id); if (flowMain.getFlowStatus().equals(1)) { return AjaxResult.error("还在审批中不能进行删除"); } if (flowMain.getFlowStatus().equals(3)) {//流程结束了进行操作 //判断最后的操作是否同意,如果同意就进行回滚 //如果是加班,还要看调休时间是否足够回滚,如果够回滚就返回不能删除 FlowMainLog flowMainLog = flowMainLogService.selectByPrimaryKey(flowMain.getLastMainLogId()); if (flowMainLog.getAuditResult().equals("1")) {//最后的操作是同意操作 if (flowMain.getFlowType().equals(ConstantFlowType.OFF_WORK)) { } else if (flowMain.getFlowType().equals(ConstantFlowType.ADD_WORK)) { // todo 些自己的业务 //加班进行回滚 ApplyAddWorkTimeExample example = new ApplyAddWorkTimeExample(); example.createCriteria().andAddWorkIdEqualTo(flowMain.getFormId()); List applyOffWorkTimeList = applyAddWorkTimeService.selectByExample(example); //获取所有的加班时间 BigDecimal totaluseTime = new BigDecimal(0); //2======================================================== { //获取总共加班时间 for (ApplyAddWorkTime applyAddWorkTime : applyOffWorkTimeList) { totaluseTime = totaluseTime.add(applyAddWorkTime.getUseTime(), MathContext.DECIMAL32); } } } else if (flowMain.getFlowType().equals(ConstantFlowType.PURCHASE_WORK)){ } else if (flowMain.getFlowType().equals(ConstantFlowType.PAYMEN)){ } } } FlowMain record = new FlowMain(); record.setId(id); record.setStatus(1); record.setUpdatedAt(new Date()); record.setUpdatedBy(ShiroUtils.getUser().getId()); int i = modelService.updateByPrimaryKeySelective(record); return result(i); } // @PostMapping(value = "edit", produces = {"application/json;charset=UTF-8"}) // @ResponseBody // public AjaxResult editSave(FlowMain model) { // int result = modelService.updateByPrimaryKeySelective(model); // return result(result); // } @PostMapping(value = "getById", produces = {"application/json;charset=UTF-8"}) @ResponseBody public FlowMain getById(String id) { return modelService.selectByPrimaryKey(id); } /** * 重新写了一个重新部署该流程的接口 * @param record * @return */ @PostMapping( value = {"deployProcess"}, produces = {"application/json;charset=UTF-8"} ) @ResponseBody public AjaxResult deployProcess(FlowDefinition record) { AjaxResult success = null; try { success = this.success(this.flowDefinitionService.deployProcess(record)); } catch (FlowException var3) { return this.error(var3.getMessage()); } runerLoadOneService.refreshFlowNumber(); return success; } }