Browse Source

Merge branch 'dev0.2' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev0.2

dev
sunyuchao 5 years ago
parent
commit
74c7152ee9
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisConfig.java
  2. 12
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java
  3. 12
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/UserMessageDao.java
  4. 8
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/UserMessageService.java
  5. 28
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/UserMessageServiceImpl.java
  6. 32
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml
  7. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java
  8. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java
  9. 54
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  10. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  11. 12
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml
  12. 4
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml
  13. 10
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java
  14. 8
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallBack.java
  15. 7
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java
  16. 5
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/service/UserMessageService.java
  17. 15
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/service/impl/UserMessageServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisConfig.java

@ -36,7 +36,6 @@ public class RedisConfig {
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(new JsonRedisSerializer<>(Object.class));
redisTemplate.setConnectionFactory(factory);
return redisTemplate;
}
}

12
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java

@ -23,9 +23,10 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.UserMessageDTO;
import com.epmet.dto.form.MymessageFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.excel.UserMessageExcel;
import com.epmet.service.UserMessageService;
@ -50,8 +51,8 @@ public class UserMessageController {
@Autowired
private UserMessageService userMessageService;
@GetMapping("page")
public Result<PageData<UserMessageDTO>> page(@RequestParam Map<String, Object> params){
@PostMapping("page")
public Result<PageData<UserMessageDTO>> page(@RequestBody Map<String, Object> params){
PageData<UserMessageDTO> page = userMessageService.page(params);
return new Result<PageData<UserMessageDTO>>().ok(page);
}
@ -126,4 +127,9 @@ public class UserMessageController {
ValidatorUtils.validateEntity(formDto);
return userMessageService.saveUserMessage(formDto);
}
@PostMapping("mymsg")
public Result<List<UserMessageDTO>> getMyMessageList(@RequestBody MymessageFormDTO params){
return userMessageService.getMyMessageList(params);
}
}

12
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/UserMessageDao.java

@ -18,9 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.MymessageFormDTO;
import com.epmet.entity.UserMessageEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 用户消息表
*
@ -29,11 +32,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface UserMessageDao extends BaseDao<UserMessageEntity> {
/**
* 更新阅读状态为已读
*
* @param entity 参数
* 获取消息分页
* @param messageFromDTO
* @return
*/
void updateReadFlag(UserMessageEntity entity);
List<UserMessageEntity> selectMyMessageList(MymessageFormDTO messageFromDTO);
}

8
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/UserMessageService.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserMessageDTO;
import com.epmet.dto.form.MymessageFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.entity.UserMessageEntity;
@ -119,4 +120,11 @@ public interface UserMessageService extends BaseService<UserMessageEntity> {
* @Date 2020/4/7 15:34
**/
Result saveUserMessage(UserMessageFormDTO formDto);
/**
* 获取我的消息列表
* @param param 参数
* @return
*/
Result<List<UserMessageDTO>> getMyMessageList(MymessageFormDTO param);
}

28
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/UserMessageServiceImpl.java

@ -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));
}
}

32
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml

