|
@@ -0,0 +1,182 @@
|
|
|
+package com.zjugis.module.business.flow.meetingNotice.event;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.zjugis.framework.common.util.date.LocalDateTimeUtils;
|
|
|
+import com.zjugis.framework.workflow.exception.BusinessException;
|
|
|
+import com.zjugis.framework.workflow.model.BaseController;
|
|
|
+import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
|
|
|
+import com.zjugis.framework.workflow.spring.resovler.ParamModel;
|
|
|
+import com.zjugis.framework.workflow.workflow.WorkFlow;
|
|
|
+import com.zjugis.module.business.flow.applicationinfo.entity.ApplicationInfo;
|
|
|
+import com.zjugis.module.business.flow.applicationinfo.event.ApplicationInfoEvent;
|
|
|
+import com.zjugis.module.business.flow.applicationinfo.vo.ApplicationInfoVO;
|
|
|
+import com.zjugis.module.business.flow.meetingNotice.entity.MeetingNotice;
|
|
|
+import com.zjugis.module.business.flow.meetingNotice.service.IMeetingNoticeService;
|
|
|
+import com.zjugis.module.business.flow.meetingNotice.vo.MeetingNoticeVO;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+import static com.zjugis.module.business.constants.FlowStatusConstants.*;
|
|
|
+import static com.zjugis.module.business.constants.FlowStatusConstants.FLOW_PROCESS;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 会议通知表 前端控制器
|
|
|
+ *
|
|
|
+ * @author fuwb
|
|
|
+ * @since 2025-03-17
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/meeting-notice")
|
|
|
+public class MeetingNoticeEvent extends BaseController {
|
|
|
+ public static final Logger log = LoggerFactory.getLogger(MeetingNoticeEvent.class);
|
|
|
+ @Resource
|
|
|
+ private IMeetingNoticeService meetingNoticeService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private WorkflowClient workflowClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置流程描述
|
|
|
+ *
|
|
|
+ * @param flowInstance 流程实例
|
|
|
+ * @param activityInstance 活动实例
|
|
|
+ * @return true/false
|
|
|
+ */
|
|
|
+ @PostMapping("/setFlowDesc")
|
|
|
+ public String setFlowDesc(@ParamModel Map flowInstance, @ParamModel Map activityInstance) {
|
|
|
+ try {
|
|
|
+ if (!Objects.isNull(activityInstance) && activityInstance.containsKey("flowInstanceId")) {
|
|
|
+ String flowInstanceId = activityInstance.get("flowInstanceId").toString();
|
|
|
+ MeetingNotice entity = meetingNoticeService.findByInstanceId(flowInstanceId);
|
|
|
+ String applyTime = LocalDateTimeUtils.format(entity.getCreateTime(), null);
|
|
|
+ String flowDesc = StringUtils.join(Arrays.asList(entity.getPublisher(), applyTime, entity.getPublishDate()), "/");
|
|
|
+ entity.setFlowStatus(FLOW_PROCESS);
|
|
|
+ meetingNoticeService.updateMeetingNotice(BeanUtil.copyProperties(entity, MeetingNoticeVO.class));
|
|
|
+ workflowClient.saveFlowDescribe(flowInstanceId, flowDesc);
|
|
|
+ return ok("true");
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 流程归档事件
|
|
|
+ *
|
|
|
+ * @param flowInstance 流程实例
|
|
|
+ * @param triggerFinishActivityInstance 触发归档的结束活动实例
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/flowArchingEvent")
|
|
|
+ public String flowArchingEvent(@ParamModel Map flowInstance, @ParamModel Map triggerFinishActivityInstance) {
|
|
|
+ try {
|
|
|
+ if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
+ MeetingNotice entity = meetingNoticeService.findByInstanceId(flowInstanceId);
|
|
|
+ entity.setFlowStatus(FLOW_FINISHED);
|
|
|
+ entity.setFlowFinishtime(LocalDateTime.now());
|
|
|
+ meetingNoticeService.updateMeetingNotice(BeanUtil.copyProperties(entity, MeetingNoticeVO.class));
|
|
|
+ return ok("true");
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 作废事件
|
|
|
+ *
|
|
|
+ * @param flowInstance 流程实例
|
|
|
+ * @param activityInstance 申请作废所在活动实例
|
|
|
+ * @param nullyApplyUserId 作废申请人ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/nullyEvent")
|
|
|
+ public String nullyEvent(@ParamModel Map flowInstance, @ParamModel Map activityInstance, String nullyApplyUserId) {
|
|
|
+ try {
|
|
|
+ if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
+ MeetingNotice entity = meetingNoticeService.findByInstanceId(flowInstanceId);
|
|
|
+ entity.setFlowStatus(FLOW_NULLY);
|
|
|
+ entity.setIsvalid(0);
|
|
|
+ meetingNoticeService.updateMeetingNotice(BeanUtil.copyProperties(entity, MeetingNoticeVO.class));
|
|
|
+ return ok("true");
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 作废恢复事件
|
|
|
+ *
|
|
|
+ * @param flowInstance 流程实例
|
|
|
+ * @param activityInstance 申请作废所在活动实例
|
|
|
+ * @param nullyApplyUserId 作废申请人ID
|
|
|
+ * @param nullyRecoverserId 作废恢复人ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/nullyRecoverEvent")
|
|
|
+ public String nullyRecoverEvent(@ParamModel Map flowInstance, @ParamModel Map activityInstance, String nullyApplyUserId, String nullyRecoverserId) {
|
|
|
+ try {
|
|
|
+ if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
+ MeetingNotice entity = meetingNoticeService.findByInstanceId(flowInstanceId);
|
|
|
+ entity.setFlowStatus(FLOW_PROCESS);
|
|
|
+ entity.setIsvalid(1);
|
|
|
+ meetingNoticeService.updateMeetingNotice(BeanUtil.copyProperties(entity, MeetingNoticeVO.class));
|
|
|
+ return ok("true");
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 彻底作废事件
|
|
|
+ *
|
|
|
+ * @param flowInstance 流程实例
|
|
|
+ * @param activityInstance 申请作废所在活动实例
|
|
|
+ * @param nullyApplyUserId 作废申请人ID
|
|
|
+ * @param nullyCompleteUserId 彻底作废人ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/nullyCompleteEvent")
|
|
|
+ public String nullyCompleteEvent(@ParamModel Map flowInstance, @ParamModel Map activityInstance, String nullyApplyUserId, String nullyCompleteUserId) {
|
|
|
+ try {
|
|
|
+ if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
+ MeetingNotice entity = meetingNoticeService.findByInstanceId(flowInstanceId);
|
|
|
+ meetingNoticeService.deleteMeetingNotice(entity.getId());
|
|
|
+ return ok("true");
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|