diff --git a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java index 5600249a..2957f851 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java @@ -94,6 +94,9 @@ public class ActivitiNoticeAspect { case TaskListener.EVENTNAME_COMPLETE: // 节点执行完成 task_complete_notice(delegateTask, activitiNoticeOperation); break; + case TaskListener.EVENTNAME_CREATE: // 节点被创建 + task_create_notice(delegateTask, activitiNoticeOperation); + break; default: } }); @@ -118,6 +121,79 @@ public class ActivitiNoticeAspect { LOGGER.error("执行时长{} ms", time); } + /** + * 特殊处理驳回 + * + * @param delegateTask + * @param activitiNoticeOperation + */ + private void task_create_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { + Map kv = delegateTask.getVariables(); + LOGGER.error("表单:{}", JSON.toJSONString(kv)); + final String workKey = TaskListener.EVENTNAME_CREATE + kv.get("id").toString(); + if (work.contains(workKey)) { + LOGGER.error("------------出现重放------------"); + return; + } + work.add(workKey); + String creator = null; + if (kv.containsKey("creator")) { // 表单存在创建者 + creator = kv.get("creator").toString(); + } else if (kv.containsKey("userId")) { + creator = kv.get("userId").toString(); + } + if (StringUtils.isEmpty(creator)) { + work.remove(workKey); + return; + } + if (!"发起人录入表单".equals(activitiNoticeOperation.process())) { // 非驳回到录入表单 + work.remove(workKey); + return; + } + try { + String result; + Boolean backToFirst = Boolean.valueOf(kv.get("backToFirst") != null ? kv.get("backToFirst").toString() : Boolean.FALSE.toString()); // 存在驳回 + if (Boolean.TRUE.equals(backToFirst)) { + result = "被驳回"; + } else { + work.remove(workKey); + return; + } + String finalCreator = creator; + String finalResult = result; + CompletableFuture.runAsync(() -> { // 发起人 + SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator)); + String content = "【通知】" + userDTO.getRealName() + ",您发起的流程 " + kv.getOrDefault("flowType", "") + finalResult; + SysNoticeDTO dto = new SysNoticeDTO(); + dto.setType(2); + dto.setTitle("流程节点系统通知"); + dto.setContent(content); // 通知内容 + dto.setReceiverType(1); + dto.setReceiverTypeIds(finalCreator); + dto.setStatus(NoticeStatusEnum.SEND.value()); + dto.setSenderName("流程系统"); + dto.setSenderDate(new Date()); + dto.setCreator(sysUserService.getByUsername("admin").getId()); + dto.setCreateDate(new Date()); + dto.setFrom("通知"); + sysNoticeService.save(dto); + }, EXECUTOR); + } catch (Exception exception) { + LOGGER.error("发送通知消息异常", exception); + } finally { + // 防止重放 + new Thread(() -> { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + work.remove(workKey); + } + }).start(); + } + } + /** * 进行节点流转 * @@ -127,11 +203,12 @@ public class ActivitiNoticeAspect { private void task_complete_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = delegateTask.getVariables(); LOGGER.error("表单:{}", JSON.toJSONString(kv)); - if (work.contains(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString())) { + final String workKey = TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString(); + if (work.contains(workKey)) { LOGGER.error("------------出现重放------------"); return; } - work.add(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString()); + work.add(workKey); String creator = null; if (kv.containsKey("creator")) { // 表单存在创建者 creator = kv.get("creator").toString(); @@ -139,6 +216,7 @@ public class ActivitiNoticeAspect { creator = kv.get("userId").toString(); } if (StringUtils.isEmpty(creator)) { + work.remove(workKey); return; } try { @@ -186,7 +264,7 @@ public class ActivitiNoticeAspect { } catch (InterruptedException e) { throw new RuntimeException(e); } finally { - work.remove(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString()); + work.remove(workKey); } }).start(); } @@ -201,11 +279,12 @@ public class ActivitiNoticeAspect { private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = execution.getVariables(); LOGGER.error("表单:{}", JSON.toJSONString(kv)); - if (work.contains(ExecutionListener.EVENTNAME_END + kv.get("id").toString())) { + final String workKey = ExecutionListener.EVENTNAME_END + kv.get("id").toString(); + if (work.contains(workKey)) { LOGGER.error("------------出现重放------------"); return; } - work.add(ExecutionListener.EVENTNAME_END + kv.get("id").toString()); + work.add(workKey); String creator = null; if (kv.containsKey("creator")) { // 表单存在创建者 creator = kv.get("creator").toString(); @@ -213,6 +292,7 @@ public class ActivitiNoticeAspect { creator = kv.get("userId").toString(); } if (StringUtils.isEmpty(creator)) { + work.remove(workKey); return; } try { @@ -284,7 +364,7 @@ public class ActivitiNoticeAspect { } catch (InterruptedException e) { throw new RuntimeException(e); } finally { - work.remove(ExecutionListener.EVENTNAME_END + kv.get("id").toString()); + work.remove(workKey); } }).start(); } @@ -300,11 +380,12 @@ public class ActivitiNoticeAspect { private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = delegateTask.getVariables(); LOGGER.error("表单:{}", JSON.toJSONString(kv)); - if (work.contains(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString())) { + final String workKey = TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString(); + if (work.contains(workKey)) { LOGGER.error("------------出现重放------------"); return; } - work.add(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString()); + work.add(workKey); String creator = null; if (kv.containsKey("creator")) { // 表单存在创建者 creator = kv.get("creator").toString(); @@ -312,6 +393,7 @@ public class ActivitiNoticeAspect { creator = kv.get("userId").toString(); } if (StringUtils.isEmpty(creator)) { + work.remove(workKey); return; } try { @@ -365,9 +447,10 @@ public class ActivitiNoticeAspect { new Thread(() -> { try { Thread.sleep(200); - work.remove(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString()); } catch (InterruptedException e) { throw new RuntimeException(e); + } finally { + work.remove(workKey); } }).start(); } diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java index 13ecf605..f838ccd6 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java @@ -112,6 +112,7 @@ public class AbilityCenterController { tAbilityApplicationDTO.setUserId(abilityBatchApplicationDTO.getUserId()); tAbilityApplicationDTO.setApproveStatus("审核中"); tAbilityApplicationDTO.setDelFlag(0); + tAbilityApplicationDTO.setFlowType("能力申请"); tAbilityApplicationDTO.setEnclosureName(abilityBatchApplicationDTO.getEnclosureName()); // 仿照请求接口 /processForm/tabilityapplication ValidatorUtils.validateEntity(tAbilityApplicationDTO, AddGroup.class, DefaultGroup.class); diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index 650d2d08..38d5ae68 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -170,6 +170,8 @@ public class AbilityCenterControllerV2 { // 归为同一次申请 tAbilityApplicationDTO.setApplyFlag(abilityBatchApplicationDTO.getApplyFlag()); + tAbilityApplicationDTO.setFlowType("能力申请"); + // 仿照请求接口 /processForm/tabilityapplication ValidatorUtils.validateEntity(tAbilityApplicationDTO, AddGroup.class, DefaultGroup.class); tAbilityApplicationService.save(tAbilityApplicationDTO); // 写能力申请数据 @@ -232,10 +234,10 @@ public class AbilityCenterControllerV2 { processStartDTO.setProcessDefinitionKey(KEY); //限定 AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO(); auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入 + auditingBaseDTO.setFlowType("能力申请"); Map variables = oMapper.convertValue(auditingBaseDTO, Map.class); - variables.putAll(new HashMap() { // 流程内携带属性值 { put("tAbilityApplicationDTOList", dtoList); // 归属该部门的申请 diff --git a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java index 78a4a18b..818fa3de 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java @@ -86,6 +86,7 @@ public class CommentController { } tDemandCommentDTO.setDelFlag(2); // 待审核 tDemandCommentDTO.setCompleteEntry(Boolean.TRUE); + tDemandCommentDTO.setFlowType("评论审核"); tDemandCommentService.update(tDemandCommentDTO); codeGenerationUtils.setApplyNumber("XQPL", Arrays.asList(tDemandCommentDTO.getId()), jdbcTemplate); diff --git a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java index fb103716..cd71c99e 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java @@ -1,7 +1,6 @@ package io.renren.common.controller; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; import io.renren.common.utils.CodeGenerationUtils; @@ -73,7 +72,7 @@ public class DemandDataController { logger.info(JSON.toJSONString(tDemandDataDTO)); logger.info("####################################################"); tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag()); - + tDemandDataDTO.setFlowType("能力需求申请"); ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class); tDemandDataService.save(tDemandDataDTO); if (tDemandDataDTO.getId() == null) { diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 84280e3f..f0826ab0 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -116,6 +116,7 @@ public class ResourceMountController { tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSON.toJSONString(index))); tResourceMountApplyDTO.setResourceDTO(index); tResourceMountApplyDTO.setEnclosure(index.getEnclosure()); + tResourceMountApplyDTO.setFlowType("资源上架"); try { tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId()); } catch (Exception e) { @@ -209,6 +210,7 @@ public class ResourceMountController { dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason()); dto.setUndercarriageEnclosure(tResourceUndercarriageApplyDTO.getEnclosure()); dto.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); // 设置为正常 + dto.setFlowType("资源下架"); String userId = SecurityUser.getUserId().toString(); Optional userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId))); userDTO.ifPresent(user -> { diff --git a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java index 202ddf1e..7c045cc5 100644 --- a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java +++ b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java @@ -11,6 +11,7 @@ import java.io.Serializable; public class AuditingBaseDTO implements Serializable { private static final long serialVersionUID = -6612029904210773020L; + /** * 流程中是否存在拒绝? */ @@ -41,4 +42,9 @@ public class AuditingBaseDTO implements Serializable { */ private Boolean endByUser = null; + /** + * 流程类型 + */ + private String flowType = null; + } diff --git a/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java b/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java index bc7507ea..738e8a59 100644 --- a/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java +++ b/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java @@ -4,6 +4,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; +import io.renren.common.annotation.ActivitiNoticeOperation; import io.renren.common.dto.AuditingBaseDTO; import org.activiti.engine.TaskService; import org.activiti.engine.delegate.DelegateTask; @@ -28,6 +29,7 @@ public class InitiatorDataEntryListener implements TaskListener { private TaskService taskService; @Override + @ActivitiNoticeOperation(value = "任意流程", process = "发起人录入表单") public void notify(DelegateTask delegateTask) { logger.error("----------------------流程发起人录入表单节点---------------------------"); logger.error("事件类型:{}", delegateTask.getEventName()); diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java index 3ba580fd..ae5941f9 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java @@ -1,6 +1,5 @@ package io.renren.modules.monitor.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.common.dao.BaseDao; import io.renren.modules.monitor.entity.Booth; import org.apache.ibatis.annotations.Mapper; diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java index 464c2552..d5823d88 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java @@ -1,11 +1,9 @@ package io.renren.modules.monitor.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.common.dao.BaseDao; import io.renren.modules.monitor.entity.BuildingRecords; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; import java.util.List; import java.util.Map; @@ -19,6 +17,6 @@ import java.util.Map; */ @Mapper public interface BuildingRecordsMapper extends BaseDao { - public void batchSave(@Param("list") List list); + void batchSave(@Param("list") List list); } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java index 3980f3d7..d10c3984 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java @@ -1,6 +1,5 @@ package io.renren.modules.monitor.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.common.dao.BaseDao; import io.renren.modules.monitor.entity.BuildingSite; import org.apache.ibatis.annotations.Mapper; diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java index e2aefa0c..41375fb7 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java @@ -11,7 +11,6 @@ import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import org.springframework.security.core.parameters.P; import java.util.List; import java.util.Map; @@ -31,8 +30,6 @@ public interface CameraChannelMapper extends BaseDao { @Select("select c.* from t_camera_channel c where channel_code in " + "(select b.channel_code from t_channel_mtm_label b where b.label_code = #{labelCode}) ") List selectLabel(@Param("labelCode") String labelCode); - //@Update("update t_camera_channel set state = list") - void updateState(@Param("list") List list); @Select("select * from t_label") List