|
|
@ -24,6 +24,7 @@ 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.UserMessageFormDTO; |
|
|
@ -69,13 +70,13 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User |
|
|
|
|
|
|
|
private QueryWrapper<UserMessageEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
String communityId = (String) params.get(FieldConstant.COMMUNITY_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); |
|
|
|
|
|
|
|
QueryWrapper<UserMessageEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id) |
|
|
|
.eq(StringUtils.isNotBlank(communityId), FieldConstant.COMMUNITY_ID, communityId) |
|
|
|
.eq(StringUtils.isNotBlank(customerId), FieldConstant.CUSTOMER_ID, customerId) |
|
|
|
.eq(StringUtils.isNotBlank(gridId), FieldConstant.GRID_ID, gridId) |
|
|
|
.eq(StringUtils.isNotBlank(userId), FieldConstant.USER_ID, userId); |
|
|
|
|
|
|
@ -109,11 +110,44 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result allRead(UserMessageDTO messageDTO) { |
|
|
|
return null; |
|
|
|
@Override |
|
|
|
public Result readMessage(UserMessageDTO messageDTO) { |
|
|
|
UserMessageEntity messageEntity = new UserMessageEntity(); |
|
|
|
messageEntity.setReadFlag(UserMessageConstans.READ); |
|
|
|
messageDTO.setReadFlag(UserMessageConstans.UNREAD); |
|
|
|
baseDao.update(messageEntity, getWrapper(messageDTO)); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
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(); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<UserMessageEntity> getWrapper(UserMessageDTO messageDTO) { |
|
|
|
String id = messageDTO.getId(); |
|
|
|
String customerId = messageDTO.getCustomerId(); |
|
|
|
String gridId = messageDTO.getGridId(); |
|
|
|
String userId = messageDTO.getUserId(); |
|
|
|
String readFlag = messageDTO.getReadFlag(); |
|
|
|
String deFlag = messageDTO.getDelFlag(); |
|
|
|
|
|
|
|
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(deFlag), FieldConstant.DEL_FLAG, deFlag) |
|
|
|
.eq(StringUtils.isNotBlank(readFlag),"read_flag", readFlag); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result saveUserMessage(UserMessageFormDTO formDto) { |
|
|
|
UserMessageEntity entity = ConvertUtils.sourceToTarget(formDto, UserMessageEntity.class); |
|
|
|