* 'master' of http://221.0.232.152:9393/ability-center/share-platform:
  需求评论通知
  ...
  跨域 屮·
  大数据部门负责人的通知
  通知重放的事件类型区分处理
  文案调整
  ...
This commit is contained in:
huangweixiong 2022-06-02 15:47:17 +08:00
commit 3555b6ca05
6 changed files with 75 additions and 41 deletions

0
lib/yawei-pso-2.0.2.jar Executable file → Normal file
View File

View File

@ -122,11 +122,11 @@ public class ActivitiNoticeAspect {
private void task_complete_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = delegateTask.getVariables();
logger.error("表单:" + kv.toString());
if (work_.contains(kv.get("id").toString())) {
if (work_.contains(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString())) {
logger.error("------------出现重放------------");
return;
}
work_.add(kv.get("id").toString());
work_.add(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString());
String creator = null;
if (kv.containsKey("creator")) { // 表单存在创建者
creator = kv.get("creator").toString();
@ -138,10 +138,8 @@ public class ActivitiNoticeAspect {
}
try {
String result;
Boolean termination =
Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject =
Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
if (termination) {
result = "终止被拒";
} else if (reject) {
@ -162,11 +160,10 @@ public class ActivitiNoticeAspect {
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
kv.get("resourceId");
kv.get("id");
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "")
+ activitiNoticeOperation.process() + " " + activitiNoticeOperation.value() + "节点" + finalResult;
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "") + activitiNoticeOperation.process() + " " + activitiNoticeOperation.value() + "节点" + finalResult;
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程结束系统通知");
dto.setTitle("流程节点系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(finalCreator);
@ -181,7 +178,7 @@ public class ActivitiNoticeAspect {
new Thread(() -> {
try {
Thread.sleep(200);
work_.remove(kv.get("id").toString());
work_.remove(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@ -202,11 +199,11 @@ public class ActivitiNoticeAspect {
private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = execution.getVariables();
logger.error("表单:" + kv.toString());
if (work_.contains(kv.get("id").toString())) {
if (work_.contains(ExecutionListener.EVENTNAME_END + kv.get("id").toString())) {
logger.error("------------出现重放------------");
return;
}
work_.add(kv.get("id").toString());
work_.add(ExecutionListener.EVENTNAME_END + kv.get("id").toString());
String creator = null;
if (kv.containsKey("creator")) { // 表单存在创建者
creator = kv.get("creator").toString();
@ -218,10 +215,8 @@ public class ActivitiNoticeAspect {
}
try {
String result;
Boolean termination =
Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject =
Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
if (termination) {
result = "终止被拒";
} else if (reject) {
@ -242,8 +237,7 @@ public class ActivitiNoticeAspect {
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
kv.get("resourceId");
kv.get("id");
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "")
+ activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "") + activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程结束系统通知");
@ -268,11 +262,10 @@ public class ActivitiNoticeAspect {
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程结束系统通知");
String content = "【通知】" + user.getRealName() + "," + creatorDTO.getRealName() + "发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "")
+ activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
String content = "【通知】" + user.getRealName() + "," + creatorDTO.getRealName() + "发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "") + activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(finalCreator);
dto.setReceiverTypeIds(userDTO.get().getId().toString());
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
@ -285,7 +278,7 @@ public class ActivitiNoticeAspect {
new Thread(() -> {
try {
Thread.sleep(200);
work_.remove(kv.get("id").toString());
work_.remove(ExecutionListener.EVENTNAME_END + kv.get("id").toString());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@ -306,11 +299,11 @@ public class ActivitiNoticeAspect {
private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = delegateTask.getVariables();
logger.error("表单:" + kv.toString());
if (work_.contains(kv.get("id").toString())) {
if (work_.contains(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString())) {
logger.error("------------出现重放------------");
return;
}
work_.add(kv.get("id").toString());
work_.add(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString());
String creator = null;
if (kv.containsKey("creator")) { // 表单存在创建者
creator = kv.get("creator").toString();
@ -324,10 +317,7 @@ public class ActivitiNoticeAspect {
String finalCreator = creator;
CompletableFuture.runAsync(() -> { // 发起人
SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
String content = "您发起的流程<" + activitiNoticeOperation.process() + ">当前审核节点为:" +
activitiNoticeOperation.value() +
";当前审核人为:\"" +
assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName();
String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\"";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程流转系统通知");
@ -342,7 +332,7 @@ public class ActivitiNoticeAspect {
sysNoticeService.save(dto);
}).thenRunAsync(() -> { // 审批者
SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator));
String content = owner.getRealName() + "发起的流程<" + activitiNoticeOperation.process() + ">当前审核节点为" + activitiNoticeOperation.value() + ";当前审核人指派为您";
String content = "【通知】" + owner.getRealName() + "发起的流程" + activitiNoticeOperation.process() + "已进入审核节点" + activitiNoticeOperation.value() + ";当前审核人指派为您";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程流转系统通知");
@ -359,7 +349,7 @@ public class ActivitiNoticeAspect {
new Thread(() -> {
try {
Thread.sleep(200);
work_.remove(kv.get("id").toString());
work_.remove(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}

View File

@ -4,16 +4,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.renren.common.constant.Constant;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.service.TDemandDataService;
import io.renren.modules.demandComment.dao.TDemandCommentDao;
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.entity.TDemandCommentEntity;
import io.renren.modules.demandComment.service.TDemandCommentService;
import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.enums.NoticeStatusEnum;
import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
@ -26,6 +35,10 @@ import java.util.stream.Collectors;
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
@Autowired
private TDemandDataService tDemandDataService;
@Autowired
private SysUserService sysUserService;
@Autowired
private SysNoticeService sysNoticeService;
@Override
public QueryWrapper<TDemandCommentEntity> getWrapper(Map<String, Object> params) {
@ -59,4 +72,26 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
public Long commentCount(Long dataId) {
return baseDao.commentCount(dataId);
}
@Override
public void save(TDemandCommentDTO tDemandCommentDTO) {
super.save(tDemandCommentDTO);
CompletableFuture.runAsync(() -> { // 发起人
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + "有新的评论,请前往查看详情";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("需求评论系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : "");
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
sysNoticeService.save(dto);
});
}
}

View File

@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.renren.common.utils.DateUtils;
import io.renren.modules.pay.Interceptor.AliPayInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;

View File

@ -8,7 +8,6 @@ import com.yawei.pso.SSOResponse;
import com.yawei.pso.TicketManager;
import io.renren.common.constant.Constant;
import io.renren.common.interceptor.YaweiSSOProperties;
import io.renren.common.utils.HttpContextUtils;
import io.renren.common.utils.Result;
import io.renren.modules.security.service.SysUserTokenService;
import io.renren.modules.security.user.SecurityUser;
@ -160,7 +159,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
private void send401Error(HttpServletResponse response, String msg) throws IOException {
response.setContentType("application/json;charset=utf-8");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
// response.setHeader("Access-Control-Allow-Origin", "*");
response.setStatus(HttpStatus.SC_UNAUTHORIZED);
Result r = new Result().error(HttpStatus.SC_UNAUTHORIZED, msg);

View File

@ -4,7 +4,8 @@
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/package io.renren.websocket;
*/
package io.renren.websocket;
import com.alibaba.fastjson.JSON;
import io.renren.common.constant.Constant;
@ -12,6 +13,8 @@ import io.renren.websocket.config.WebSocketConfig;
import io.renren.websocket.data.MessageData;
import io.renren.websocket.data.WebSocketData;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.websocket.*;
@ -23,12 +26,17 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* WebSocket服务
*
*/
@Slf4j
@Component
@ServerEndpoint(value = "/websocket", configurator = WebSocketConfig.class)
public class WebSocketServer {
private static Logger logger = LoggerFactory.getLogger(WebSocketServer.class);
public WebSocketServer() {
logger.info("-------------websocket----------------");
}
/**
* 客户端连接信息
*/
@ -56,13 +64,14 @@ public class WebSocketServer {
@OnMessage
public void onMessage(Session session, String msg) {
log.info("session id: " + session.getId()+" message" + msg);
log.info("session id: " + session.getId() + " message" + msg);
}
/**
* 发送信息
* @param userIdList 用户ID列表
* @param message 消息内容
*
* @param userIdList 用户ID列表
* @param message 消息内容
*/
public void sendMessage(List<Long> userIdList, MessageData<?> message) {
userIdList.forEach(userId -> sendMessage(userId, message));
@ -70,8 +79,9 @@ public class WebSocketServer {
/**
* 发送信息
* @param userId 用户ID
* @param message 消息内容
*
* @param userId 用户ID
* @param message 消息内容
*/
public void sendMessage(Long userId, MessageData<?> message) {
servers.values().forEach(info -> {
@ -83,7 +93,8 @@ public class WebSocketServer {
/**
* 发送信息给全部用户
* @param message 消息内容
*
* @param message 消息内容
*/
public void sendMessageAll(MessageData<?> message) {
servers.values().forEach(info -> sendMessage(info.getSession(), message));