33 changed files with 348 additions and 88 deletions
@ -0,0 +1,44 @@ |
|||
package com.bnyer.common.core.dto; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.*; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class AddUserVipRecordDto { |
|||
|
|||
@ApiModelProperty(value="订单id") |
|||
private String orderId; |
|||
|
|||
@ApiModelProperty(value="用户id") |
|||
private Long userId; |
|||
|
|||
@ApiModelProperty(value="用户手机号") |
|||
private String phone; |
|||
|
|||
@ApiModelProperty(value="vip表id") |
|||
private Long vipId; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="开始时间") |
|||
private Date startTime; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="到期时间") |
|||
private Date endTime; |
|||
|
|||
@ApiModelProperty(value="vip名称") |
|||
private String vipName; |
|||
|
|||
@ApiModelProperty(value = "vip类型名称") |
|||
private String vipTypeName; |
|||
|
|||
@ApiModelProperty(value = "用户客户端类型:10用户-抖音 20用户-快手 30用户-微信 40艺术家-微信") |
|||
private Integer userClientType; |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
package com.bnyer.img.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* @author :WXC |
|||
* @description : |
|||
*/ |
|||
@Getter |
|||
@AllArgsConstructor |
|||
public enum EnumUserVipRecordStatus { |
|||
|
|||
EXPIRE(0,"已到期"), |
|||
VALID(1,"已生效"), |
|||
; |
|||
|
|||
private final int status; |
|||
|
|||
private final String name; |
|||
|
|||
public static String getStatusName(int status) { |
|||
for (EnumUserVipRecordStatus s : EnumUserVipRecordStatus.values()) { |
|||
if (status == s.status) { |
|||
return s.getName(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.bnyer.img.listener; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.bnyer.common.core.domain.UserVipRecord; |
|||
import com.bnyer.common.core.dto.AddUserVipRecordDto; |
|||
import com.bnyer.common.rocketmq.config.RocketMqConstant; |
|||
import com.bnyer.img.service.UserVipRecordService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
|||
import org.apache.rocketmq.spring.core.RocketMQListener; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @author :WXC |
|||
* @Date :2023/03/24 |
|||
* @description :取消订单mq消费监听 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RocketMQMessageListener(topic = RocketMqConstant.VIP_RECORD_CREATE_TOPIC,consumerGroup = RocketMqConstant.VIP_RECORD_CREATE_TOPIC) |
|||
public class VipRecordCreateConsumer implements RocketMQListener<String> { |
|||
|
|||
@Autowired |
|||
private UserVipRecordService userVipRecordService; |
|||
|
|||
@Override |
|||
public void onMessage(String message) { |
|||
log.info("收到消息:{}", message); |
|||
JSONObject jsonObject = JSON.parseObject(message); |
|||
AddUserVipRecordDto addUserVipRecordDto = JSON.toJavaObject(jsonObject, AddUserVipRecordDto.class); |
|||
//添加用户会员记录
|
|||
userVipRecordService.addUserVipRecord(addUserVipRecordDto); |
|||
} |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
package com.bnyer.pay.enums; |
|||
|
|||
import com.bnyer.common.core.enums.EnumPayType; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author :WXC |
|||
* @description : |
|||
*/ |
|||
@Getter |
|||
@AllArgsConstructor |
|||
public enum EnumPayChannel { |
|||
|
|||
ALI_PAY("alipay","2","ALIPAY","alipay"), |
|||
WX_PAY("wxpay","1","WECHAT","wxpay"), |
|||
DY_PAY("10","","","dypay"), |
|||
; |
|||
|
|||
private final String code1; |
|||
|
|||
private final String code2; |
|||
|
|||
private final String code3; |
|||
|
|||
private final String name; |
|||
|
|||
public static String getPayChannelName(String code, EnumPayType payType) { |
|||
List<EnumPayChannel> enumPayChannelByPayType = getEnumPayChannelByPayType(payType); |
|||
for (EnumPayChannel value : enumPayChannelByPayType) { |
|||
if (value.code1.equals(code)){ |
|||
return value.getName(); |
|||
} |
|||
if (value.code2.equals(code)){ |
|||
return value.getName(); |
|||
} |
|||
if (value.code3.equals(code)){ |
|||
return value.getName(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static List<EnumPayChannel> getEnumPayChannelByPayType(EnumPayType payType){ |
|||
List<EnumPayChannel> enumPayChannelList = new ArrayList<>(); |
|||
switch (payType){ |
|||
case ALI_PAY: |
|||
enumPayChannelList.add(ALI_PAY); |
|||
break; |
|||
case WX_PAY: |
|||
enumPayChannelList.add(WX_PAY); |
|||
break; |
|||
case DY_PAY: |
|||
enumPayChannelList.add(ALI_PAY); |
|||
enumPayChannelList.add(WX_PAY); |
|||
enumPayChannelList.add(DY_PAY); |
|||
break; |
|||
case KS_PAY: |
|||
enumPayChannelList.add(ALI_PAY); |
|||
enumPayChannelList.add(WX_PAY); |
|||
break; |
|||
} |
|||
return enumPayChannelList; |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue