去掉无用代码以及对站内信模版等进行了优化
This commit is contained in:
parent
f35ae5b1ee
commit
9f3a4dbf68
@ -1,6 +1,7 @@
|
||||
package cn.lili.event.impl;
|
||||
|
||||
import cn.lili.event.*;
|
||||
import cn.lili.modules.distribution.entity.enums.DistributionCashStatusEnum;
|
||||
import cn.lili.modules.member.entity.dto.MemberPointMessage;
|
||||
import cn.lili.modules.member.entity.dto.MemberWithdrawalMessage;
|
||||
import cn.lili.modules.member.entity.enums.MemberWithdrawalDestinationEnum;
|
||||
@ -171,27 +172,58 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
||||
|
||||
@Override
|
||||
public void memberWithdrawal(MemberWithdrawalMessage memberWithdrawalMessage) {
|
||||
|
||||
//如果提现到余额
|
||||
if (memberWithdrawalMessage.getDestination().equals(MemberWithdrawalDestinationEnum.WALLET.name())) {
|
||||
|
||||
//组织参数
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_SUCCESS);
|
||||
//发送提现申请成功消息
|
||||
noticeMessageService.noticeMessage(noticeMessageDTO);
|
||||
|
||||
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
||||
params.put("expenditure", "0");
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_CHANGE);
|
||||
noticeMessageDTO.setParameter(params);
|
||||
//发送余额变动消息
|
||||
noticeMessageService.noticeMessage(noticeMessageDTO);
|
||||
//如果提现状态为申请则发送申请提现站内消息
|
||||
if(memberWithdrawalMessage.getStatus().equals(DistributionCashStatusEnum.APPLY.name())){
|
||||
//如果提现到余额
|
||||
if (memberWithdrawalMessage.getDestination().equals(MemberWithdrawalDestinationEnum.WALLET.name())) {
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_CREATE);
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("price", memberWithdrawalMessage.getPrice().toString());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
//发送提现申请成功消息
|
||||
noticeMessageService.noticeMessage(noticeMessageDTO);
|
||||
}
|
||||
}
|
||||
//如果提现状态为通过则发送审核通过站内消息
|
||||
if(memberWithdrawalMessage.getStatus().equals(DistributionCashStatusEnum.PASS.name())){
|
||||
//如果提现到余额
|
||||
if (memberWithdrawalMessage.getDestination().equals(MemberWithdrawalDestinationEnum.WALLET.name())) {
|
||||
//组织参数
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_SUCCESS);
|
||||
//发送提现成功消息
|
||||
noticeMessageService.noticeMessage(noticeMessageDTO);
|
||||
|
||||
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
||||
params.put("expenditure", "0");
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_CHANGE);
|
||||
noticeMessageDTO.setParameter(params);
|
||||
//发送余额变动消息
|
||||
noticeMessageService.noticeMessage(noticeMessageDTO);
|
||||
}
|
||||
}
|
||||
//如果提现状态为拒绝则发送审核拒绝站内消息
|
||||
if(memberWithdrawalMessage.getStatus().equals(DistributionCashStatusEnum.REFUSE.name())){
|
||||
//如果提现到余额
|
||||
if (memberWithdrawalMessage.getDestination().equals(MemberWithdrawalDestinationEnum.WALLET.name())) {
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_ERROR);
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("price", memberWithdrawalMessage.getPrice().toString());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
//发送提现申请成功消息
|
||||
noticeMessageService.noticeMessage(noticeMessageDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
memberWithdrawalMessage.setMemberId(distribution.getMemberId());
|
||||
memberWithdrawalMessage.setPrice(applyMoney);
|
||||
memberWithdrawalMessage.setDestination(MemberWithdrawalDestinationEnum.WALLET.name());
|
||||
memberWithdrawalMessage.setStatus(DistributionCashStatusEnum.APPLY.name());
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_WITHDRAWAL.name();
|
||||
rocketMQTemplate.asyncSend(destination, memberWithdrawalMessage, RocketmqSendCallbackBuilder.commonCallback());
|
||||
return true;
|
||||
@ -122,8 +123,10 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
//获取分销员
|
||||
Distribution distribution = distributionService.getById(distributorCash.getDistributionId());
|
||||
if (distribution != null && distributorCash != null && distribution.getDistributionStatus().equals(DistributionStatusEnum.PASS.name())) {
|
||||
MemberWithdrawalMessage memberWithdrawalMessage = new MemberWithdrawalMessage();
|
||||
//审核通过
|
||||
if (result.equals(DistributionCashStatusEnum.PASS.name())) {
|
||||
memberWithdrawalMessage.setStatus(DistributionCashStatusEnum.PASS.name());
|
||||
//审核通过需要校验冻结金额不足情况
|
||||
if (distribution.getCommissionFrozen() < distributorCash.getPrice()) {
|
||||
throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT);
|
||||
@ -136,6 +139,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
//提现到余额
|
||||
memberWalletService.increase(distributorCash.getPrice(), distribution.getMemberId(), "分销佣金提现到余额", DepositServiceTypeEnum.WALLET_COMMISSION.name());
|
||||
} else {
|
||||
memberWithdrawalMessage.setStatus(DistributionCashStatusEnum.REFUSE.name());
|
||||
//分销员佣金解冻
|
||||
distribution.setCommissionFrozen(CurrencyUtil.sub(distribution.getCommissionFrozen(), distributorCash.getPrice()));
|
||||
//分销员可提现金额退回
|
||||
@ -145,7 +149,15 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
//分销员金额相关处理
|
||||
distributionService.updateById(distribution);
|
||||
//修改分销提现申请
|
||||
this.updateById(distributorCash);
|
||||
boolean bool = this.updateById(distributorCash);
|
||||
if (bool) {
|
||||
//组织会员提现审核消息
|
||||
memberWithdrawalMessage.setMemberId(distribution.getMemberId());
|
||||
memberWithdrawalMessage.setPrice(distributorCash.getPrice());
|
||||
memberWithdrawalMessage.setDestination(MemberWithdrawalDestinationEnum.WALLET.name());
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_WITHDRAWAL.name();
|
||||
rocketMQTemplate.asyncSend(destination, memberWithdrawalMessage, RocketmqSendCallbackBuilder.commonCallback());
|
||||
}
|
||||
return distributorCash;
|
||||
}
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_NOT_EXIST);
|
||||
|
@ -1,43 +0,0 @@
|
||||
package cn.lili.modules.member.entity.dos;
|
||||
|
||||
import cn.lili.base.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 会员站内信
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "li_member_notice")
|
||||
@TableName("li_member_notice")
|
||||
@ApiModel(value = "会员站内信")
|
||||
public class MemberNotice extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "会员id")
|
||||
private String memberId;
|
||||
|
||||
@ApiModelProperty(value = "是否已读")
|
||||
private Boolean isRead;
|
||||
|
||||
@ApiModelProperty(value = "阅读时间")
|
||||
private Long receiveTime;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "站内信内容")
|
||||
private String content;
|
||||
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package cn.lili.modules.member.entity.dos;
|
||||
|
||||
import cn.lili.base.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 会员消息
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "li_member_notice_log")
|
||||
@TableName("li_member_notice_log")
|
||||
@ApiModel(value = "会员消息")
|
||||
public class MemberNoticeLog extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Column(name = "title")
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
@Column(name = "content")
|
||||
@ApiModelProperty(value = "消息内容")
|
||||
private String content;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@Column(name = "member_ids")
|
||||
@ApiModelProperty(value = "会员id")
|
||||
private String memberIds;
|
||||
/**
|
||||
* 管理员id
|
||||
*/
|
||||
@Column(name = "admin_id")
|
||||
@ApiModelProperty(value = "管理员id")
|
||||
private String adminId;
|
||||
/**
|
||||
* 管理员名称
|
||||
*/
|
||||
@Column(name = "admin_name")
|
||||
@ApiModelProperty(value = "管理员名称")
|
||||
private String adminName;
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@Column(name = "send_time")
|
||||
@ApiModelProperty(value = "发送时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
||||
private Date sendTime;
|
||||
/**
|
||||
* 发送类型
|
||||
*/
|
||||
@Column(name = "send_type")
|
||||
@ApiModelProperty(value = "发送类型,0全站,1指定会员")
|
||||
private Integer sendType;
|
||||
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package cn.lili.modules.member.entity.dos;
|
||||
|
||||
import cn.lili.base.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 会员消息
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "li_member_notice_senter")
|
||||
@TableName("li_member_notice_senter")
|
||||
@ApiModel(value = "会员消息")
|
||||
public class MemberNoticeSenter extends BaseEntity {
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Column(name = "title")
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
@Column(name = "content")
|
||||
@ApiModelProperty(value = "消息内容")
|
||||
private String content;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@Column(name = "member_ids")
|
||||
@ApiModelProperty(value = "会员id")
|
||||
private String memberIds;
|
||||
/**
|
||||
* 发送类型
|
||||
*/
|
||||
@Column(name = "send_type")
|
||||
@ApiModelProperty(value = "发送类型,ALL 全站,SELECT 指定会员")
|
||||
private String sendType;
|
||||
|
||||
}
|
@ -18,6 +18,9 @@ public class MemberWithdrawalMessage {
|
||||
@ApiModelProperty(value = "会员id")
|
||||
private String memberId;
|
||||
|
||||
@ApiModelProperty(value = "提现状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* @see cn.lili.modules.member.entity.enums.MemberWithdrawalDestinationEnum
|
||||
*/
|
||||
|
@ -1,14 +0,0 @@
|
||||
package cn.lili.modules.member.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeLog;
|
||||
|
||||
/**
|
||||
* 会员消息数据处理层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
public interface MemberNoticeLogMapper extends BaseMapper<MemberNoticeLog> {
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.lili.modules.member.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
|
||||
/**
|
||||
* 会员站内信数据处理层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
public interface MemberNoticeMapper extends BaseMapper<MemberNotice> {
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.lili.modules.member.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeSenter;
|
||||
|
||||
/**
|
||||
* 会员消息数据处理层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
public interface MemberNoticeSenterMapper extends BaseMapper<MemberNoticeSenter> {
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.lili.modules.member.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeLog;
|
||||
|
||||
/**
|
||||
* 会员消息业务层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:44 下午
|
||||
*/
|
||||
public interface MemberNoticeLogService extends IService<MemberNoticeLog> {
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package cn.lili.modules.member.service;
|
||||
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeSenter;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 会员消息业务层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:44 下午
|
||||
*/
|
||||
public interface MemberNoticeSenterService extends IService<MemberNoticeSenter> {
|
||||
|
||||
/**
|
||||
* 自定义保存方法
|
||||
*
|
||||
* @param memberNoticeSenter 会员消息
|
||||
* @return 操作状态
|
||||
*/
|
||||
boolean customSave(MemberNoticeSenter memberNoticeSenter);
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package cn.lili.modules.member.service;
|
||||
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 会员站内信业务层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:44 下午
|
||||
*/
|
||||
public interface MemberNoticeService extends IService<MemberNotice> {
|
||||
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeLog;
|
||||
import cn.lili.modules.member.mapper.MemberNoticeLogMapper;
|
||||
import cn.lili.modules.member.service.MemberNoticeLogService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 会员消息业务层实现
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:44 下午
|
||||
*/
|
||||
@Service
|
||||
public class MemberNoticeLogServiceImpl extends ServiceImpl<MemberNoticeLogMapper, MemberNoticeLog> implements MemberNoticeLogService {
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeSenter;
|
||||
import cn.lili.modules.member.entity.enums.SendTypeEnum;
|
||||
import cn.lili.modules.member.mapper.MemberNoticeSenterMapper;
|
||||
import cn.lili.modules.member.service.MemberNoticeSenterService;
|
||||
import cn.lili.modules.member.service.MemberNoticeService;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员消息业务层实现
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:44 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = java.lang.Exception.class)
|
||||
public class MemberNoticeSenterServiceImpl extends ServiceImpl<MemberNoticeSenterMapper, MemberNoticeSenter> implements MemberNoticeSenterService {
|
||||
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
/**
|
||||
* 会员站内信
|
||||
*/
|
||||
@Autowired
|
||||
private MemberNoticeService memberNoticeService;
|
||||
|
||||
@Override
|
||||
public boolean customSave(MemberNoticeSenter memberNoticeSenter) {
|
||||
|
||||
if (this.saveOrUpdate(memberNoticeSenter)) {
|
||||
List<MemberNotice> memberNotices = new ArrayList<>();
|
||||
//如果是选中会员发送
|
||||
if (memberNoticeSenter.getSendType().equals(SendTypeEnum.SELECT.name())) {
|
||||
//判定消息是否有效
|
||||
if (!StringUtils.isEmpty(memberNoticeSenter.getMemberIds())) {
|
||||
String[] ids = memberNoticeSenter.getMemberIds().split(",");
|
||||
MemberNotice memberNotice;
|
||||
for (String id : ids) {
|
||||
memberNotice = new MemberNotice();
|
||||
memberNotice.setIsRead(false);
|
||||
memberNotice.setContent(memberNoticeSenter.getContent());
|
||||
memberNotice.setMemberId(id);
|
||||
memberNotice.setTitle(memberNoticeSenter.getTitle());
|
||||
memberNotices.add(memberNotice);
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} //否则是全部会员发送
|
||||
else {
|
||||
List<Member> members = memberService.list();
|
||||
MemberNotice memberNotice;
|
||||
for (Member member : members) {
|
||||
memberNotice = new MemberNotice();
|
||||
memberNotice.setIsRead(false);
|
||||
memberNotice.setContent(memberNoticeSenter.getContent());
|
||||
memberNotice.setMemberId(member.getId());
|
||||
memberNotice.setTitle(memberNoticeSenter.getTitle());
|
||||
memberNotices.add(memberNotice);
|
||||
}
|
||||
}
|
||||
//防止没有会员导致报错
|
||||
if (memberNotices.size() > 0) {
|
||||
//批量保存
|
||||
if (memberNoticeService.saveBatch(memberNotices)) {
|
||||
return true;
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.NOTICE_SEND_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
import cn.lili.modules.member.mapper.MemberNoticeMapper;
|
||||
import cn.lili.modules.member.service.MemberNoticeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 会员站内信业务层实现
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:44 下午
|
||||
*/
|
||||
@Service
|
||||
public class MemberNoticeServiceImpl extends ServiceImpl<MemberNoticeMapper, MemberNotice> implements MemberNoticeService {
|
||||
|
||||
}
|
@ -35,7 +35,11 @@ public enum NoticeMessageParameterEnum {
|
||||
/**
|
||||
* 取消原因
|
||||
*/
|
||||
CANCEL_REASON("cancel_reason", "取消原因");
|
||||
CANCEL_REASON("cancel_reason", "取消原因"),
|
||||
/**
|
||||
* 取消原因
|
||||
*/
|
||||
PRICE("price", "金额");
|
||||
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
@ -4,12 +4,13 @@ import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
import cn.lili.modules.member.service.MemberNoticeService;
|
||||
import cn.lili.modules.message.entity.dos.MemberMessage;
|
||||
import cn.lili.modules.message.entity.dos.NoticeMessage;
|
||||
import cn.lili.modules.message.entity.dto.NoticeMessageDTO;
|
||||
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
|
||||
import cn.lili.modules.message.entity.enums.NoticeMessageParameterEnum;
|
||||
import cn.lili.modules.message.mapper.NoticeMessageTemplateMapper;
|
||||
import cn.lili.modules.message.service.MemberMessageService;
|
||||
import cn.lili.modules.message.service.NoticeMessageService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -17,7 +18,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -31,7 +31,7 @@ import java.util.Map;
|
||||
public class NoticeMessageServiceImpl extends ServiceImpl<NoticeMessageTemplateMapper, NoticeMessage> implements NoticeMessageService {
|
||||
|
||||
@Autowired
|
||||
private MemberNoticeService memberNoticeService;
|
||||
private MemberMessageService memberMessageService;
|
||||
|
||||
@Override
|
||||
public IPage<NoticeMessage> getMessageTemplate(PageVO pageVO, String type) {
|
||||
@ -54,18 +54,19 @@ public class NoticeMessageServiceImpl extends ServiceImpl<NoticeMessageTemplateM
|
||||
NoticeMessage noticeMessage = this.getOne(new LambdaQueryWrapper<NoticeMessage>().eq(NoticeMessage::getNoticeNode, noticeMessageDTO.getNoticeMessageNodeEnum().getDescription().trim()));
|
||||
//如果通知类站内信开启的情况下
|
||||
if (noticeMessage != null && noticeMessage.getNoticeStatus().equals(SwitchEnum.OPEN.name())) {
|
||||
MemberNotice memberNotice = new MemberNotice();
|
||||
memberNotice.setMemberId(noticeMessageDTO.getMemberId());
|
||||
memberNotice.setTitle(noticeMessage.getNoticeTitle());
|
||||
memberNotice.setContent(noticeMessage.getNoticeContent());
|
||||
MemberMessage memberMessage = new MemberMessage();
|
||||
memberMessage.setMemberId(noticeMessageDTO.getMemberId());
|
||||
memberMessage.setTitle(noticeMessage.getNoticeTitle());
|
||||
memberMessage.setContent(noticeMessage.getNoticeContent());
|
||||
//参数不为空,替换内容
|
||||
if (noticeMessageDTO.getParameter() != null) {
|
||||
memberNotice.setContent(replaceNoticeContent(noticeMessage.getNoticeContent(), noticeMessageDTO.getParameter()));
|
||||
memberMessage.setContent(replaceNoticeContent(noticeMessage.getNoticeContent(), noticeMessageDTO.getParameter()));
|
||||
} else {
|
||||
memberNotice.setContent(noticeMessage.getNoticeContent());
|
||||
memberMessage.setContent(noticeMessage.getNoticeContent());
|
||||
}
|
||||
memberMessage.setStatus(MessageStatusEnum.UN_READY.name());
|
||||
//添加站内信
|
||||
memberNoticeService.save(memberNotice);
|
||||
memberMessageService.save(memberMessage);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("站内信发送失败:", e);
|
||||
|
@ -1,64 +0,0 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeLog;
|
||||
import cn.lili.modules.member.service.MemberNoticeLogService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息接口")
|
||||
@RequestMapping("/manager/memberNoticeLog")
|
||||
public class MemberNoticeLogManagerController {
|
||||
@Autowired
|
||||
private MemberNoticeLogService memberNoticeLogService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<MemberNoticeLog> get(@PathVariable String id) {
|
||||
MemberNoticeLog memberNoticeLog = memberNoticeLogService.getById(id);
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取全部数据")
|
||||
@GetMapping(value = "/getAll")
|
||||
public ResultMessage<List<MemberNoticeLog>> getAll() {
|
||||
List<MemberNoticeLog> list = memberNoticeLogService.list();
|
||||
return ResultUtil.data(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberNoticeLog>> getByPage(PageVO page) {
|
||||
IPage<MemberNoticeLog> data = memberNoticeLogService.page(PageUtil.initPage(page));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑或更新数据")
|
||||
@PostMapping(value = "/insertOrUpdate")
|
||||
public ResultMessage<MemberNoticeLog> saveOrUpdate(MemberNoticeLog memberNoticeLog) {
|
||||
memberNoticeLogService.saveOrUpdate(memberNoticeLog);
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeLogService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeSenter;
|
||||
import cn.lili.modules.member.service.MemberNoticeSenterService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息接口")
|
||||
@RequestMapping("/manager/memberNoticeSenter")
|
||||
public class MemberNoticeSenterManagerController {
|
||||
@Autowired
|
||||
private MemberNoticeSenterService memberNoticeSenterService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<MemberNoticeSenter> get(@PathVariable String id) {
|
||||
MemberNoticeSenter memberNoticeSenter = memberNoticeSenterService.getById(id);
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取全部数据")
|
||||
@GetMapping(value = "/getAll")
|
||||
public ResultMessage<List<MemberNoticeSenter>> getAll() {
|
||||
|
||||
List<MemberNoticeSenter> list = memberNoticeSenterService.list();
|
||||
return ResultUtil.data(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberNoticeSenter>> getByPage(MemberNoticeSenter entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
IPage<MemberNoticeSenter> data = memberNoticeSenterService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑或更新数据")
|
||||
@PostMapping(value = "/insertOrUpdate")
|
||||
public ResultMessage<MemberNoticeSenter> saveOrUpdate(MemberNoticeSenter memberNoticeSenter) {
|
||||
|
||||
memberNoticeSenterService.customSave(memberNoticeSenter);
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeSenterService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
import cn.lili.modules.member.service.MemberNoticeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员站内信管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2020/11/17 4:31 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员站内信管理API")
|
||||
@RequestMapping("/manager/member/notice")
|
||||
public class MemberNoticeManagerController {
|
||||
@Autowired
|
||||
private MemberNoticeService memberNoticeService;
|
||||
|
||||
@ApiOperation(value = "获取详情")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<MemberNotice> get(@PathVariable String id) {
|
||||
MemberNotice memberNotice = memberNoticeService.getById(id);
|
||||
return ResultUtil.data(memberNotice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取站内信")
|
||||
@GetMapping(value = "/page")
|
||||
public ResultMessage<IPage<MemberNotice>> getByPage(
|
||||
PageVO page) {
|
||||
IPage<MemberNotice> data = memberNoticeService.page(PageUtil.initPage(page));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "阅读消息")
|
||||
@PostMapping("/read/{ids}")
|
||||
public ResultMessage<Object> read(@PathVariable List ids) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper();
|
||||
updateWrapper.in("id", ids);
|
||||
updateWrapper.set("is_read", true);
|
||||
memberNoticeService.update(updateWrapper);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "阅读全部")
|
||||
@PostMapping("/read/all")
|
||||
public ResultMessage<Object> readAll() {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper();
|
||||
updateWrapper.in("member_id", UserContext.getCurrentUser().getId());
|
||||
updateWrapper.set("is_read", true);
|
||||
memberNoticeService.update(updateWrapper);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除所有")
|
||||
@DeleteMapping
|
||||
public ResultMessage<Object> deleteAll() {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
|
||||
memberNoticeService.remove(queryWrapper);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
Target Server Version : 80023
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 18/07/2021 17:11:47
|
||||
Date: 21/07/2021 19:26:53
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@ -56,8 +56,10 @@ INSERT INTO `li_notice_message` VALUES (13, NULL, '2021-07-15 19:39:31.000000',
|
||||
INSERT INTO `li_notice_message` VALUES (14, NULL, '2021-07-15 19:39:39.000000', NULL, NULL, '2021-07-15 19:39:43.000000', '订单 #{商品名称} 商家已签收哦,请关注后续退款状态,将在1-3个工作日内自动退款~', '退货物品签收通知', 'OPEN', '退货物品签收通知', 'goods');
|
||||
INSERT INTO `li_notice_message` VALUES (15, NULL, '2021-07-15 19:44:38.000000', NULL, NULL, '2021-07-15 19:44:40.000000', '售后单 #{商品名称} 已经完成,请关注及时关注售后单状态~', '售后完成通知', 'OPEN', '售后完成通知', 'goods');
|
||||
INSERT INTO `li_notice_message` VALUES (16, NULL, '2021-07-15 19:47:27.000000', NULL, NULL, '2021-07-15 19:47:31.000000', '您当前到账{获得积分}积分,消费#{消费积分} 积分,积分可以抵现金哦,真的很棒棒呢~', '积分变更通知', 'OPEN', '积分变更通知', 'income_points,expenditure_points');
|
||||
INSERT INTO `li_notice_message` VALUES (17, NULL, '2021-07-15 19:53:10.000000', NULL, NULL, '2021-07-15 19:53:13.000000', '您的余额账户今日收入#{收入金额},支出#{支出金额},如遇异常变动,请及时联系我们哦~', '余额账户变更通知', 'OPEN', '余额账户变更通知', 'income,expenditure');
|
||||
INSERT INTO `li_notice_message` VALUES (18, NULL, '2021-07-15 19:57:01.000000', NULL, NULL, '2021-07-15 19:57:04.000000', '恭喜您,您的提处理成功,提现金额为#{收入金额},将在1-3工作日内到账', '提现成功通知', 'OPEN', '提现成功通知', 'income');
|
||||
INSERT INTO `li_notice_message` VALUES (17, NULL, '2021-07-15 19:53:10.000000', NULL, NULL, '2021-07-15 19:53:13.000000', '您的余额账户今日收入¥#{收入金额},支出¥#{支出金额},如遇异常变动,请及时联系我们哦~', '余额账户变更通知', 'OPEN', '余额账户变更通知', 'income,expenditure');
|
||||
INSERT INTO `li_notice_message` VALUES (18, NULL, '2021-07-15 19:57:01.000000', NULL, NULL, '2021-07-15 19:57:04.000000', '恭喜您,您的提处理成功,提现金额为¥#{收入金额},将在1-3工作日内到账', '提现成功通知', 'OPEN', '提现成功通知', 'income');
|
||||
INSERT INTO `li_notice_message` VALUES (19, NULL, '2021-07-21 18:58:10.000000', NULL, NULL, '2021-07-21 18:58:13.000000', '恭喜您,您的提现金额为¥#{金额}的申请已经提交审核,请及时关注审核动态哦~', '提现申请提交成功通知', 'OPEN', '提现申请提交成功通知', 'price');
|
||||
INSERT INTO `li_notice_message` VALUES (20, NULL, '2021-07-21 19:16:58.000000', NULL, NULL, '2021-07-21 19:17:02.000000', '很抱歉,您的提现金额为¥#{金额}的申请已被拒绝,如有问题请及时联系管理员哦~', '提现申请驳回通知', 'OPEN', '提现申请驳回通知', 'price');
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user