Merge branch 'dev'
This commit is contained in:
commit
ef6971f2eb
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `sys_notice`
|
||||
ADD COLUMN `jump_url` varchar(255) NULL COMMENT '点击通知需要跳转的url'
|
|
@ -199,7 +199,7 @@ public class AbilityCenterControllerV3 {
|
|||
CompletableFuture.runAsync(() -> { // 发起人
|
||||
String content = "【通知】你本次申请的能力内 " + stringBuffer + " 已发起过申请";
|
||||
SysNoticeDTO dto = new SysNoticeDTO();
|
||||
Integer type = 10;
|
||||
Integer type = 12;
|
||||
dto.setType(type);
|
||||
dto.setApplyId(null);
|
||||
dto.setTitle("流程结束系统通知");
|
||||
|
|
|
@ -4,7 +4,11 @@ package io.renren.modules.gateway.controller;
|
|||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.utils.ExcelUtils;
|
||||
import io.renren.common.utils.JhlDAPTool;
|
||||
import io.renren.modules.gateway.dao.ApiCountHistoryDao;
|
||||
|
@ -12,8 +16,11 @@ import io.renren.modules.gateway.entity.ApiCountHistoryEntity;
|
|||
import io.renren.modules.gateway.service.MonitorServiceV2;
|
||||
import io.renren.modules.monitor.entity.Result;
|
||||
import io.renren.modules.monitor.service.MonitorService;
|
||||
import io.renren.modules.notice.dao.SysNoticeDao;
|
||||
import io.renren.modules.notice.dto.SysNoticeDTO;
|
||||
import io.renren.modules.notice.entity.SysNoticeEntity;
|
||||
import io.renren.modules.notice.service.impl.SysNoticeServiceImpl;
|
||||
import io.renren.modules.notice.until.NoticeUntil;
|
||||
import io.renren.modules.resource.dao.AttrDao;
|
||||
import io.renren.modules.resource.dao.ResourceDao;
|
||||
import io.renren.modules.resource.entity.AttrEntity;
|
||||
|
@ -26,6 +33,7 @@ import io.swagger.annotations.ApiOperation;
|
|||
import lombok.Data;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bytedeco.opencv.presets.opencv_core;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -77,6 +85,11 @@ public class MonitorControllerV2 {
|
|||
@Autowired
|
||||
private JhlDAPTool jhlDAPTool;
|
||||
|
||||
@Autowired
|
||||
private NoticeUntil noticeUntil;
|
||||
@Autowired
|
||||
private SysNoticeDao sysNoticeDao;
|
||||
|
||||
@Autowired
|
||||
private SysNoticeServiceImpl sysNoticeService;
|
||||
@Autowired
|
||||
|
@ -390,4 +403,30 @@ public class MonitorControllerV2 {
|
|||
ExcelUtils.exportExcelToTarget(response, "org", "all", all, Org.class);
|
||||
}
|
||||
|
||||
@GetMapping("/fixNoticeJumpUrl")
|
||||
public void fixNoticeJumpUrl() {
|
||||
Page<SysNoticeEntity> entityPage = null;
|
||||
|
||||
LambdaQueryWrapper<SysNoticeEntity> queryWrapper = new QueryWrapper<SysNoticeEntity>()
|
||||
.lambda()
|
||||
.select(SysNoticeEntity::getId,SysNoticeEntity::getJumpUrl,SysNoticeEntity::getApplyState,SysNoticeEntity::getType)
|
||||
.isNull(SysNoticeEntity::getJumpUrl);
|
||||
|
||||
long current = 1L;
|
||||
do {
|
||||
entityPage = sysNoticeDao.selectPage(new Page<SysNoticeEntity>(current, 50), queryWrapper);
|
||||
List<SysNoticeEntity> records = entityPage.getRecords();
|
||||
for (SysNoticeEntity record : records) {
|
||||
if (StringUtils.isBlank(record.getJumpUrl())) {
|
||||
LambdaUpdateWrapper<SysNoticeEntity> updateWrapper = new UpdateWrapper<SysNoticeEntity>()
|
||||
.lambda()
|
||||
.eq(SysNoticeEntity::getId, record.getId())
|
||||
.set(SysNoticeEntity::getJumpUrl, noticeUntil.convertJumpUrl(record.getType(), record.getApplyState()));
|
||||
sysNoticeDao.update(null, updateWrapper);
|
||||
}
|
||||
}
|
||||
}while (entityPage.hasNext());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,4 +54,6 @@ public class SysNoticeDTO implements Serializable {
|
|||
private String applyId;
|
||||
@ApiModelProperty(value = "通知来源状态 0:待办 1:已办")
|
||||
private Integer applyState;
|
||||
@ApiModelProperty(value = "点击通知需要跳转的url")
|
||||
private String jumpUrl;
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -97,4 +98,9 @@ public class SysNoticeEntity {
|
|||
* 通知来源状态
|
||||
*/
|
||||
private Integer applyState;
|
||||
|
||||
/**
|
||||
* 点击通知需要跳转的url
|
||||
*/
|
||||
private String jumpUrl;
|
||||
}
|
|
@ -16,6 +16,7 @@ import io.renren.modules.notice.enums.NoticeStatusEnum;
|
|||
import io.renren.modules.notice.enums.ReceiverTypeEnum;
|
||||
import io.renren.modules.notice.service.SysNoticeService;
|
||||
import io.renren.modules.notice.service.SysNoticeUserService;
|
||||
import io.renren.modules.notice.until.NoticeUntil;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
|
@ -61,6 +62,8 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private SysUserDao sysUserDao;
|
||||
@Autowired
|
||||
private NoticeUntil noticeUntil;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) {
|
||||
|
@ -119,6 +122,12 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysNoticeDTO dto) {
|
||||
|
||||
String jumpUrl = noticeUntil.convertJumpUrl(dto.getType(), dto.getApplyState());
|
||||
if (jumpUrl != null) {
|
||||
dto.setJumpUrl(jumpUrl);
|
||||
}
|
||||
|
||||
SysNoticeEntity entity = ConvertUtils.sourceToTarget(dto, SysNoticeEntity.class);
|
||||
try {
|
||||
if (StringUtils.isEmpty(entity.getFrom())) {
|
||||
|
@ -129,6 +138,8 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
entity.setCreator(0L);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//更新发送者信息
|
||||
if (dto.getStatus() == NoticeStatusEnum.SEND.value() && StringUtils.isEmpty(dto.getSenderName())) {
|
||||
entity.setSenderName(SecurityUser.getUser().getRealName());
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
package io.renren.modules.notice.until;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class NoticeUntil {
|
||||
|
||||
static Map<String, Map<Integer,String>> routeMap;
|
||||
static Map<Integer, String> typeMap;
|
||||
static Map<String, String> tabMap;
|
||||
|
||||
static {
|
||||
String routeString = "{" +
|
||||
" \"申请后台\": {" +
|
||||
" 0: \"myAgent-CompetencyApplication\"," +
|
||||
" 1: \"hasToDoTasks-CompetencyApplication\"," +
|
||||
" }," +
|
||||
" \"上架后台\": {" +
|
||||
" 0: \"myAgent-AbilityResourceShelf\"," +
|
||||
" 1: \"hasToDoTasks-AbilityResourceShelf\"," +
|
||||
" }," +
|
||||
" \"下架后台\": {" +
|
||||
" 0: \"myAgent-AbilityResourcesRemoved\"," +
|
||||
" 1: \"hasToDoTasks-AbilityResourcesRemoved\"," +
|
||||
" }," +
|
||||
" \"需求后台\": {" +
|
||||
" 0: \"myAgent-ApplicationforCompetencyRequirements\"," +
|
||||
" 1: \"hasToDoTasks-ApplicationForCompetencyRequirements\"," +
|
||||
" }," +
|
||||
" \"评论后台\": {" +
|
||||
" 0: \"myAgent-CommentModeration\"," +
|
||||
" 1: \"hasToDoTasks-CommentModeration\"," +
|
||||
" }," +
|
||||
" \"会议室后台\": {" +
|
||||
" 0: \"activiti-RoomExamineAdmin\"," +
|
||||
" 1: \"activiti-RoomExamineAdmin\"," +
|
||||
" }," +
|
||||
"}";
|
||||
|
||||
routeMap = JSONObject.parseObject(routeString, HashMap.class);
|
||||
|
||||
String typeString = " {" +
|
||||
" 0: \"申请前台\"," +
|
||||
" 1: \"申请后台\"," +
|
||||
" 2: \"上架前台\"," +
|
||||
" 3: \"上架后台\"," +
|
||||
" 4: \"下架前台\"," +
|
||||
" 5: \"下架后台\"," +
|
||||
" 6: \"需求前台\"," +
|
||||
" 7: \"需求后台\"," +
|
||||
" 8: \"评论前台\"," +
|
||||
" 9: \"评论后台\"," +
|
||||
" 10: \"会议室前台\"," +
|
||||
" 11: \"会议室后台\"," +
|
||||
" 12: \"其他\"" +
|
||||
"}";
|
||||
typeMap = JSONObject.parseObject(typeString, HashMap.class);
|
||||
|
||||
String tabString = "{" +
|
||||
" \"申请前台\": \"能力申请\"," +
|
||||
" \"上架前台\": \"能力上架\"," +
|
||||
" \"下架前台\": \"能力下架\"," +
|
||||
" \"需求前台\": \"需求评论\"," +
|
||||
" \"评论前台\": \"需求评论\"," +
|
||||
" \"会议室前台\": \"会议室前台\"" +
|
||||
"}";
|
||||
tabMap = JSONObject.parseObject(tabString, HashMap.class);
|
||||
}
|
||||
|
||||
@Value("${front.portal-url}")
|
||||
private String portalUrl;
|
||||
|
||||
@Value("${front.manage-url}")
|
||||
private String manageUrl;
|
||||
|
||||
/**
|
||||
* 先根据type取通知类型,前台根据tab区分不同param,后台根据待办已办状态区分不同路由
|
||||
* 这个逻辑好费劲哈哈
|
||||
* @param type
|
||||
* @param applyState
|
||||
* @return
|
||||
*/
|
||||
public String convertJumpUrl(Integer type, Integer applyState){
|
||||
|
||||
String typeName = typeMap.get(type);
|
||||
if (typeName == null) return null;
|
||||
|
||||
if (typeName.indexOf("后台") > -1) {//后台根据待办已办状态区分不同路由
|
||||
Map<Integer, String> todoMap = routeMap.get(typeName);
|
||||
String route = todoMap.get(applyState);
|
||||
if (route != null){
|
||||
return manageUrl + "/#/" + route;
|
||||
}
|
||||
}else if (typeName.equals("会议室前台")){//会议室单独处理
|
||||
return portalUrl + "/#/DetailsPageconetent?select=基础设施&formPage=noticePage";
|
||||
} else {//前台根据tab区分不同param
|
||||
String tabName = tabMap.get(typeName);
|
||||
if (tabName != null)
|
||||
return portalUrl + "/#/personalCenter?tabTypeName=" + tabName;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
|
@ -143,9 +143,11 @@ cas:
|
|||
client-host-url: http://localhost:9999/#/
|
||||
use-session: false
|
||||
validation-type: cas3
|
||||
# 前端地址,用于退出登录后的重定向
|
||||
|
||||
# 前端地址入口,门户和管理端
|
||||
front:
|
||||
url: http://10.16.16.159:4444
|
||||
portal-url: http://192.168.124.236:9796
|
||||
manage-url: http://192.168.124.236:9797
|
||||
|
||||
# 基础设施,部门最大申请数量
|
||||
infrastructure:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `sys_notice`
|
||||
ADD COLUMN `jump_url` varchar(255) NULL COMMENT '点击通知需要跳转的url'
|
|
@ -12,7 +12,7 @@
|
|||
<!-- 获取我的通知列表 -->
|
||||
<select id="getMyNoticeList" resultType="io.renren.modules.notice.entity.SysNoticeEntity">
|
||||
select t2.id, t2.title, t2.type, t2.sender_name, t2.sender_date, t1.read_status, t2.content ,t2.`from`,
|
||||
t2.apply_id, t2.apply_state from
|
||||
t2.apply_id, t2.apply_state, t2.jump_url from
|
||||
sys_notice_user t1, sys_notice t2
|
||||
where t1.notice_id = t2.id and t1.receiver_id = #{receiverId}
|
||||
<if test="readStatus != null">
|
||||
|
|
Loading…
Reference in New Issue