@ -3,7 +3,7 @@
<mapper namespace="com.epmet.dao.UserMessageDao">
<resultMap type="com.epmet.entity.UserMessageEntity" id="userMessageMap">
<resultMap id="userMessageMap" type="com.epmet.entity.UserMessageEntity">
<result property="id" column="ID"/>
<result property="customerId" column="customer_id"/>
<result property="gridId" column="grid_id"/>
@ -19,9 +19,35 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="updateReadFlag" parameterType="com.epmet.entity.UserMessageEntity">
</update>
<select id="selectMyMessageList" resultType="com.epmet.entity.UserMessageEntity">
SELECT
id,
app,
updated_time,
updated_by,
read_flag,
title,
del_flag,
user_id,
revision,
created_by,
customer_id,
created_time,
grid_id,
message_content
FROM
epmet_message.user_message
WHERE
del_flag = '0'
AND (
CUSTOMER_ID = #{customerId}
AND GRID_ID = #{gridId}
AND USER_ID = #{userId})
ORDER BY
CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

9
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java

@ -59,7 +59,12 @@ public interface TopicConstant {
String CREATED_DATE = "CREATED_TIME";
/**
* 构造queryWrapper 逻辑删除标识列名
* 构造queryWrapper 小组Id
* */
String DEL_FLAG = "DEL_FLAG";
String RESI_GROUP_ID = "RESI_GROUP_ID";
/**
* 构造queryWrapper 附件排序
* */
String SORT = "SORT";
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java

@ -63,4 +63,9 @@ public class ResiTopicAttachmentEntity extends BaseEpmetEntity {
*/
private String attachmentUrl;
/**
* 排序字段解决多张图片的createdTime相同时的排序问题
* */
private Integer sort;
}

54
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
@ -30,7 +31,9 @@ import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupStatisticalDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.topic.dao.ResiTopicAttachmentDao;
@ -54,14 +57,14 @@ import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 话题信息表
@ -93,6 +96,15 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Autowired
ResiGroupMemberDao resiGroupMemberDao;
@Autowired
ResiGroupStatisticalDao resiGroupStatisticalDao;
@Autowired
RedisUtils redisUtil;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override
public PageData<ResiTopicDTO> page(Map<String, Object> params) {
IPage<ResiTopicEntity> page = baseDao.selectPage(
@ -169,6 +181,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
return result;
}
Date currentTime = new Date();
//2.创建话题
if(resiTopicPublishFormDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){
//内容超过最大限制
@ -184,10 +198,13 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
}
if(null != resiTopicPublishFormDTO.getAttachmentList() && resiTopicPublishFormDTO.getAttachmentList().size() > 0){
ResiTopicAttachmentEntity attachment = new ResiTopicAttachmentEntity();
Integer sort = 0;
for(String url : resiTopicPublishFormDTO.getAttachmentList()){
attachment.setAttachmentUrl(url);
attachment.setTopicId(topic.getId());
attachment.setCreatedBy(tokenDto.getUserId());
attachment.setAttachmentFormat(url.substring(url.lastIndexOf("\\.") + 1).toLowerCase());
attachment.setSort(sort++);
resiTopicAttachmentDao.insertOne(attachment);
}
}
@ -199,6 +216,32 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
operation.setCreatedBy(tokenDto.getUserId());
resiTopicOperationDao.insertOne(operation);
//4.小组统计信息,话题数+1
QueryWrapper<ResiGroupStatisticalEntity> wrapper = new QueryWrapper<>();
wrapper.eq(TopicConstant.RESI_GROUP_ID,resiTopicPublishFormDTO.getGroupId());
List<ResiGroupStatisticalEntity> statistical = resiGroupStatisticalDao.selectList(wrapper);
if(null != statistical && statistical.size() >= NumConstant.ONE){
if(statistical.size() != NumConstant.ONE){
return new Result().error(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
}else{
ResiGroupStatisticalEntity statistical2Update = new ResiGroupStatisticalEntity();
statistical2Update.setId(statistical.get(NumConstant.ZERO).getId());
statistical2Update.setTotalTopics(null == statistical.get(NumConstant.ZERO).getTotalTopics() ? NumConstant.ONE : statistical.get(NumConstant.ZERO).getTotalTopics() + NumConstant.ONE);
statistical2Update.setUpdatedBy(tokenDto.getUserId());
statistical2Update.setUpdatedTime(currentTime);
resiGroupStatisticalDao.updateById(statistical2Update);
}
}else{
return new Result().error(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
}
//5.群组信息,更新latestTopicPublishDate字段
ResiGroupEntity group2Update = new ResiGroupEntity();
group2Update.setId(resiTopicPublishFormDTO.getGroupId());
group2Update.setLatestTopicPublishDate(currentTime);
resiGroupDao.updateById(group2Update);
return new Result();
}
@ -212,6 +255,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
**/
@Override
public Result<List<ResiTopicInfoResultDTO>> getLatestTopics(TokenDto tokenDto, String groupId) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
}
@ -409,7 +453,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
QueryWrapper<ResiTopicAttachmentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(TopicConstant.TOPIC_ID,topicId);
//wrapper.eq(TopicConstant.DEL_FLAG,NumConstant.ZERO_STR);
wrapper.orderByDesc(TopicConstant.CREATED_DATE);
wrapper.orderByAsc(TopicConstant.SORT);
List<ResiTopicAttachmentEntity> attachments = resiTopicAttachmentDao.selectList(wrapper);
List<String> attachmentUrls = new ArrayList<>();
for(ResiTopicAttachmentEntity attachment : attachments){

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -137,4 +137,14 @@ public interface ModuleConstant extends Constant {
* 话题Id集合不能为空
* */
String TOPIC_ID_LIST_NOT_NULL = "话题Id集合不能为空";
/**
* 一个组找到多个统计信息
* */
String GROUP_STASTICAL_NOT_SINGLE = "一个组找到多个统计信息";
/**
* 未找到对应的小组统计信息
* */
String NO_SUCH_GROUP_STASTICAL_INFO = "未找到对应的小组统计信息";
}

12
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml

@ -27,6 +27,9 @@
<if test ='null != attachmentUrl'>
attachment_url,
</if>
<if test='null != sort'>
sort,
</if>
<if test ='null != createdBy'>
created_by,
</if>
@ -53,6 +56,9 @@
<if test ='null != attachmentUrl'>
#{attachmentUrl},
</if>
<if test='null != sort'>
#{sort},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
@ -67,7 +73,7 @@
<!-- 批量插入 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into user
insert into resi_topic_attachment
(
id,
topic_id,
@ -77,6 +83,7 @@
attachment_url,
del_flag,
revision,
sort,
created_by,
created_time,
updated_by,
@ -92,8 +99,9 @@
#{item.attachmentUrl},
#{item.delFlag},
#{item.revision},
#{item.sort},
#{item.createdBy},
#{item.createdTime},
now(),
#{item.updatedBy},
#{item.updatedTime}
)

4
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml

@ -112,7 +112,7 @@
SELECT
attachment.TOPIC_ID AS attachmentTopicId,
attachment.ATTACHMENT_URL as firstPhoto,
MIN(attachment.CREATED_TIME) AS ATTACHMENT_CREATED_TIME
MIN(attachment.SORD)
FROM
RESI_TOPIC_ATTACHMENT attachment
WHERE
@ -151,7 +151,7 @@
SELECT
attachment.TOPIC_ID AS attachmentTopicId,
attachment.ATTACHMENT_URL as firstPhoto,
MIN(attachment.CREATED_TIME) AS ATTACHMENT_CREATED_TIME
MIN(attachment.SORT)
FROM
RESI_TOPIC_ATTACHMENT attachment
WHERE

10
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java

@ -1,17 +1,15 @@
package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserMessageDTO;
import com.epmet.dto.form.MymessageFormDTO;
import com.epmet.modules.feign.fallback.EpmetMessageFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
import java.util.List;
/**
* @author zhaoqifeng
@ -27,8 +25,8 @@ public interface EpmetMessageFeignClient {
* @param params 参数
* @return Result<PageData<UserMessageDTO>>
*/
@GetMapping("/message/usermessage/page")
Result<PageData<UserMessageDTO>> page(@RequestParam Map<String, Object> params);
@PostMapping("/message/usermessage/mymsg")
Result<List<UserMessageDTO>> getMyMessageList(@RequestBody MymessageFormDTO params);
/**
* 单条消息已读

8
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallBack.java

@ -1,14 +1,14 @@
package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserMessageDTO;
import com.epmet.dto.form.MymessageFormDTO;
import com.epmet.modules.feign.EpmetMessageFeignClient;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.List;
/**
* @author zhaoqifeng
@ -18,8 +18,8 @@ import java.util.Map;
@Component
public class EpmetMessageFeignClientFallBack implements EpmetMessageFeignClient {
@Override
public Result<PageData<UserMessageDTO>> page(Map<String, Object> params) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "page", params);
public Result<List<UserMessageDTO>> getMyMessageList(MymessageFormDTO params) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "getMyMessageList", params);
}
@Override

7
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java

@ -1,7 +1,6 @@
package com.epmet.modules.message.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -11,6 +10,8 @@ import com.epmet.modules.message.service.UserMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Description 我的消息
* @Author yinzuomei
@ -30,8 +31,8 @@ public class UserMessageController {
* @Date 2020/3/29 20:53
**/
@PostMapping("getmymessage")
public Result<PageData<UserMessageDTO>> getMyMessage(@LoginUser TokenDto tokenDto,
@RequestBody MymessageFormDTO mymessageFormDTO) {
public Result<List<UserMessageDTO>> getMyMessage(@LoginUser TokenDto tokenDto,
@RequestBody MymessageFormDTO mymessageFormDTO) {
mymessageFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(mymessageFormDTO);
//逻辑待实现

5
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/service/UserMessageService.java

@ -1,11 +1,12 @@
package com.epmet.modules.message.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserMessageDTO;
import com.epmet.dto.form.MymessageFormDTO;
import java.util.List;
/**
* @Description 我的消息
* @Author yinzuomei
@ -20,7 +21,7 @@ public interface UserMessageService {
* @param messageFromDTO 参数
* @return Result<PageData < MymessageResultDTO>>
*/
Result<PageData<UserMessageDTO>> getMessageList(TokenDto tokenDto, MymessageFormDTO messageFromDTO);
Result<List<UserMessageDTO>> getMessageList(TokenDto tokenDto, MymessageFormDTO messageFromDTO);
/**
* 单条消息标记为已读

15
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/service/impl/UserMessageServiceImpl.java

@ -1,6 +1,5 @@
package com.epmet.modules.message.service.impl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserMessageDTO;
@ -10,8 +9,7 @@ import com.epmet.modules.message.service.UserMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
/**
* @Description 我的消息
@ -24,14 +22,9 @@ public class UserMessageServiceImpl implements UserMessageService {
private EpmetMessageFeignClient messageFeignClient;
@Override
public Result<PageData<UserMessageDTO>> getMessageList(TokenDto tokenDto, MymessageFormDTO messageFromDTO) {
Map<String, Object> param = new HashMap<String, Object>();
param.put("customerId", messageFromDTO.getCustomerId());
param.put("gridId", messageFromDTO.getGridId());
param.put("userId", tokenDto.getUserId());
param.put("pageNo", messageFromDTO.getPageNo());
param.put("pageSize", messageFromDTO.getPageSize());
Result<PageData<UserMessageDTO>> result = messageFeignClient.page(param);
public Result<List<UserMessageDTO>> getMessageList(TokenDto tokenDto, MymessageFormDTO messageFromDTO) {
messageFromDTO.setUserId(tokenDto.getUserId());
Result<List<UserMessageDTO>> result = messageFeignClient.getMyMessageList(messageFromDTO);
return result;
}

Loading…
Cancel
Save