新增会员站内信消息
This commit is contained in:
		
							parent
							
								
									6205693df6
								
							
						
					
					
						commit
						975550374a
					
				| @ -4,9 +4,9 @@ import cn.lili.common.enums.ResultUtil; | |||||||
| import cn.lili.common.vo.PageVO; | import cn.lili.common.vo.PageVO; | ||||||
| import cn.lili.common.vo.ResultMessage; | import cn.lili.common.vo.ResultMessage; | ||||||
| import cn.lili.modules.message.entity.enums.MessageStatusEnum; | import cn.lili.modules.message.entity.enums.MessageStatusEnum; | ||||||
| import cn.lili.modules.member.entity.dos.MemberMessage; | import cn.lili.modules.message.entity.dos.MemberMessage; | ||||||
| import cn.lili.modules.member.entity.vo.MemberMessageQueryVO; | import cn.lili.modules.message.entity.vos.MemberMessageQueryVO; | ||||||
| import cn.lili.modules.member.service.MemberMessageService; | import cn.lili.modules.message.service.MemberMessageService; | ||||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||||
|  | |||||||
| @ -1,18 +1,27 @@ | |||||||
| package cn.lili.listener; | package cn.lili.listener; | ||||||
| 
 | 
 | ||||||
| import cn.hutool.json.JSONUtil; | import cn.hutool.json.JSONUtil; | ||||||
|  | import cn.lili.common.enums.SwitchEnum; | ||||||
| import cn.lili.common.rocketmq.tags.OtherTagsEnum; | import cn.lili.common.rocketmq.tags.OtherTagsEnum; | ||||||
| import cn.lili.common.sms.SmsUtil; | import cn.lili.common.sms.SmsUtil; | ||||||
|  | import cn.lili.common.vo.PageVO; | ||||||
|  | import cn.lili.modules.member.entity.dos.Member; | ||||||
|  | import cn.lili.modules.member.entity.vo.MemberSearchVO; | ||||||
| import cn.lili.modules.member.mapper.MemberMapper; | import cn.lili.modules.member.mapper.MemberMapper; | ||||||
|  | import cn.lili.modules.member.service.MemberService; | ||||||
|  | import cn.lili.modules.message.entity.dos.MemberMessage; | ||||||
| import cn.lili.modules.message.entity.dos.Message; | import cn.lili.modules.message.entity.dos.Message; | ||||||
| import cn.lili.modules.message.entity.dos.StoreMessage; | import cn.lili.modules.message.entity.dos.StoreMessage; | ||||||
| import cn.lili.modules.message.entity.dto.SmsReachDTO; | import cn.lili.modules.message.entity.dto.SmsReachDTO; | ||||||
|  | import cn.lili.modules.message.entity.enums.MessageSendClient; | ||||||
| import cn.lili.modules.message.entity.enums.MessageStatusEnum; | import cn.lili.modules.message.entity.enums.MessageStatusEnum; | ||||||
| import cn.lili.modules.message.entity.enums.RangeEnum; | import cn.lili.modules.message.entity.enums.RangeEnum; | ||||||
|  | import cn.lili.modules.message.service.MemberMessageService; | ||||||
| import cn.lili.modules.message.service.StoreMessageService; | import cn.lili.modules.message.service.StoreMessageService; | ||||||
| import cn.lili.modules.store.entity.dos.Store; | import cn.lili.modules.store.entity.dos.Store; | ||||||
| import cn.lili.modules.store.service.StoreService; | import cn.lili.modules.store.service.StoreService; | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||||
|  | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import org.apache.rocketmq.common.message.MessageExt; | import org.apache.rocketmq.common.message.MessageExt; | ||||||
| import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | ||||||
| import org.apache.rocketmq.spring.core.RocketMQListener; | import org.apache.rocketmq.spring.core.RocketMQListener; | ||||||
| @ -41,9 +50,15 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> { | |||||||
|     //店铺消息 |     //店铺消息 | ||||||
|     @Autowired |     @Autowired | ||||||
|     private StoreMessageService storeMessageService; |     private StoreMessageService storeMessageService; | ||||||
|  |     //会员消息 | ||||||
|  |     @Autowired | ||||||
|  |     private MemberMessageService memberMessageService; | ||||||
|     //店铺 |     //店铺 | ||||||
|     @Autowired |     @Autowired | ||||||
|     private StoreService storeService; |     private StoreService storeService; | ||||||
|  |     //会员 | ||||||
|  |     @Autowired | ||||||
|  |     private MemberService memberService; | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void onMessage(MessageExt messageExt) { |     public void onMessage(MessageExt messageExt) { | ||||||
| @ -51,7 +66,6 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> { | |||||||
|             case SMS: |             case SMS: | ||||||
|                 String smsJsonStr = new String(messageExt.getBody()); |                 String smsJsonStr = new String(messageExt.getBody()); | ||||||
|                 SmsReachDTO smsReachDTO = JSONUtil.toBean(smsJsonStr, SmsReachDTO.class); |                 SmsReachDTO smsReachDTO = JSONUtil.toBean(smsJsonStr, SmsReachDTO.class); | ||||||
| 
 |  | ||||||
|                 //发送全部会员 |                 //发送全部会员 | ||||||
|                 if (smsReachDTO.getSmsRange().equals(RangeEnum.ALL.name())) { |                 if (smsReachDTO.getSmsRange().equals(RangeEnum.ALL.name())) { | ||||||
|                     //获取所有会员的手机号 |                     //获取所有会员的手机号 | ||||||
| @ -65,38 +79,118 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> { | |||||||
|             //管理员发送站内信 |             //管理员发送站内信 | ||||||
|             case MESSAGE: |             case MESSAGE: | ||||||
|                 Message message = JSONUtil.toBean(new String(messageExt.getBody()), Message.class); |                 Message message = JSONUtil.toBean(new String(messageExt.getBody()), Message.class); | ||||||
|                 List<StoreMessage> list = new ArrayList<>(); |                 // 管理端发送给商家的站内信 | ||||||
|                 //保存商家记录 |                 if (message.getMessageClient().equals(MessageSendClient.STORE.name().toLowerCase())) { | ||||||
|                 if (message.getMessageRange().equals("ALL")) { |                     saveStoreMessage(message); | ||||||
|                     List<Store> storeList = storeService.list(new QueryWrapper<Store>().eq("store_disable", "OPEN")); |  | ||||||
|                     storeList.forEach(item -> { |  | ||||||
|                         StoreMessage storeMessage = new StoreMessage(); |  | ||||||
|                         storeMessage.setMessageId(message.getId()); |  | ||||||
|                         storeMessage.setStoreName(item.getStoreName()); |  | ||||||
|                         storeMessage.setStoreId(item.getId()); |  | ||||||
|                         storeMessage.setStatus(MessageStatusEnum.UN_READY.name()); |  | ||||||
|                         storeMessage.setTitle(message.getTitle()); |  | ||||||
|                         storeMessage.setContent(message.getContent()); |  | ||||||
|                         list.add(storeMessage); |  | ||||||
|                     }); |  | ||||||
|                 } else { |                 } else { | ||||||
|                     int i = 0; |                     //管理员发送给会员的站内信 | ||||||
|                     for (String str : message.getUserIds()) { |                     saveMemberMessage(message); | ||||||
|                         StoreMessage storeMessage = new StoreMessage(); |  | ||||||
|                         storeMessage.setMessageId(message.getId()); |  | ||||||
|                         storeMessage.setStoreId(str); |  | ||||||
|                         storeMessage.setStoreName(message.getUserNames()[i]); |  | ||||||
|                         storeMessage.setStatus(MessageStatusEnum.UN_READY.name()); |  | ||||||
|                         storeMessage.setTitle(message.getTitle()); |  | ||||||
|                         storeMessage.setContent(message.getContent()); |  | ||||||
|                         list.add(storeMessage); |  | ||||||
|                         i++; |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
|                 storeMessageService.save(list); |  | ||||||
|                 break; |                 break; | ||||||
|             default: |             default: | ||||||
|                 break; |                 break; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 保存店铺消息 | ||||||
|  |      * | ||||||
|  |      * @param message 消息 | ||||||
|  |      */ | ||||||
|  |     private void saveStoreMessage(Message message) { | ||||||
|  |         List<StoreMessage> list = new ArrayList<>(); | ||||||
|  |         //发送全部商家情况 | ||||||
|  |         if (message.getMessageRange().equals("ALL")) { | ||||||
|  |             List<Store> storeList = storeService.list(new QueryWrapper<Store>().eq("store_disable", "OPEN")); | ||||||
|  |             storeList.forEach(item -> { | ||||||
|  |                 StoreMessage storeMessage = new StoreMessage(); | ||||||
|  |                 storeMessage.setMessageId(message.getId()); | ||||||
|  |                 storeMessage.setStoreName(item.getStoreName()); | ||||||
|  |                 storeMessage.setStoreId(item.getId()); | ||||||
|  |                 storeMessage.setStatus(MessageStatusEnum.UN_READY.name()); | ||||||
|  |                 storeMessage.setTitle(message.getTitle()); | ||||||
|  |                 storeMessage.setContent(message.getContent()); | ||||||
|  |                 list.add(storeMessage); | ||||||
|  |             }); | ||||||
|  |         } else { | ||||||
|  |             //发送给指定商家情况 | ||||||
|  |             int i = 0; | ||||||
|  |             for (String str : message.getUserIds()) { | ||||||
|  |                 StoreMessage storeMessage = new StoreMessage(); | ||||||
|  |                 storeMessage.setMessageId(message.getId()); | ||||||
|  |                 storeMessage.setStoreId(str); | ||||||
|  |                 storeMessage.setStoreName(message.getUserNames()[i]); | ||||||
|  |                 storeMessage.setStatus(MessageStatusEnum.UN_READY.name()); | ||||||
|  |                 storeMessage.setTitle(message.getTitle()); | ||||||
|  |                 storeMessage.setContent(message.getContent()); | ||||||
|  |                 list.add(storeMessage); | ||||||
|  |                 i++; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         if (list.size() > 0) { | ||||||
|  |             //执行保存 | ||||||
|  |             storeMessageService.save(list); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 保存会员消息 | ||||||
|  |      * | ||||||
|  |      * @param message 消息 | ||||||
|  |      */ | ||||||
|  |     private void saveMemberMessage(Message message) { | ||||||
|  |         List<MemberMessage> list = new ArrayList<>(); | ||||||
|  |         //如果是给所有会员发送消息 | ||||||
|  |         if (message.getMessageRange().equals("ALL")) { | ||||||
|  |             //查询所有会员总数,因为会员总数比较大 如果一次性查出来会占用数据库资源,所以要分页查询 | ||||||
|  |             MemberSearchVO memberSearchVO = new MemberSearchVO(); | ||||||
|  |             memberSearchVO.setDisabled(SwitchEnum.OPEN.name()); | ||||||
|  |             Integer memberNum = memberService.getMemberNum(memberSearchVO); | ||||||
|  |             //构建分页查询参数 | ||||||
|  |             //100条查一次 | ||||||
|  |             Integer pageSize = 200; | ||||||
|  |             Integer pageCount = 0; | ||||||
|  |             pageCount = memberNum / pageSize; | ||||||
|  |             pageCount = memberNum % pageSize > 0 ? pageCount + 1 : pageCount; | ||||||
|  |             for (int i = 1; i <= pageCount; i++) { | ||||||
|  |                 PageVO pageVO = new PageVO(); | ||||||
|  |                 pageVO.setPageSize(pageSize); | ||||||
|  |                 pageVO.setPageNumber(i); | ||||||
|  |                 IPage<Member> page = memberService.getMemberPage(memberSearchVO, pageVO); | ||||||
|  |                 //循环要保存的信息 | ||||||
|  |                 page.getRecords().forEach(item -> { | ||||||
|  |                     MemberMessage memberMessage = new MemberMessage(); | ||||||
|  |                     memberMessage.setContent(message.getContent()); | ||||||
|  |                     memberMessage.setTitle(message.getTitle()); | ||||||
|  |                     memberMessage.setMessageId(message.getId()); | ||||||
|  |                     memberMessage.setMemberId(item.getId()); | ||||||
|  |                     memberMessage.setMemberName(item.getUsername()); | ||||||
|  |                     memberMessage.setStatus(MessageStatusEnum.UN_READY.name()); | ||||||
|  |                     list.add(memberMessage); | ||||||
|  |                 }); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } else { | ||||||
|  |             //如果是给指定会员发送消息 | ||||||
|  |             int i = 0; | ||||||
|  |             for (String str : message.getUserIds()) { | ||||||
|  |                 MemberMessage memberMessage = new MemberMessage(); | ||||||
|  |                 memberMessage.setMessageId(message.getId()); | ||||||
|  |                 memberMessage.setMemberId(str); | ||||||
|  |                 memberMessage.setMemberName(message.getUserNames()[i]); | ||||||
|  |                 memberMessage.setStatus(MessageStatusEnum.UN_READY.name()); | ||||||
|  |                 memberMessage.setTitle(message.getTitle()); | ||||||
|  |                 memberMessage.setContent(message.getContent()); | ||||||
|  |                 list.add(memberMessage); | ||||||
|  |                 i++; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         if (list.size() > 0) { | ||||||
|  |             //执行保存 | ||||||
|  |             memberMessageService.save(list); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -541,9 +541,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme | |||||||
|         queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getUsername()), "username", memberSearchVO.getUsername()); |         queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getUsername()), "username", memberSearchVO.getUsername()); | ||||||
|         //按照电话号码查询 |         //按照电话号码查询 | ||||||
|         queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getMobile()), "mobile", memberSearchVO.getMobile()); |         queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getMobile()), "mobile", memberSearchVO.getMobile()); | ||||||
|         //按照电话号码查询 |         //按照状态查询 | ||||||
|         queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getDisabled()), "disabled", memberSearchVO.getDisabled()); |         queryWrapper.eq(StringUtils.isNotBlank(memberSearchVO.getDisabled()), "disabled", | ||||||
|         queryWrapper.orderByDesc("create_time"); |                 memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name()) ? 1 : 0);        queryWrapper.orderByDesc("create_time"); | ||||||
|         return this.count(queryWrapper); |         return this.count(queryWrapper); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| package cn.lili.modules.member.entity.dos; | package cn.lili.modules.message.entity.dos; | ||||||
| 
 | 
 | ||||||
| import cn.lili.base.BaseEntity; | import cn.lili.base.BaseEntity; | ||||||
| import cn.lili.modules.message.entity.enums.MessageStatusEnum; | import cn.lili.modules.message.entity.enums.MessageStatusEnum; | ||||||
| @ -37,6 +37,9 @@ public class MemberMessage extends BaseEntity { | |||||||
|     @ApiModelProperty(value = "消息内容") |     @ApiModelProperty(value = "消息内容") | ||||||
|     private String content; |     private String content; | ||||||
| 
 | 
 | ||||||
|  |     @ApiModelProperty(value = "关联消息id") | ||||||
|  |     private String messageId; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * @see MessageStatusEnum |      * @see MessageStatusEnum | ||||||
|      */ |      */ | ||||||
| @ -2,6 +2,7 @@ package cn.lili.modules.message.entity.dos; | |||||||
| 
 | 
 | ||||||
| import cn.lili.base.BaseEntity; | import cn.lili.base.BaseEntity; | ||||||
| import cn.lili.modules.message.entity.enums.RangeEnum; | import cn.lili.modules.message.entity.enums.RangeEnum; | ||||||
|  | import cn.lili.modules.message.entity.enums.MessageSendClient; | ||||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
| import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||||
| @ -37,7 +38,10 @@ public class Message extends BaseEntity { | |||||||
|     @ApiModelProperty(value = "发送范围") |     @ApiModelProperty(value = "发送范围") | ||||||
|     private String messageRange; |     private String messageRange; | ||||||
| 
 | 
 | ||||||
|     @ApiModelProperty(value = "发送客户端 商家和会员") |     /** | ||||||
|  |      * @see MessageSendClient | ||||||
|  |      */ | ||||||
|  |     @ApiModelProperty(value = "发送客户端 商家或者会员") | ||||||
|     private String messageClient; |     private String messageClient; | ||||||
| 
 | 
 | ||||||
|     @Transient |     @Transient | ||||||
|  | |||||||
| @ -0,0 +1,27 @@ | |||||||
|  | package cn.lili.modules.message.entity.enums; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 消息发送客户端 | ||||||
|  |  * | ||||||
|  |  * @author pikachu | ||||||
|  |  * @date 2020/12/8 9:46 | ||||||
|  |  */ | ||||||
|  | public enum MessageSendClient { | ||||||
|  | 
 | ||||||
|  |     //全部用户 | ||||||
|  |     MEMBER("会员"), | ||||||
|  |     //指定用户 | ||||||
|  |     STORE("店铺"); | ||||||
|  | 
 | ||||||
|  |     private final String description; | ||||||
|  | 
 | ||||||
|  |     MessageSendClient(String description) { | ||||||
|  |         this.description = description; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getDescription() { | ||||||
|  |         return description; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -1,17 +1,19 @@ | |||||||
| package cn.lili.modules.member.entity.vo; | package cn.lili.modules.message.entity.vos; | ||||||
| 
 | 
 | ||||||
| import cn.lili.modules.message.entity.enums.MessageStatusEnum; | import cn.lili.modules.message.entity.enums.MessageStatusEnum; | ||||||
|  | import io.swagger.annotations.ApiModel; | ||||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 会员消息查询 |  * 会员接收消息查询vo | ||||||
|  * |  * | ||||||
|  * @author Chopper |  * @author Chopper | ||||||
|  * @date 2020-02-25 14:10:16 |  * @date 2020/12/2 17:50 | ||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
|  | @ApiModel(value = "会员接收消息查询vo") | ||||||
| public class MemberMessageQueryVO { | public class MemberMessageQueryVO { | ||||||
| 
 | 
 | ||||||
|     private static final long serialVersionUID = 1L; |     private static final long serialVersionUID = 1L; | ||||||
| @ -22,6 +24,9 @@ public class MemberMessageQueryVO { | |||||||
|     @ApiModelProperty(value = "状态") |     @ApiModelProperty(value = "状态") | ||||||
|     private String status; |     private String status; | ||||||
| 
 | 
 | ||||||
|  |     @ApiModelProperty(value = "消息id") | ||||||
|  |     private String messageId; | ||||||
|  | 
 | ||||||
|     @ApiModelProperty(value = "消息标题") |     @ApiModelProperty(value = "消息标题") | ||||||
|     private String title; |     private String title; | ||||||
| 
 | 
 | ||||||
| @ -1,7 +1,7 @@ | |||||||
| package cn.lili.modules.member.mapper; | package cn.lili.modules.message.mapper; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| import cn.lili.modules.member.entity.dos.MemberMessage; | import cn.lili.modules.message.entity.dos.MemberMessage; | ||||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -1,11 +1,13 @@ | |||||||
| package cn.lili.modules.member.service; | package cn.lili.modules.message.service; | ||||||
| 
 | 
 | ||||||
| import cn.lili.common.vo.PageVO; | import cn.lili.common.vo.PageVO; | ||||||
| import cn.lili.modules.member.entity.dos.MemberMessage; | import cn.lili.modules.message.entity.dos.MemberMessage; | ||||||
| import cn.lili.modules.member.entity.vo.MemberMessageQueryVO; | import cn.lili.modules.message.entity.vos.MemberMessageQueryVO; | ||||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||||
| 
 | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * 消息发送业务层 |  * 消息发送业务层 | ||||||
|  * |  * | ||||||
| @ -41,4 +43,13 @@ public interface MemberMessageService extends IService<MemberMessage> { | |||||||
|     Boolean deleteMessage(String messageId); |     Boolean deleteMessage(String messageId); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 保存消息信息 | ||||||
|  |      * | ||||||
|  |      * @param messages 消息 | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     boolean save(List<MemberMessage> messages); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| } | } | ||||||
| @ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 消息发送业务层 |  * 店铺接收消息业务层 | ||||||
|  * |  * | ||||||
|  * @author Chopper |  * @author Chopper | ||||||
|  * @date 2020/11/17 3:44 下午 |  * @date 2020/11/17 3:44 下午 | ||||||
| @ -34,7 +34,7 @@ public interface StoreMessageService extends IService<StoreMessage> { | |||||||
|     IPage<StoreMessage> getPage(StoreMessageQueryVO storeMessageQueryVO, PageVO pageVO); |     IPage<StoreMessage> getPage(StoreMessageQueryVO storeMessageQueryVO, PageVO pageVO); | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 保存消息信息 |      * 保存店铺消息信息 | ||||||
|      * |      * | ||||||
|      * @param messages 消息 |      * @param messages 消息 | ||||||
|      * @return |      * @return | ||||||
|  | |||||||
| @ -1,19 +1,21 @@ | |||||||
| package cn.lili.modules.member.serviceimpl; | package cn.lili.modules.message.serviceimpl; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| import cn.lili.common.utils.PageUtil; | import cn.lili.common.utils.PageUtil; | ||||||
| import cn.lili.common.utils.StringUtils; | import cn.lili.common.utils.StringUtils; | ||||||
| import cn.lili.common.vo.PageVO; | import cn.lili.common.vo.PageVO; | ||||||
| import cn.lili.modules.member.entity.dos.MemberMessage; | import cn.lili.modules.message.entity.dos.MemberMessage; | ||||||
| import cn.lili.modules.member.entity.vo.MemberMessageQueryVO; | import cn.lili.modules.message.mapper.MemberMessageMapper; | ||||||
| import cn.lili.modules.member.mapper.MemberMessageMapper; | import cn.lili.modules.message.service.MemberMessageService; | ||||||
| import cn.lili.modules.member.service.MemberMessageService; | import cn.lili.modules.message.entity.vos.MemberMessageQueryVO; | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
| 
 | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * 会员消息业务层实现 |  * 会员消息业务层实现 | ||||||
|  * |  * | ||||||
| @ -28,6 +30,8 @@ public class MemberMessageServiceImpl extends ServiceImpl<MemberMessageMapper, M | |||||||
|     @Override |     @Override | ||||||
|     public IPage<MemberMessage> getPage(MemberMessageQueryVO memberMessageQueryVO, PageVO pageVO) { |     public IPage<MemberMessage> getPage(MemberMessageQueryVO memberMessageQueryVO, PageVO pageVO) { | ||||||
|         QueryWrapper<MemberMessage> queryWrapper = new QueryWrapper<>(); |         QueryWrapper<MemberMessage> queryWrapper = new QueryWrapper<>(); | ||||||
|  |         //消息id | ||||||
|  |         queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId()); | ||||||
|         //消息标题 |         //消息标题 | ||||||
|         queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getTitle()), "title", memberMessageQueryVO.getTitle()); |         queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getTitle()), "title", memberMessageQueryVO.getTitle()); | ||||||
|         //会员id |         //会员id | ||||||
| @ -61,4 +65,9 @@ public class MemberMessageServiceImpl extends ServiceImpl<MemberMessageMapper, M | |||||||
|         } |         } | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean save(List<MemberMessage> messages) { | ||||||
|  |         return saveBatch(messages); | ||||||
|  |     } | ||||||
| } | } | ||||||
| @ -0,0 +1,45 @@ | |||||||
|  | package cn.lili.controller.member; | ||||||
|  | 
 | ||||||
|  | import cn.lili.common.enums.ResultUtil; | ||||||
|  | import cn.lili.common.vo.PageVO; | ||||||
|  | import cn.lili.common.vo.ResultMessage; | ||||||
|  | import cn.lili.modules.message.entity.dos.MemberMessage; | ||||||
|  | import cn.lili.modules.message.entity.dos.StoreMessage; | ||||||
|  | import cn.lili.modules.message.entity.vos.MemberMessageQueryVO; | ||||||
|  | import cn.lili.modules.message.entity.vos.StoreMessageQueryVO; | ||||||
|  | import cn.lili.modules.message.service.MemberMessageService; | ||||||
|  | import cn.lili.modules.message.service.StoreMessageService; | ||||||
|  | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
|  | import io.swagger.annotations.Api; | ||||||
|  | import io.swagger.annotations.ApiOperation; | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.transaction.annotation.Transactional; | ||||||
|  | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 管理端,会员消息消息管理接口 | ||||||
|  |  * | ||||||
|  |  * @author pikachu | ||||||
|  |  * @date: 2020/12/6 16:09 | ||||||
|  |  */ | ||||||
|  | @Transactional | ||||||
|  | @RestController | ||||||
|  | @Api(tags = "管理端,会员消息消息管理接口") | ||||||
|  | @RequestMapping("/manager/message/member") | ||||||
|  | public class MemberMessageManagerController { | ||||||
|  |     @Autowired | ||||||
|  |     private MemberMessageService memberMessageService; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     @GetMapping | ||||||
|  |     @ApiOperation(value = "多条件分页获取") | ||||||
|  |     public ResultMessage<IPage<MemberMessage>> getByCondition(MemberMessageQueryVO memberMessageQueryVO, | ||||||
|  |                                                               PageVO pageVo) { | ||||||
|  |         IPage<MemberMessage> page = memberMessageService.getPage(memberMessageQueryVO, pageVo); | ||||||
|  |         return ResultUtil.data(page); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 pikachu
						pikachu