feat(消息通知): 增加agv小车到达通知

This commit is contained in:
Kelvin 2025-01-07 14:22:32 +08:00
parent a425fd5ea4
commit 888335a5bc
3 changed files with 102 additions and 75 deletions

View File

@ -29,14 +29,13 @@ import com.ktg.common.core.page.TableDataInfo;
/**
* 消息Controller
*
*
* @author yinjinlu
* @date 2023-03-06
*/
@RestController
@RequestMapping("/system/message")
public class SysMessageController extends BaseController
{
public class SysMessageController extends BaseController {
@Autowired
private ISysMessageService sysMessageService;
@Autowired
@ -49,8 +48,7 @@ public class SysMessageController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:message:list')")
@GetMapping("/list")
public TableDataInfo list(SysMessage sysMessage)
{
public TableDataInfo list(SysMessage sysMessage) {
startPage();
List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
return getDataTable(list);
@ -62,8 +60,7 @@ public class SysMessageController extends BaseController
@PreAuthorize("@ss.hasPermi('system:message:export')")
@Log(title = "消息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysMessage sysMessage)
{
public void export(HttpServletResponse response, SysMessage sysMessage) {
List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
ExcelUtil<SysMessage> util = new ExcelUtil<SysMessage>(SysMessage.class);
util.exportExcel(response, list, "消息数据");
@ -74,8 +71,7 @@ public class SysMessageController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:message:query')")
@GetMapping(value = "/{messageId}")
public AjaxResult getInfo(@PathVariable("messageId") Long messageId)
{
public AjaxResult getInfo(@PathVariable("messageId") Long messageId) {
return AjaxResult.success(sysMessageService.selectSysMessageByMessageId(messageId));
}
@ -85,20 +81,28 @@ public class SysMessageController extends BaseController
@PreAuthorize("@ss.hasPermi('system:message:add')")
@Log(title = "消息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysMessage sysMessage)
{
public AjaxResult add(@RequestBody SysMessage sysMessage) {
messageProvider.sendMessage(sysMessage);
return AjaxResult.success();
}
/**
* 通知用户agv小车到达
*/
@Log(title = "消息", businessType = BusinessType.INSERT)
@PostMapping("/open/agv-arrived")
public AjaxResult addAgv(@RequestBody SysMessage sysMessage) {
sysMessageService.insertSysPromptMessage("AGV小车已到达","");
return AjaxResult.success();
}
/**
* 修改消息
*/
@PreAuthorize("@ss.hasPermi('system:message:edit')")
@Log(title = "消息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysMessage sysMessage)
{
public AjaxResult edit(@RequestBody SysMessage sysMessage) {
return toAjax(sysMessageService.updateSysMessage(sysMessage));
}
@ -107,11 +111,10 @@ public class SysMessageController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:message:remove')")
@Log(title = "消息", businessType = BusinessType.DELETE)
@DeleteMapping("/{messageIds}")
public AjaxResult remove(@PathVariable Long[] messageIds)
{
for (Long messageId: messageIds
) {
@DeleteMapping("/{messageIds}")
public AjaxResult remove(@PathVariable Long[] messageIds) {
for (Long messageId : messageIds
) {
SysMessage sysMessage = sysMessageService.selectSysMessageByMessageId(messageId);
sysMessage.setDeletedFlag(UserConstants.YES);
sysMessageService.updateSysMessage(sysMessage);

View File

@ -0,0 +1,13 @@
package com.ktg.system.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
@Getter
@Setter
public class AgvArrivedDto {
@NotBlank(message = "订单号不能为空")
String orderNo;
}

View File

@ -1,89 +1,100 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="noticeId" column="notice_id"/>
<result property="noticeTitle" column="notice_title"/>
<result property="noticeType" column="notice_type"/>
<result property="noticeContent" column="notice_content"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
SELECT notice_id,
notice_title,
notice_type,
notice_content
status,
create_by,
create_time,
update_by,
update_time,
remark
FROM sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
<if test="noticeContent != null and noticeContent != '' ">notice_content,</if>
<if test="status != null and status != '' ">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
<if test="noticeType != null and noticeType != ''">#{noticeType},</if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType},</if>
<if test="noticeContent != null">notice_content = #{noticeContent},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
delete
from sys_notice
where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>