| @@ -1,9 +1,9 @@ | |||
| package com.ruoyi.system.api; | |||
| import com.ruoyi.common.core.constant.SecurityConstants; | |||
| import com.ruoyi.common.core.constant.ServiceNameConstants; | |||
| import com.ruoyi.common.core.domain.R; | |||
| import com.ruoyi.system.api.domain.NewSysNotificationParamsVo; | |||
| import com.ruoyi.system.api.domain.NewSysNotificationSendVo; | |||
| import com.ruoyi.system.api.factory.RemoteInfoPublishFallbackFactory; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| @@ -23,6 +23,24 @@ public interface RemoteInfoPublishService | |||
| * @param newSysNotificationParamsVo 系统通知 | |||
| * @return 结果 | |||
| */ | |||
| @PostMapping("/notification/gitlink") | |||
| @PostMapping("gns/notification/gitlink") | |||
| public R<LoginUser> pushSysInfo(NewSysNotificationParamsVo newSysNotificationParamsVo); | |||
| /** | |||
| * 改变系统消息状态 | |||
| * | |||
| * @param newSysNotificationParamsVo 系统通知 | |||
| * @return 结果 | |||
| */ | |||
| // @PutMapping("/gns/notification/{platform}") | |||
| // public R<LoginUser> updateSysInfo(@PathVariable String platform,@RequestBody NewSysNotificationSendVo newSysNotificationParamsVo); | |||
| // | |||
| // /** | |||
| // * 改变系统消息状态 | |||
| // * | |||
| // * @param newSysNotificationParamsVo 系统通知 | |||
| // * @return 结果 | |||
| // */ | |||
| // @DeleteMapping("/gns/notification/{platform}") | |||
| // public R<LoginUser> deleteSysInfo(@PathVariable String platform,@RequestBody NewSysNotificationSendVo newSysNotificationParamsVo); | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| package com.ruoyi.system.api.domain; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import org.hibernate.validator.constraints.Range; | |||
| import javax.validation.constraints.NotBlank; | |||
| import javax.validation.constraints.NotNull; | |||
| import javax.validation.constraints.Pattern; | |||
| import javax.validation.constraints.Size; | |||
| /** | |||
| * @description: | |||
| * @author: wanjia | |||
| * @time: 2021/9/10 | |||
| */ | |||
| @Data | |||
| public class NewSysNotificationSendVo { | |||
| @ApiModelProperty(value = "消息接收者", required = true) | |||
| @Pattern(regexp = "^(\\-|\\+?)\\d+(,\\d+)*$", message = "接收者id串非法") | |||
| @NotBlank(message = "消息接收者不能为空") | |||
| private Integer receiver; | |||
| @ApiModelProperty(value = "消息ids,'-1' 全部消息", required = true) | |||
| @NotBlank(message = "消息内容不能为空") | |||
| private String notificationIds; | |||
| @ApiModelProperty(value = "消息类型 1-系统消息 2-@我", required = true) | |||
| @NotNull(message = "消息类型不能为空") | |||
| private Integer type; | |||
| @ApiModelProperty(value = "已读状态: 1未读,2已读", required = true) | |||
| @Range(min = 1, max = 2) | |||
| @NotNull(message = "已读状态不能为空") | |||
| private Integer status; | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.R; | |||
| import com.ruoyi.system.api.RemoteInfoPublishService; | |||
| import com.ruoyi.system.api.RemoteUserService; | |||
| import com.ruoyi.system.api.domain.NewSysNotificationParamsVo; | |||
| import com.ruoyi.system.api.domain.NewSysNotificationSendVo; | |||
| import com.ruoyi.system.api.domain.SysUser; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import org.slf4j.Logger; | |||
| @@ -32,6 +33,16 @@ public class RemoteInfoPublishFallbackFactory implements FallbackFactory<RemoteI | |||
| { | |||
| return R.fail("推送系统消息:" + throwable.getMessage()); | |||
| } | |||
| // | |||
| // @Override | |||
| // public R<LoginUser> updateSysInfo(String platform,NewSysNotificationSendVo newSysNotificationParamsVo) { | |||
| // return R.fail("更新系统消息:" + throwable.getMessage()); | |||
| // } | |||
| // | |||
| // @Override | |||
| // public R<LoginUser> deleteSysInfo(String platform,NewSysNotificationSendVo newSysNotificationParamsVo) { | |||
| // return R.fail("删除系统消息:" + throwable.getMessage()); | |||
| // } | |||
| }; | |||
| } | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.ruoyi.platform.controller.approval; | |||
| import com.ruoyi.common.core.domain.R; | |||
| import com.ruoyi.common.core.web.domain.AjaxResult; | |||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||
| import com.ruoyi.platform.domain.ApprovalRequest; | |||
| import com.ruoyi.platform.service.ApprovalService; | |||
| import com.ruoyi.platform.service.SysNotificationService; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.annotation.Resource; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("sysNotification") | |||
| @Api("系统通知") | |||
| public class SysNotificationController { | |||
| @Resource | |||
| private SysNotificationService sysNotificationService; | |||
| /** | |||
| * 一键已读 | |||
| * @param | |||
| * @return | |||
| */ | |||
| @PostMapping("/read-all") | |||
| public AjaxResult readAll() { | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| sysNotificationService.readAll(loginUser); | |||
| return AjaxResult.success("审批完成"); | |||
| } | |||
| /** | |||
| * 一键删除 | |||
| * @return | |||
| */ | |||
| @PostMapping("/delete-all") | |||
| public R<List<ApprovalRequest>> deleteAll(@RequestParam List<String> notificationIds) { | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| return R.ok(sysNotificationService.deleteAll(notificationIds,loginUser)); | |||
| } | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.ruoyi.system.api.model.LoginUser; | |||
| import org.springframework.core.io.InputStreamResource; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import org.springframework.http.HttpRequest; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| @@ -50,5 +51,5 @@ public interface NewDatasetService { | |||
| String getNextVersion(NewDatasetVo datasetVo) throws Exception; | |||
| String publish(NewDatasetVo datasetVo, LoginUser loginUser); | |||
| String publish(NewDatasetVo datasetVo, LoginUser loginUser) throws Exception; | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.ruoyi.platform.service; | |||
| import com.ruoyi.platform.domain.ApprovalRequest; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import java.util.List; | |||
| public interface SysNotificationService { | |||
| void readAll(LoginUser loginUser); | |||
| List<ApprovalRequest> deleteAll(List<String> notificationIds,LoginUser loginUser); | |||
| } | |||
| @@ -1,8 +1,11 @@ | |||
| package com.ruoyi.platform.service.impl; | |||
| import cn.hutool.core.bean.BeanUtil; | |||
| import cn.hutool.core.date.DateUtil; | |||
| import cn.hutool.core.util.IdUtil; | |||
| import cn.hutool.core.util.StrUtil; | |||
| import cn.hutool.http.HttpResponse; | |||
| import cn.hutool.http.HttpUtil; | |||
| import com.alibaba.fastjson2.JSON; | |||
| import com.ruoyi.common.core.utils.DateUtils; | |||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||
| @@ -28,6 +31,7 @@ import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageImpl; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import org.springframework.http.HttpHeaders; | |||
| import org.springframework.http.HttpRequest; | |||
| import org.springframework.http.MediaType; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -722,7 +726,8 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| } | |||
| @Override | |||
| public String publish(NewDatasetVo datasetVo,LoginUser loginUser) { | |||
| public String publish(NewDatasetVo datasetVo, LoginUser loginUser) throws Exception { | |||
| NewDatasetVo newDatasetDesc = getNewDatasetDesc(datasetVo.getId(), datasetVo.getName(), datasetVo.getIdentifier(), datasetVo.getOwner(), null, false); | |||
| String username = loginUser.getUsername(); | |||
| Long userid = loginUser.getUserid(); | |||
| ApprovalRequest approvalRequest = new ApprovalRequest(); | |||
| @@ -731,16 +736,15 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| approvalRequest.setApplicantId(userid); | |||
| approvalRequest.setStatus(ApprovalStatus.PENDING.getCode()); | |||
| String titleTemplate="<b>{}</b>发布的数据集<b>\"{}\"</b>需要审核,请查看"; | |||
| String titleTemplate = "<b>{}</b>发布的数据集<b>\"{}\"</b>需要审核,请查看"; | |||
| String urlTemplate = "/dataset/dataset/info/{}?name={}&owner={}&identifier={}&is_public={}"; | |||
| String titleFormat = StrUtil.format(titleTemplate, username,datasetVo.getIdentifier()); | |||
| String urlFormat = StrUtil.format(urlTemplate, datasetVo.getId(), datasetVo.getName(), datasetVo.getOwner(), datasetVo.getIdentifier(), datasetVo.getIsPublic()); | |||
| String titleFormat = StrUtil.format(titleTemplate, username, newDatasetDesc.getIdentifier()); | |||
| String urlFormat = StrUtil.format(urlTemplate, newDatasetDesc.getId(), newDatasetDesc.getName(), newDatasetDesc.getOwner(), newDatasetDesc.getIdentifier(), newDatasetDesc.getIsPublic()); | |||
| approvalRequest.setTitle(titleFormat); | |||
| approvalRequest.setUrl(urlFormat); | |||
| // approvalRequest.setApplicantTime(new Date()); | |||
| approvalRequest.setContent(JSON.toJSONString(datasetVo)); | |||
| approvalRequest.setContent(JSON.toJSONString(newDatasetDesc)); | |||
| approvalService.submit(approvalRequest); | |||
| NewSysNotificationParamsVo paramsVo = new NewSysNotificationParamsVo(); | |||
| @@ -749,7 +753,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| paramsVo.setSender(userid); | |||
| paramsVo.setType(2); | |||
| paramsVo.setNotification_url("/system/approval"); | |||
| // remoteInfoPublishService.pushSysInfo(paramsVo); | |||
| remoteInfoPublishService.pushSysInfo(paramsVo); | |||
| return "发布成功"; | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.ruoyi.platform.service.impl; | |||
| import com.ruoyi.platform.domain.ApprovalRequest; | |||
| import com.ruoyi.platform.service.SysNotificationService; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Collections; | |||
| import java.util.List; | |||
| @Service | |||
| public class SysNotificationServiceImpl implements SysNotificationService { | |||
| @Override | |||
| public void readAll(LoginUser loginUser) { | |||
| } | |||
| @Override | |||
| public List<ApprovalRequest> deleteAll(List<String> notificationIds,LoginUser loginUser) { | |||
| return Collections.emptyList(); | |||
| } | |||
| } | |||
| @@ -50,35 +50,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| ) | |||
| </insert> | |||
| <!-- <insert id="insertApproval" parameterType="com.ruoyi.platform.domain.ApprovalRequest" useGeneratedKeys="true" keyProperty="id">--> | |||
| <!-- insert into approval_info (--> | |||
| <!-- <if test="status != null and status != '' ">status,</if>--> | |||
| <!-- <if test="result != null and result != '' ">result,</if>--> | |||
| <!-- <if test="content != null and content != '' ">content,</if>--> | |||
| <!-- <if test="applicantId != null and applicantId != '' ">applicant_id,</if>--> | |||
| <!-- <if test="applicantTime != null ">applicant_time,</if>--> | |||
| <!-- <if test="applicantName != null and applicantName != ''">applicant_name,</if>--> | |||
| <!-- <if test="approverId != null and approverId != ''">approver_id,</if>--> | |||
| <!-- <if test="approverTime != null ">approver_time,</if>--> | |||
| <!-- <if test="title != null and title != ''">title,</if>--> | |||
| <!-- <if test="type != null and type != ''">type,</if>--> | |||
| <!-- <if test="url != null and url != ''">url,</if>--> | |||
| <!-- )values(--> | |||
| <!-- <if test="status != null and status != ''">#{status},</if>--> | |||
| <!-- <if test="result != null and result != ''">#{result},</if>--> | |||
| <!-- <if test="content != null and content != ''">#{content},</if>--> | |||
| <!-- <if test="applicantId != null and applicantId != ''">#{applicantId},</if>--> | |||
| <!-- <if test="applicantTime != null ">#{applicantTime},</if>--> | |||
| <!-- <if test="applicantName != null and applicantName != ''">#{applicantName},</if>--> | |||
| <!-- <if test="approverId != null and approverId != ''">#{approverId},</if>--> | |||
| <!-- <if test="approverTime != null ">#{approverTime},</if>--> | |||
| <!-- <if test="title != null and title != ''">#{title},</if>--> | |||
| <!-- <if test="type != null and type != ''">#{type},</if>--> | |||
| <!-- <if test="url != null and url != ''">#{url},</if>--> | |||
| <!-- )--> | |||
| <!-- </insert>--> | |||
| <update id="updateApproval" parameterType="com.ruoyi.platform.domain.ApprovalRequest"> | |||
| update approval_info | |||
| <set> | |||
| @@ -125,14 +96,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| </where> | |||
| </select> | |||
| <delete id="deleteConfigById" parameterType="Long"> | |||
| delete from sys_config where config_id = #{configId} | |||
| <delete id="deleteById" parameterType="Long"> | |||
| delete from approval_info where id = #{id} | |||
| </delete> | |||
| <delete id="deleteConfigByIds" parameterType="Long"> | |||
| delete from sys_config where config_id in | |||
| <foreach item="configId" collection="array" open="(" separator="," close=")"> | |||
| #{configId} | |||
| <delete id="deleteByIds" parameterType="Long"> | |||
| delete from approval_info where id in | |||
| <foreach item="id" collection="array" open="(" separator="," close=")"> | |||
| #{id} | |||
| </foreach> | |||
| </delete> | |||