|
|
@ -20,13 +20,15 @@ package com.epmet.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.UserMessageConstans; |
|
|
|
import com.epmet.dao.UserMessageDao; |
|
|
|
import com.epmet.dto.UserMessageDTO; |
|
|
|
import com.epmet.dto.form.MymessageFormDTO; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.entity.UserMessageEntity; |
|
|
|
import com.epmet.redis.UserMessageRedis; |
|
|
@ -72,13 +74,13 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
String customerId = (String) params.get(FieldConstant.CUSTOMER_ID_HUMP); |
|
|
|
String gridId = (String) params.get(FieldConstant.GRID_ID_HUMP); |
|
|
|
String userId = (String) params.get(FieldConstant.USER_ID_HUMP); |
|
|
|
String userId = (String) params.get(FieldConstant.USER_ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<UserMessageEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id) |
|
|
|
.eq(StringUtils.isNotBlank(customerId), FieldConstant.CUSTOMER_ID, customerId) |
|
|
|
.eq(StringUtils.isNotBlank(gridId), FieldConstant.GRID_ID, gridId) |
|
|
|
.eq(StringUtils.isNotBlank(userId), FieldConstant.USER_ID, userId); |
|
|
|
.eq(StringUtils.isNotBlank(customerId), FieldConstant.CUSTOMER_ID, customerId) |
|
|
|
.eq(StringUtils.isNotBlank(gridId), FieldConstant.GRID_ID, gridId) |
|
|
|
.eq(StringUtils.isNotBlank(userId), FieldConstant.USER_ID, userId); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
@ -121,13 +123,13 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result readAllMessage(UserMessageDTO messageDTO) { |
|
|
|
public Result readAllMessage(UserMessageDTO messageDTO) { |
|
|
|
UserMessageEntity messageEntity = new UserMessageEntity(); |
|
|
|
messageEntity.setReadFlag(UserMessageConstans.READ); |
|
|
|
messageDTO.setReadFlag(UserMessageConstans.UNREAD); |
|
|
|
baseDao.update(messageEntity, getWrapper(messageDTO)); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<UserMessageEntity> getWrapper(UserMessageDTO messageDTO) { |
|
|
|
String id = messageDTO.getId(); |
|
|
@ -143,7 +145,7 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User |
|
|
|
.eq(StringUtils.isNotBlank(gridId), FieldConstant.GRID_ID, gridId) |
|
|
|
.eq(StringUtils.isNotBlank(userId), FieldConstant.USER_ID, userId) |
|
|
|
.eq(StringUtils.isNotBlank(deFlag), FieldConstant.DEL_FLAG, deFlag) |
|
|
|
.eq(StringUtils.isNotBlank(readFlag),"read_flag", readFlag); |
|
|
|
.eq(StringUtils.isNotBlank(readFlag), "read_flag", readFlag); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
@ -155,4 +157,12 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<List<UserMessageDTO>> getMyMessageList(MymessageFormDTO params) { |
|
|
|
int pageIndex = (params.getPageNo() - NumConstant.ONE) * params.getPageSize(); |
|
|
|
params.setPageNo(pageIndex); |
|
|
|
List<UserMessageEntity> myMessageList = baseDao.selectMyMessageList(params); |
|
|
|
return new Result<List<UserMessageDTO>>().ok(ConvertUtils.sourceToTarget(myMessageList, UserMessageDTO.class)); |
|
|
|
} |
|
|
|
|
|
|
|
} |