From 001b6e7e33c5ab6661f3e6b6005d852e5d73d28f Mon Sep 17 00:00:00 2001 From: yinq Date: Mon, 29 Jul 2024 08:54:10 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20add=E8=BD=A6=E9=97=B4=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysNoticeController.java | 26 ++ .../java/com/hw/system/domain/SysNotice.java | 19 ++ .../com/hw/system/mapper/SysNoticeMapper.java | 15 + .../hw/system/service/ISysNoticeService.java | 15 + .../service/impl/SysNoticeServiceImpl.java | 25 ++ .../mapper/system/SysNoticeMapper.xml | 31 +- hw-ui/src/api/system/notice.js | 20 +- hw-ui/src/components/DownloadFile/index.vue | 190 +++++++++++ hw-ui/src/components/ReadOnlyEditor/index.vue | 299 ++++++++++++++++++ hw-ui/src/components/workshopNotice/index.vue | 70 ++++ hw-ui/src/utils/notice.js | 58 ++++ hw-ui/src/views/board/firstFloor/index.vue | 10 +- 12 files changed, 774 insertions(+), 4 deletions(-) create mode 100644 hw-ui/src/components/DownloadFile/index.vue create mode 100644 hw-ui/src/components/ReadOnlyEditor/index.vue create mode 100644 hw-ui/src/components/workshopNotice/index.vue create mode 100644 hw-ui/src/utils/notice.js diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/controller/SysNoticeController.java b/hw-modules/hw-system/src/main/java/com/hw/system/controller/SysNoticeController.java index b4f3709..63c257d 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/controller/SysNoticeController.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/controller/SysNoticeController.java @@ -1,6 +1,8 @@ package com.hw.system.controller; import java.util.List; + +import com.hw.system.domain.SysUserNotice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -89,4 +91,28 @@ public class SysNoticeController extends BaseController { return toAjax(noticeService.deleteNoticeByIds(noticeIds)); } + + /** + * 车间获取通知公告List + * @param notice + * @return + */ + @GetMapping("/workshopNoticeList") + public AjaxResult workshopNoticeList(SysNotice notice) + { + List list = noticeService.workshopNoticeList(notice); + return success(list); + } + + /** + * 更新用户通知公告 + * @param userNotice + * @return + */ + @Log(title = "通知公告", businessType = BusinessType.UPDATE) + @PostMapping("/updateUserNotice") + public AjaxResult updateUserNotice( @RequestBody SysUserNotice userNotice) + { + return toAjax(noticeService.updateUserNotice(userNotice)); + } } diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/domain/SysNotice.java b/hw-modules/hw-system/src/main/java/com/hw/system/domain/SysNotice.java index 73fbdbc..731888b 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/domain/SysNotice.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/domain/SysNotice.java @@ -78,6 +78,25 @@ public class SysNotice extends BaseEntity { */ private List userNoticeList; + private Long userId; + private String checkStatus; + + public String getCheckStatus() { + return checkStatus; + } + + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + public List getUserNoticeList() { return userNoticeList; } diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/mapper/SysNoticeMapper.java b/hw-modules/hw-system/src/main/java/com/hw/system/mapper/SysNoticeMapper.java index a5c07af..7a795ea 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/mapper/SysNoticeMapper.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/mapper/SysNoticeMapper.java @@ -82,4 +82,19 @@ public interface SysNoticeMapper * @return 结果 */ public int deleteSysUserNoticeByNoticeId(Long noticeId); + + /** + * 车间获取通知公告List + * @param notice + * @return + */ + List workshopNoticeList(SysNotice notice); + + /** + * 更新用户通知公告 + * @param userNotice + * @return + */ + public int updateSysUserNotice(SysUserNotice userNotice); + } \ No newline at end of file diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/service/ISysNoticeService.java b/hw-modules/hw-system/src/main/java/com/hw/system/service/ISysNoticeService.java index 64ba0ad..a6b0633 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/service/ISysNoticeService.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/service/ISysNoticeService.java @@ -2,6 +2,7 @@ package com.hw.system.service; import java.util.List; import com.hw.system.domain.SysNotice; +import com.hw.system.domain.SysUserNotice; /** * 公告 服务层 @@ -57,4 +58,18 @@ public interface ISysNoticeService * @return 结果 */ public int deleteNoticeByIds(Long[] noticeIds); + + /** + * 车间获取通知公告List + * @param notice + * @return + */ + List workshopNoticeList(SysNotice notice); + + /** + * 更新用户通知公告 + * @param userNotice + * @return + */ + public int updateUserNotice(SysUserNotice userNotice); } diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/service/impl/SysNoticeServiceImpl.java b/hw-modules/hw-system/src/main/java/com/hw/system/service/impl/SysNoticeServiceImpl.java index 6c2b379..0d1c836 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/service/impl/SysNoticeServiceImpl.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/service/impl/SysNoticeServiceImpl.java @@ -2,8 +2,11 @@ package com.hw.system.service.impl; import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.StringUtils; +import com.hw.common.security.utils.SecurityUtils; import com.hw.system.common.mapper.SysPointRouterMapper; import com.hw.system.domain.SysUserNotice; import org.springframework.beans.factory.annotation.Autowired; @@ -133,4 +136,26 @@ public class SysNoticeServiceImpl implements ISysNoticeService } } + /** + * 车间获取通知公告List + * @param notice + * @return + */ + @Override + public List workshopNoticeList(SysNotice notice) { + Long userId = SecurityUtils.getUserId(); + notice.setUserId(userId); + return noticeMapper.workshopNoticeList(notice); + } + + /** + * 更新用户通知公告 + * @param userNotice + * @return + */ + @Override + public int updateUserNotice(SysUserNotice userNotice) { + return noticeMapper.updateSysUserNotice(userNotice); + } + } diff --git a/hw-modules/hw-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/hw-modules/hw-system/src/main/resources/mapper/system/SysNoticeMapper.xml index 0007371..cd0e3f1 100644 --- a/hw-modules/hw-system/src/main/resources/mapper/system/SysNoticeMapper.xml +++ b/hw-modules/hw-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -62,8 +62,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND create_by like concat('%', #{createBy}, '%') + order by create_time desc + + - insert into sys_notice ( notice_title, @@ -134,5 +152,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ( #{item.noticeId}, #{item.userId}) + + + update sys_user_notice + + check_status = #{checkStatus}, + check_time = #{checkTime}, + download_status = #{downloadStatus}, + download_time = #{downloadTime}, + + where notice_id = #{noticeId} and user_id = #{userId} + \ No newline at end of file diff --git a/hw-ui/src/api/system/notice.js b/hw-ui/src/api/system/notice.js index c274ea5..0de3cfc 100644 --- a/hw-ui/src/api/system/notice.js +++ b/hw-ui/src/api/system/notice.js @@ -41,4 +41,22 @@ export function delNotice(noticeId) { url: '/system/notice/' + noticeId, method: 'delete' }) -} \ No newline at end of file +} + +// 车间获取通知公告List +export function workshopNoticeList(query) { + return request({ + url: '/system/notice/workshopNoticeList', + method: 'get', + params: query + }) +} + +// 更新用户通知公告 +export function updateUserNotice(data) { + return request({ + url: '/system/notice/updateUserNotice', + method: 'post', + data: data + }) +} diff --git a/hw-ui/src/components/DownloadFile/index.vue b/hw-ui/src/components/DownloadFile/index.vue new file mode 100644 index 0000000..7d78bb9 --- /dev/null +++ b/hw-ui/src/components/DownloadFile/index.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/hw-ui/src/components/ReadOnlyEditor/index.vue b/hw-ui/src/components/ReadOnlyEditor/index.vue new file mode 100644 index 0000000..643a36b --- /dev/null +++ b/hw-ui/src/components/ReadOnlyEditor/index.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/hw-ui/src/components/workshopNotice/index.vue b/hw-ui/src/components/workshopNotice/index.vue new file mode 100644 index 0000000..dd163da --- /dev/null +++ b/hw-ui/src/components/workshopNotice/index.vue @@ -0,0 +1,70 @@ + + + diff --git a/hw-ui/src/utils/notice.js b/hw-ui/src/utils/notice.js new file mode 100644 index 0000000..56303b4 --- /dev/null +++ b/hw-ui/src/utils/notice.js @@ -0,0 +1,58 @@ +import {updateUserNotice, workshopNoticeList} from "@/api/system/notice"; +import {parseTime} from "@/utils/ruoyi"; + +export const noticeData = { + data() { + return { + showTableDialog: false, + //用户下的通知公告List + noticeList: [], + //当前显示的通知公告 + noticeListData: {}, + notificationInstance: null // 保存通知实例 + }; + }, + mounted() { + setInterval(() => { + workshopNoticeList({noticeType: '1', checkStatus: '0'}).then(res => { + this.noticeList = res.data; + if (this.noticeList.length > 0) { + this.notificationInstance = this.$notify.info({ + title: '通知', + position: 'bottom-right', + duration: 0, + message: this.$createElement( + "div", + { + on: { + click: () => { + this.handleNotificationClick(); + }, + }, + }, + [this.$createElement("el-button", {}, ["点击查看"])] + ), + }); + } + }); + }, 60 * 1000) + }, + methods: { + handleNotificationClick() { + this.noticeListData = this.noticeList[0]; + let userNotice = this.noticeListData.sysUserNoticeList[0]; + userNotice.checkStatus = '1' + userNotice.checkTime = parseTime(new Date()); + //更新用户公告查看状态 + updateUserNotice(userNotice).then(res => { + this.showTableDialog = true; + }) + if (this.notificationInstance) { + this.notificationInstance.close(); // 手动关闭通知 + } + }, + } +}; + + + diff --git a/hw-ui/src/views/board/firstFloor/index.vue b/hw-ui/src/views/board/firstFloor/index.vue index d56ffe7..b0904f4 100644 --- a/hw-ui/src/views/board/firstFloor/index.vue +++ b/hw-ui/src/views/board/firstFloor/index.vue @@ -544,6 +544,9 @@ /> +
+ +
@@ -551,6 +554,8 @@ import Chart from '@/components/board/Chart' import PrintPage from '@/views/mes/barcode/endProductIndex' import {monitorSerialData} from "@/utils/serial" +import WorkshopNotice from "@/components/workshopNotice/index.vue"; +import {noticeData} from "@/utils/notice" import * as echarts from 'echarts' import { getStockTotal, @@ -574,9 +579,10 @@ export default { dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type',"mes_safe_flag"], components: { Chart, - PrintPage + PrintPage, + WorkshopNotice }, - mixins: [monitorSerialData], + mixins: [monitorSerialData, noticeData], data() { return { info: {},