消息管理

This commit is contained in:
liang.chao 2024-12-23 18:39:40 +08:00
parent 327ee5fe6a
commit 9fe6348c4e
8 changed files with 37 additions and 4 deletions

View File

@ -107,7 +107,7 @@ public class BmMessageController extends BaseController {
/**
* 修改消息
*/
@ApiOperation(value = "修改消息")
@ApiOperation(value = "已读修改")
@PreventRepeatSubmit
//@RequiresPermissions("basic:message:edit")
@SysLog(title = "消息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改消息")

View File

@ -61,4 +61,7 @@ public class BmMessage extends BaseEntity {
@Excel(name = "发给companyId")
@ApiModelProperty(value = "发给companyId")
private Long toCompany;
@ApiModelProperty(value = "是否已读(0:未读 1:已读)")
private Integer isRead;
}

View File

@ -126,12 +126,27 @@ public class BmMessageServiceImpl implements IBmMessageService {
*/
@Override
public int updateBmMessage(BmMessage bmMessage) {
bmMessage.setIsRead(1);
bmMessage.setUpdateTime(DateUtils.getNowDate());
try {
return bmMessageMapper.updateBmMessage(bmMessage);
bmMessageMapper.updateBmMessage(bmMessage);
//Redis
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
Collection<String> keys1 = SpringUtils.getBean(RedisService.class).keys(MaterialConstants.CACHE_MATERIAL_MALL_MESSAGE + bmMessage.getFromCompany() + ":" + companyId);
Collection<String> keys2 = SpringUtils.getBean(RedisService.class).keys(MaterialConstants.CACHE_MATERIAL_MALL_MESSAGE + companyId + ":" + bmMessage.getToCompany());
List<String> keys = new ArrayList<>();
keys.addAll(keys1);
keys.addAll(keys2);
for (String key : keys) {
JSONArray arrayCache = SpringUtils.getBean(RedisService.class).getCacheObject(key);
List<BmMessage> list = arrayCache.toList(BmMessage.class);
list.stream().forEach(t->t.setIsRead(1));
SpringUtils.getBean(RedisService.class).setCacheObject(key, list);
}
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
return 1;
}
/**

View File

@ -77,4 +77,6 @@ public interface BmFileInfoMapper {
Integer deleteBmFileInfoByMaId(@Param("maId") Integer maId, @Param("fileType") Integer fileType);
Integer deleteBmFileInfo(BmFileInfo fileInfo);
List<BmFileInfo> getInfoByMaId(Integer maId);
}

View File

@ -38,7 +38,12 @@ public class SafeBookServiceImpl implements SafeBookService {
@Override
public List<SafeBookInfo> getSafeBookByMaId(SafeBookInfo safeBookInfo) {
safeBookInfo.setUploadCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
return safeBookMapper.getSafeBookByMaId(safeBookInfo);
List<SafeBookInfo> safeBookByMaId = safeBookMapper.getSafeBookByMaId(safeBookInfo);
for (SafeBookInfo bookInfo : safeBookByMaId) {
List<BmFileInfo> files = bmFileInfoMapper.getInfoByMaId(bookInfo.getMaId());
bookInfo.setFileInfoList(files);
}
return safeBookByMaId;
}
@Override

View File

@ -77,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="toCompany != null">to_company = #{toCompany},</if>
<if test="messageContent != null">message_content = #{messageContent},</if>
<if test="messageTopic != null">message_topic = #{messageTopic},</if>
<if test="isRead != null">is_read = #{isRead},</if>
<if test="messageType != null">message_type = #{messageType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>

View File

@ -54,6 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileType != null "> and file_type = #{fileType}</if>
</where>
</select>
<select id="getInfoByMaId" resultType="com.bonus.common.biz.domain.BmFileInfo">
select
id, task_type, task_id, model_id, name as fileName, url as fileUrl, file_type, create_by, create_time
from bm_file_info
where model_id = #{maId} and file_type = 5 and task_type = 17
</select>
<insert id="insertBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id">
insert into bm_file_info

View File

@ -17,8 +17,9 @@
<select id="getSafeBookByMaId" resultType="com.bonus.material.device.domain.SafeBookInfo">
SELECT
d.code,
d.code as deviceCode,
d.device_name,
d.ma_id,
su.nick_name,
sb.create_time,
sb.update_time