diff --git a/config/db/V6.9__notice_add_col.sql b/config/db/V6.9__notice_add_col.sql new file mode 100644 index 00000000..4d014d49 --- /dev/null +++ b/config/db/V6.9__notice_add_col.sql @@ -0,0 +1,2 @@ +ALTER TABLE `sys_notice` +ADD COLUMN `jump_url` varchar(255) NULL COMMENT '点击通知需要跳转的url' \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java index 53b36fdb..b8ce1948 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java @@ -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("流程结束系统通知"); diff --git a/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorControllerV2.java b/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorControllerV2.java index 84d4c168..2ca2ad0e 100644 --- a/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorControllerV2.java +++ b/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorControllerV2.java @@ -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 entityPage = null; + + LambdaQueryWrapper queryWrapper = new QueryWrapper() + .lambda() + .select(SysNoticeEntity::getId,SysNoticeEntity::getJumpUrl,SysNoticeEntity::getApplyState,SysNoticeEntity::getType) + .isNull(SysNoticeEntity::getJumpUrl); + + long current = 1L; + do { + entityPage = sysNoticeDao.selectPage(new Page(current, 50), queryWrapper); + List records = entityPage.getRecords(); + for (SysNoticeEntity record : records) { + if (StringUtils.isBlank(record.getJumpUrl())) { + LambdaUpdateWrapper updateWrapper = new UpdateWrapper() + .lambda() + .eq(SysNoticeEntity::getId, record.getId()) + .set(SysNoticeEntity::getJumpUrl, noticeUntil.convertJumpUrl(record.getType(), record.getApplyState())); + sysNoticeDao.update(null, updateWrapper); + } + } + }while (entityPage.hasNext()); + + } + } diff --git a/renren-admin/src/main/java/io/renren/modules/notice/dto/SysNoticeDTO.java b/renren-admin/src/main/java/io/renren/modules/notice/dto/SysNoticeDTO.java index c580f478..6a150f35 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/dto/SysNoticeDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/dto/SysNoticeDTO.java @@ -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; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java b/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java index 94b0910d..c683b828 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java @@ -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; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java index 891fbd3c..8866cdea 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java @@ -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 getWrapper(Map params) { @@ -119,6 +122,12 @@ public class SysNoticeServiceImpl extends CrudServiceImpl> routeMap; + static Map typeMap; + static Map 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 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; + + } +} diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index 1fb1e304..78bced7a 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -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: diff --git a/renren-admin/src/main/resources/db/V6.9__notice_add_col.sql b/renren-admin/src/main/resources/db/V6.9__notice_add_col.sql new file mode 100644 index 00000000..4d014d49 --- /dev/null +++ b/renren-admin/src/main/resources/db/V6.9__notice_add_col.sql @@ -0,0 +1,2 @@ +ALTER TABLE `sys_notice` +ADD COLUMN `jump_url` varchar(255) NULL COMMENT '点击通知需要跳转的url' \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml index 895b78a0..c2182de8 100644 --- a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml +++ b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml @@ -12,7 +12,7 @@