21 changed files with 1811 additions and 7 deletions
@ -0,0 +1,126 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-cloud-commons-yushan</artifactId> |
||||
|
<version>1.0.0</version> |
||||
|
</parent> |
||||
|
|
||||
|
<artifactId>epdc-commons-points-tools</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<properties> |
||||
|
<hibernate.validator.version>6.0.12.Final</hibernate.validator.version> |
||||
|
<commons.lang.version>3.7</commons.lang.version> |
||||
|
<commons.fileupload.version>1.3.3</commons.fileupload.version> |
||||
|
<commons.io.version>2.6</commons.io.version> |
||||
|
<hutool.version>4.1.8</hutool.version> |
||||
|
<easypoi.version>3.1.0</easypoi.version> |
||||
|
<joda.time.version>2.9.9</joda.time.version> |
||||
|
<fastjson.version>1.2.59</fastjson.version> |
||||
|
<jsoup.version>1.11.3</jsoup.version> |
||||
|
<lombok.version>1.18.4</lombok.version> |
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-commons-tools</artifactId> |
||||
|
<version>1.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-aop</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-configuration-processor</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-data-redis</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.fasterxml.jackson.core</groupId> |
||||
|
<artifactId>jackson-databind</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.hibernate</groupId> |
||||
|
<artifactId>hibernate-validator</artifactId> |
||||
|
<version>${hibernate.validator.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.commons</groupId> |
||||
|
<artifactId>commons-lang3</artifactId> |
||||
|
<version>${commons.lang.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>commons-fileupload</groupId> |
||||
|
<artifactId>commons-fileupload</artifactId> |
||||
|
<version>${commons.fileupload.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>commons-io</groupId> |
||||
|
<artifactId>commons-io</artifactId> |
||||
|
<version>${commons.io.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>cn.hutool</groupId> |
||||
|
<artifactId>hutool-all</artifactId> |
||||
|
<version>${hutool.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>cn.afterturn</groupId> |
||||
|
<artifactId>easypoi-base</artifactId> |
||||
|
<version>${easypoi.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>cn.afterturn</groupId> |
||||
|
<artifactId>easypoi-web</artifactId> |
||||
|
<version>${easypoi.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>joda-time</groupId> |
||||
|
<artifactId>joda-time</artifactId> |
||||
|
<version>${joda.time.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba</groupId> |
||||
|
<artifactId>fastjson</artifactId> |
||||
|
<version>${fastjson.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.jsoup</groupId> |
||||
|
<artifactId>jsoup</artifactId> |
||||
|
<version>${jsoup.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<version>${lombok.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.rocketmq</groupId> |
||||
|
<artifactId>rocketmq-spring-boot-starter</artifactId> |
||||
|
<version>2.0.2</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,44 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.annotation; |
||||
|
|
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.enums.BehaviorEnum; |
||||
|
|
||||
|
import java.lang.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 积分埋点注解 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @Date 20-04-28 |
||||
|
*/ |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
@Target(ElementType.METHOD) |
||||
|
@Inherited |
||||
|
@Documented |
||||
|
public @interface RecordUserBehavior { |
||||
|
|
||||
|
/** |
||||
|
* 用户行为 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
BehaviorEnum behavior(); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 引用标识 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
String referenceId() default ""; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
String userId() default ""; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,167 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.aop; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.RedisConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
||||
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.dto.BehaviorResultDto; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.feign.PointsCommonFeignClient; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.rocketmq.dto.BehaviorDto; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.rocketmq.producer.PointsProducer; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.apache.logging.log4j.LogManager; |
||||
|
import org.apache.logging.log4j.Logger; |
||||
|
import org.aspectj.lang.JoinPoint; |
||||
|
import org.aspectj.lang.annotation.After; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
import org.aspectj.lang.annotation.Before; |
||||
|
import org.aspectj.lang.annotation.Pointcut; |
||||
|
import org.aspectj.lang.reflect.MethodSignature; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.lang.reflect.Method; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 积分埋点切面 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @Date 20-04-28 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
public class UserBehaviorAop { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
@Autowired |
||||
|
private PointsCommonFeignClient pointsFeignClient; |
||||
|
|
||||
|
@Autowired |
||||
|
private PointsProducer pointsProducer; |
||||
|
|
||||
|
/** |
||||
|
* 使用org.slf4j.Logger,这是Spring实现日志的方法 |
||||
|
*/ |
||||
|
private final Logger logger = LogManager.getLogger(getClass()); |
||||
|
|
||||
|
/** |
||||
|
* 定义AOP扫描路径 |
||||
|
* 第一个注解只扫描aopTest方法 |
||||
|
*/ |
||||
|
@Pointcut("@annotation(com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior)") |
||||
|
public void recordUserBehavior() { |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 前置 |
||||
|
*/ |
||||
|
@Before("recordUserBehavior()") |
||||
|
public void deBefore(JoinPoint joinPoint) { |
||||
|
this.businessLogic(joinPoint, 0); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 后置 |
||||
|
* description: |
||||
|
* 1.从redis根据用户动作编码拿取动作信息:用来判断是前置还是后置执行 |
||||
|
* 2.组装基本信息:动作编码,用户信息,业务关联信息(业务ID)-- 发送mq消息 |
||||
|
* 3.points模块 订阅消息,消费消息,进行积分操作 |
||||
|
*/ |
||||
|
@After("recordUserBehavior()") |
||||
|
public void doRecord(JoinPoint joinPoint) { |
||||
|
this.businessLogic(joinPoint, 1); |
||||
|
} |
||||
|
|
||||
|
private String covertData(String userIdKey, Object[] args, String[] argNames) { |
||||
|
String referenceId = userIdKey; |
||||
|
if (userIdKey.startsWith("#")) { |
||||
|
String expression = userIdKey.substring(2, userIdKey.length() - 1); |
||||
|
String[] strArr = expression.split("\\."); |
||||
|
if (strArr.length > 2 || strArr.length == 0) { |
||||
|
throw new RenException("格式不正确"); |
||||
|
} |
||||
|
if (strArr.length == 1) { |
||||
|
for (int i = 0; i < argNames.length; i++) { |
||||
|
if (argNames[i].equals(strArr[0])) { |
||||
|
return String.valueOf(args[i]); |
||||
|
} |
||||
|
} |
||||
|
} else if (strArr.length == 2) { |
||||
|
for (int i = 0; i < argNames.length; i++) { |
||||
|
if (argNames[i].equals(strArr[0])) { |
||||
|
Object obj = args[i]; |
||||
|
try { |
||||
|
Method method = obj.getClass().getDeclaredMethod(strArr[1]); |
||||
|
return String.valueOf(method.invoke(obj)); |
||||
|
} catch (Exception e) { |
||||
|
throw new RenException("反射失败"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return referenceId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return |
||||
|
* @Description 封装业务逻辑 way:0 前置 1 后置 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/4/28 |
||||
|
* @Param |
||||
|
**/ |
||||
|
private void businessLogic(JoinPoint joinPoint, Integer way) { |
||||
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
||||
|
Method method = signature.getMethod(); |
||||
|
RecordUserBehavior recordUserBehavior = method.getAnnotation(RecordUserBehavior.class); |
||||
|
Object[] args = joinPoint.getArgs(); |
||||
|
String[] argNames = ((MethodSignature) joinPoint.getSignature()).getParameterNames(); |
||||
|
String behaviorCode = recordUserBehavior.behavior().getValue(); |
||||
|
//从redis获取动作信息
|
||||
|
Object obj = redisUtils.get(RedisConstant.BEHAVIOR_CODE + behaviorCode); |
||||
|
String behaviorRecodingTime = ""; |
||||
|
if (obj == null) { |
||||
|
//如果redis是null,则从数据库获取
|
||||
|
Result<BehaviorResultDto> result = pointsFeignClient.getBehaviorCodeInfo(behaviorCode); |
||||
|
BehaviorResultDto behaviorResultDto = result.getData(); |
||||
|
if (behaviorResultDto == null) { |
||||
|
return; |
||||
|
} |
||||
|
behaviorRecodingTime = behaviorResultDto.getBehaviorRecordingTime(); |
||||
|
//将对象存入redis
|
||||
|
redisUtils.set(RedisConstant.BEHAVIOR_CODE + behaviorCode, behaviorResultDto); |
||||
|
} else { |
||||
|
BehaviorResultDto behaviorResultDto = ConvertUtils.sourceToTarget(obj, BehaviorResultDto.class); |
||||
|
behaviorRecodingTime = String.valueOf(behaviorResultDto.getBehaviorRecordingTime()); |
||||
|
} |
||||
|
//判断前后置
|
||||
|
//前置方法调用 如果是前置,但是动作要求后置则直接返回
|
||||
|
if (way == 0 && Constant.BEHAVIOR_RECORDING_TIME_AFTER.equals(behaviorRecodingTime)) { |
||||
|
return; |
||||
|
} else if (way == 1 && Constant.BEHAVIOR_RECORDING_TIME_BEFORE.equals(behaviorRecodingTime)) { |
||||
|
return; |
||||
|
} |
||||
|
//组装基本信息
|
||||
|
String referenceId = this.covertData(recordUserBehavior.referenceId(), args, argNames); |
||||
|
String userId = this.covertData(recordUserBehavior.userId(), args, argNames); |
||||
|
if(StringUtils.isBlank(userId) || StringUtils.isBlank(referenceId)){ |
||||
|
return; |
||||
|
} |
||||
|
BehaviorDto behaviorDto = new BehaviorDto(); |
||||
|
behaviorDto.setBehavior(behaviorCode); |
||||
|
behaviorDto.setReferenceId(referenceId); |
||||
|
behaviorDto.setUserId(userId); |
||||
|
behaviorDto.setOperationTime(new Date()); |
||||
|
//发送mq
|
||||
|
pointsProducer.sendMessage(RocketMqConstant.MQ_TOPIC_POINTS, RocketMqConstant.MQ_TAG_POINTS, referenceId, JSONObject.toJSONString(behaviorDto)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @author songyunpeng |
||||
|
* @Description |
||||
|
* @create 2020-04-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class BehaviorResultDto implements Serializable { |
||||
|
private static final long serialVersionUID = 5458618984429715932L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 动作编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 动作描述 |
||||
|
*/ |
||||
|
private String behaviorDesc; |
||||
|
|
||||
|
/** |
||||
|
* 动作记录时机 0-方法执行前,1-方法执行后 |
||||
|
*/ |
||||
|
private String behaviorRecordingTime; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 积分记录表 添加 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @since v1.0.0 2020-04-29 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsLogsAddFormDTO { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户昵称 |
||||
|
*/ |
||||
|
private String nickname; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户头像 |
||||
|
*/ |
||||
|
private String faceImg; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 关联表ID |
||||
|
*/ |
||||
|
private String referenceId; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则编码 |
||||
|
*/ |
||||
|
private String ruleCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分行为编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分操作类型 0-减积分,1-加积分 |
||||
|
*/ |
||||
|
private String operationType; |
||||
|
|
||||
|
/** |
||||
|
* 操作积分值 |
||||
|
*/ |
||||
|
private Integer points; |
||||
|
|
||||
|
/** |
||||
|
* 操作描述 |
||||
|
*/ |
||||
|
private String operationDesc; |
||||
|
|
||||
|
/** |
||||
|
* 操作时间 |
||||
|
*/ |
||||
|
private Date operationTime; |
||||
|
|
||||
|
/** |
||||
|
* 操作方式 user-用户操作,admin-管理员操作,sys-系统操作 |
||||
|
*/ |
||||
|
private String operationMode; |
||||
|
|
||||
|
/** |
||||
|
* 剩余积分值 |
||||
|
*/ |
||||
|
private Integer lavePoints; |
||||
|
|
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 积分记录查询 参数 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-04-29 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsLogsFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 关联表ID |
||||
|
*/ |
||||
|
private String referenceId; |
||||
|
|
||||
|
/** |
||||
|
* 积分行为编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 上限日期标识 |
||||
|
*/ |
||||
|
private String operationFlag; |
||||
|
/** |
||||
|
* 上限值 |
||||
|
*/ |
||||
|
private Integer upperLimitVal; |
||||
|
} |
@ -0,0 +1,133 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 积分记录表 积分记录表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-04-29 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsLogsResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户昵称 |
||||
|
*/ |
||||
|
private String nickname; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户头像 |
||||
|
*/ |
||||
|
private String faceImg; |
||||
|
|
||||
|
/** |
||||
|
* 关联表ID |
||||
|
*/ |
||||
|
private String referenceId; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则编码 |
||||
|
*/ |
||||
|
private String ruleCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分行为编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分操作类型 0-减积分,1-加积分 |
||||
|
*/ |
||||
|
private String operationType; |
||||
|
|
||||
|
/** |
||||
|
* 操作积分值 |
||||
|
*/ |
||||
|
private Integer points; |
||||
|
|
||||
|
/** |
||||
|
* 操作描述 |
||||
|
*/ |
||||
|
private String operationDesc; |
||||
|
|
||||
|
/** |
||||
|
* 操作时间 |
||||
|
*/ |
||||
|
private Date operationTime; |
||||
|
|
||||
|
/** |
||||
|
* 操作方式 user-用户操作,admin-管理员操作,sys-系统操作 |
||||
|
*/ |
||||
|
private String operationMode; |
||||
|
|
||||
|
/** |
||||
|
* 剩余积分值 |
||||
|
*/ |
||||
|
private Integer lavePoints; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 一定时限内的积分总和返回 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-04-29 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsLogsSumResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 总和 |
||||
|
*/ |
||||
|
private Integer total; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 操作时间 |
||||
|
*/ |
||||
|
private Date operationTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,122 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsRuleResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则编码 |
||||
|
*/ |
||||
|
private String ruleCode; |
||||
|
|
||||
|
/** |
||||
|
* 动作编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则描述 |
||||
|
*/ |
||||
|
private String ruleDesc; |
||||
|
|
||||
|
/** |
||||
|
* 规则操作类型 0-减积分,1-加积分 |
||||
|
*/ |
||||
|
private String operationType; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则值 |
||||
|
*/ |
||||
|
private Integer points; |
||||
|
|
||||
|
/** |
||||
|
* 上线统计指标 0-分钟,1-小时,2-日,3-月,4-年 |
||||
|
*/ |
||||
|
private String limitType; |
||||
|
|
||||
|
/** |
||||
|
* 积分上限值 |
||||
|
*/ |
||||
|
private Integer upperLimitVal; |
||||
|
|
||||
|
/** |
||||
|
* 启用标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String enableFlag; |
||||
|
|
||||
|
/** |
||||
|
* 附加值 |
||||
|
*/ |
||||
|
private String addedVal; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,360 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.pointcommons.tools.dto; |
||||
|
|
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户信息表 |
||||
|
* |
||||
|
* @author qu qu@gmail.com |
||||
|
* @since v1.0.0 2019-09-02 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UserDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 915598602233599300L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 昵称 |
||||
|
*/ |
||||
|
private String nickname; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 密码 |
||||
|
*/ |
||||
|
private String password; |
||||
|
|
||||
|
/** |
||||
|
* 认证时间 |
||||
|
*/ |
||||
|
private Date registerTime; |
||||
|
|
||||
|
/** |
||||
|
* 头像 |
||||
|
*/ |
||||
|
private String faceImg; |
||||
|
|
||||
|
/** |
||||
|
* 性别(女性-0,男性-1) |
||||
|
* {@link com.elink.esua.epdc.commons.tools.enums.UserSexEnum} |
||||
|
*/ |
||||
|
private String sex; |
||||
|
|
||||
|
/** |
||||
|
* 生日 |
||||
|
*/ |
||||
|
private Date birthday; |
||||
|
|
||||
|
/** |
||||
|
* 邮箱 |
||||
|
*/ |
||||
|
private String email; |
||||
|
|
||||
|
/** |
||||
|
* 电话 |
||||
|
*/ |
||||
|
private String telephone; |
||||
|
|
||||
|
/** |
||||
|
* 邮编 |
||||
|
*/ |
||||
|
private String zipCode; |
||||
|
|
||||
|
/** |
||||
|
* 职业 |
||||
|
*/ |
||||
|
private String profession; |
||||
|
|
||||
|
/** |
||||
|
* 爱好 |
||||
|
*/ |
||||
|
private String hobbies; |
||||
|
|
||||
|
/** |
||||
|
* 个性签名 |
||||
|
*/ |
||||
|
private String userSign; |
||||
|
|
||||
|
/** |
||||
|
* 邀请码 |
||||
|
*/ |
||||
|
private String invitationCode; |
||||
|
|
||||
|
/** |
||||
|
* 最近登录时间 |
||||
|
*/ |
||||
|
private Date lastLoginTime; |
||||
|
|
||||
|
/** |
||||
|
* 最近登录IP |
||||
|
*/ |
||||
|
private String lastLoginIp; |
||||
|
|
||||
|
/** |
||||
|
* 最近登录位置经度 |
||||
|
*/ |
||||
|
private String lastLongitude; |
||||
|
|
||||
|
/** |
||||
|
* 最近登录位置维度 |
||||
|
*/ |
||||
|
private String lastLatitude; |
||||
|
|
||||
|
/** |
||||
|
* 真实姓名 |
||||
|
*/ |
||||
|
private String realName; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String identityNo; |
||||
|
|
||||
|
/** |
||||
|
* 所在道路(如山东路168号) |
||||
|
*/ |
||||
|
private String road; |
||||
|
|
||||
|
/** |
||||
|
* 小区名称 |
||||
|
*/ |
||||
|
private String villageName; |
||||
|
|
||||
|
/** |
||||
|
* 住处(楼栋-单元-房间) |
||||
|
*/ |
||||
|
private String dwellingPlace; |
||||
|
|
||||
|
/** |
||||
|
* 居民住址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 微信OPENID |
||||
|
*/ |
||||
|
private String wxOpenId; |
||||
|
|
||||
|
/** |
||||
|
* 微信unionId |
||||
|
*/ |
||||
|
private String wxUnionId; |
||||
|
|
||||
|
/** |
||||
|
* 是否是党员(0-否,1-是) |
||||
|
*/ |
||||
|
private String partyFlag; |
||||
|
|
||||
|
/** |
||||
|
* 注册方式(wx:微信注册) |
||||
|
*/ |
||||
|
private String registerWay; |
||||
|
|
||||
|
/** |
||||
|
* 用户来源(wp:公众号) |
||||
|
*/ |
||||
|
private String registerSource; |
||||
|
|
||||
|
/** |
||||
|
* 手机号所属省份 |
||||
|
*/ |
||||
|
private String mobileProvince; |
||||
|
|
||||
|
/** |
||||
|
* 手机号所属城市 |
||||
|
*/ |
||||
|
private String mobileCity; |
||||
|
|
||||
|
/** |
||||
|
* 手机号所属运营商 |
||||
|
*/ |
||||
|
private String mobileCarrier; |
||||
|
|
||||
|
/** |
||||
|
* 用户积分 |
||||
|
*/ |
||||
|
private Integer points; |
||||
|
|
||||
|
/** |
||||
|
* 用户累计 |
||||
|
*/ |
||||
|
private Integer points_totle; |
||||
|
|
||||
|
/** |
||||
|
* 邀请人ID |
||||
|
*/ |
||||
|
private String inviteUserId; |
||||
|
|
||||
|
/** |
||||
|
* 状态,参考枚举类:{@link com.elink.esua.epdc.enums.AppUserStatesEnum} |
||||
|
*/ |
||||
|
private String state; |
||||
|
|
||||
|
/** |
||||
|
* 区县 |
||||
|
*/ |
||||
|
private String district; |
||||
|
|
||||
|
/** |
||||
|
* 区县ID |
||||
|
*/ |
||||
|
private Long districtId; |
||||
|
|
||||
|
/** |
||||
|
* 街道 |
||||
|
*/ |
||||
|
private String street; |
||||
|
|
||||
|
/** |
||||
|
* 街道ID |
||||
|
*/ |
||||
|
private Long streetId; |
||||
|
|
||||
|
/** |
||||
|
* 社区 |
||||
|
*/ |
||||
|
private String community; |
||||
|
|
||||
|
/** |
||||
|
* 社区ID |
||||
|
*/ |
||||
|
private Long communityId; |
||||
|
|
||||
|
/** |
||||
|
* 网格 |
||||
|
*/ |
||||
|
private String grid; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
*/ |
||||
|
private Long gridId; |
||||
|
|
||||
|
/** |
||||
|
* 删除标记 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 注册时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 姓 |
||||
|
*/ |
||||
|
private String lastName; |
||||
|
|
||||
|
/** |
||||
|
* 名 |
||||
|
*/ |
||||
|
private String firstName; |
||||
|
/** |
||||
|
* 干部下沉 0不 |
||||
|
*/ |
||||
|
private String cadreFlag; |
||||
|
/** |
||||
|
* 党员标签 |
||||
|
*/ |
||||
|
private String tagIds; |
||||
|
|
||||
|
/** |
||||
|
* 审核备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 是否是网格长 |
||||
|
*/ |
||||
|
private String leaderFlag; |
||||
|
|
||||
|
/** |
||||
|
* 认证历史-累计提交认证次数 |
||||
|
*/ |
||||
|
private Integer totalSubmitNum; |
||||
|
|
||||
|
/** |
||||
|
* 认证历史-通过次数 |
||||
|
*/ |
||||
|
private Integer totalPassSubmitNum; |
||||
|
|
||||
|
/** |
||||
|
* 认证历史-不通过次数 |
||||
|
*/ |
||||
|
private Integer totalFailNum; |
||||
|
/** |
||||
|
* 居住网格id |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.feign; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.dto.*; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.feign.fallback.PointsCommonFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author songyunpeng |
||||
|
* @date 2020/04/28 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_POINTS_SERVER, fallback = PointsCommonFeignClientFallback.class) |
||||
|
public interface PointsCommonFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.lang.String> |
||||
|
* @Description 获取动作编码信息 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/4/28 |
||||
|
* @Param [behaviorCode] |
||||
|
**/ |
||||
|
@PostMapping(value = "points/points/getBehaviorCodeInfo/{behaviorCode}", consumes = MediaType.APPLICATION_JSON_VALUE) |
||||
|
Result<BehaviorResultDto> getBehaviorCodeInfo(@PathVariable String behaviorCode); |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.feign.fallback; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.dto.*; |
||||
|
import com.elink.esua.epdc.pointcommons.tools.feign.PointsCommonFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @author songyunpeng |
||||
|
* @date 2020/4/28 9:30 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class PointsCommonFeignClientFallback implements PointsCommonFeignClient { |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Result<BehaviorResultDto> getBehaviorCodeInfo(String behaviorCode) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_POINTS_SERVER, "getBehaviorCodeInfo", behaviorCode); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.rocketmq.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 用户行为DTO |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @Date 20-04-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class BehaviorDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 5458618984429715932L; |
||||
|
|
||||
|
/** |
||||
|
* 用户行为 |
||||
|
*/ |
||||
|
private String behavior; |
||||
|
|
||||
|
/** |
||||
|
* 业务ID |
||||
|
*/ |
||||
|
private String referenceId; |
||||
|
|
||||
|
/** |
||||
|
* 其他业务ID |
||||
|
*/ |
||||
|
private String otherReferenceId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 其他标识 |
||||
|
*/ |
||||
|
private String ortherFlag; |
||||
|
|
||||
|
/** |
||||
|
* 操作时间 |
||||
|
*/ |
||||
|
private Date operationTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
package com.elink.esua.epdc.pointcommons.tools.rocketmq.producer; |
||||
|
|
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.rocketmq.client.producer.SendResult; |
||||
|
import org.apache.rocketmq.common.message.Message; |
||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 积分埋点-发送MQ消息 |
||||
|
* |
||||
|
* @Author:songyunpeng |
||||
|
* @Date:2020/4/28 16:14 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
public class PointsProducer { |
||||
|
|
||||
|
@Autowired |
||||
|
private RocketMQTemplate rocketMQTemplate; |
||||
|
|
||||
|
/** |
||||
|
* 发送消息 |
||||
|
* |
||||
|
* @return void |
||||
|
* @params [topic, tag, keys, body] |
||||
|
* @author liuchuang |
||||
|
* @since 2020/3/6 21:09 |
||||
|
*/ |
||||
|
public void sendMessage(String topic, String tag, String keys, String body) { |
||||
|
Message message = new Message(topic, tag, keys, body.getBytes()); |
||||
|
try { |
||||
|
SendResult sendResult = rocketMQTemplate.getProducer().send(message); |
||||
|
log.info("积分埋点发送消息结果:{sendStatus:{}, topic:{}, msgId:{}}", sendResult.getSendStatus(), topic, sendResult.getMsgId()); |
||||
|
} catch (Exception e) { |
||||
|
log.error("积分埋点发送消息异常:{topic:{}, tag:{}, keys:{}, body:{}}", topic, tag, keys, body); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.commons.tools.constant; |
||||
|
|
||||
|
/** |
||||
|
* redis前缀常量 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @date 20-04-28 |
||||
|
*/ |
||||
|
public interface RedisConstant { |
||||
|
/** |
||||
|
* 行为编码前缀 |
||||
|
*/ |
||||
|
String BEHAVIOR_CODE = "epdc:config:behavior:"; |
||||
|
} |
@ -0,0 +1,302 @@ |
|||||
|
package com.elink.esua.epdc.commons.tools.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
|
||||
|
/** |
||||
|
* 积分埋点枚举 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @Date 20-04-28 |
||||
|
*/ |
||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT) |
||||
|
public enum BehaviorEnum { |
||||
|
|
||||
|
/** |
||||
|
* 完善居民信息 |
||||
|
*/ |
||||
|
PERFECT_RESIDENT_INFO("perfect_resident_info"), |
||||
|
|
||||
|
/** |
||||
|
* 完善党员信息 |
||||
|
*/ |
||||
|
PERFECT_PARTY_INFO("perfect_party_info"), |
||||
|
|
||||
|
/** |
||||
|
* 完善企业信息 |
||||
|
*/ |
||||
|
PERFECT_ENTERPRISE_INFO("perfect_enterprise_info"), |
||||
|
|
||||
|
/** |
||||
|
* 居民审核通过 |
||||
|
*/ |
||||
|
RESIDENT_AUDIT_PASS("resident_audit_pass"), |
||||
|
/** |
||||
|
* 居民审核不通过 |
||||
|
*/ |
||||
|
RESIDENT_AUDIT_NO_PASS("resident_audit_no_pass"), |
||||
|
|
||||
|
/** |
||||
|
* 新闻浏览 |
||||
|
*/ |
||||
|
NEWS_BROWSE("news_browse"), |
||||
|
/** |
||||
|
* 新闻点赞 |
||||
|
*/ |
||||
|
NEWS_SUPPORT("news_support"), |
||||
|
|
||||
|
/** |
||||
|
* 新闻点踩 |
||||
|
*/ |
||||
|
NEWS_OPPOSITION("news_opposition"), |
||||
|
|
||||
|
/** |
||||
|
* 新闻分享 |
||||
|
*/ |
||||
|
NEWS_SHARE("news_share"), |
||||
|
|
||||
|
/** |
||||
|
* 发布议题 |
||||
|
*/ |
||||
|
ISSUE_PUBLISH("issue_publish"), |
||||
|
|
||||
|
/** |
||||
|
* 发布的议题审核通过 |
||||
|
*/ |
||||
|
ISSUE_AUDIT_PASS("issue_audit_pass"), |
||||
|
|
||||
|
/** |
||||
|
* 发布的议题审核不通过 |
||||
|
*/ |
||||
|
ISSUE_AUDIT_FAILED("issue_audit_failed"), |
||||
|
|
||||
|
/** |
||||
|
* 议题点赞 |
||||
|
*/ |
||||
|
ISSUE_SUPPORT("issue_support"), |
||||
|
|
||||
|
/** |
||||
|
* 议题点踩 |
||||
|
*/ |
||||
|
ISSUE_OPPOSITION("issue_opposition"), |
||||
|
|
||||
|
/** |
||||
|
* 议题评论 |
||||
|
*/ |
||||
|
ISSUE_COMMENT("issue_comment"), |
||||
|
|
||||
|
/** |
||||
|
* 议题评论的回复 |
||||
|
*/ |
||||
|
ISSUE_COMMENT_REPLY("issue_comment_reply"), |
||||
|
|
||||
|
/** |
||||
|
* 议题评论的点赞 |
||||
|
*/ |
||||
|
ISSUE_COMMENT_SUPPORT("issue_comment_support"), |
||||
|
|
||||
|
/** |
||||
|
* 议题评论的点踩 |
||||
|
*/ |
||||
|
ISSUE_COMMENT_OPPOSITION("issue_comment_opposition"), |
||||
|
|
||||
|
/** |
||||
|
* 议题浏览 |
||||
|
*/ |
||||
|
ISSUE_BROWSE("issue_browse"), |
||||
|
|
||||
|
/** |
||||
|
* 议题分享 |
||||
|
*/ |
||||
|
ISSUE_SHARE("issue_share"), |
||||
|
/** |
||||
|
* 议题转成项目 |
||||
|
*/ |
||||
|
ISSUE_TO_PROJECT("issue_to_project"), |
||||
|
/** |
||||
|
* 议题回应 |
||||
|
*/ |
||||
|
ISSUE_RESPONSE("issue_response"), |
||||
|
/** |
||||
|
* 议题关闭 |
||||
|
*/ |
||||
|
ISSUE_CLOSE("issue_close"), |
||||
|
|
||||
|
/** |
||||
|
* 项目的回应 |
||||
|
*/ |
||||
|
PROJECT_RESPONSE("project_response"), |
||||
|
|
||||
|
/** |
||||
|
* 项目的关闭 |
||||
|
*/ |
||||
|
PROJECT_CLOSE("project_close"), |
||||
|
|
||||
|
/** |
||||
|
* 项目的吹哨 |
||||
|
*/ |
||||
|
PROJECT_WHISTLE("project_whistle"), |
||||
|
|
||||
|
/** |
||||
|
* 项目的结案 |
||||
|
*/ |
||||
|
PROJECT_CLOSE_CASE("project_close_case"), |
||||
|
|
||||
|
/** |
||||
|
* 项目的点赞 |
||||
|
*/ |
||||
|
PROJECT_SUPPORT("project_support"), |
||||
|
/** |
||||
|
* 项目的点踩 |
||||
|
*/ |
||||
|
PROJECT_OPPOSITION("project_opposition"), |
||||
|
/** |
||||
|
* 项目评论 |
||||
|
*/ |
||||
|
PROJECT_COMMENT("project_comment"), |
||||
|
/** |
||||
|
* 项目评论的回复 |
||||
|
*/ |
||||
|
PROJECT_COMMENT_REPLY("project_comment_reply"), |
||||
|
/** |
||||
|
* 项目评论的点赞 |
||||
|
*/ |
||||
|
PROJECT_COMMENT_SUPPORT("project_comment_support"), |
||||
|
|
||||
|
/** |
||||
|
* 项目评论的点踩 |
||||
|
*/ |
||||
|
PROJECT_COMMENT_OPPOSITION("project_comment_opposition"), |
||||
|
/** |
||||
|
* 项目浏览 |
||||
|
*/ |
||||
|
PROJECT_BROWSE("project_browse"), |
||||
|
/** |
||||
|
* 项目分享 |
||||
|
*/ |
||||
|
PROJECT_SHARE("project_share"), |
||||
|
/** |
||||
|
* 项目满意度评价 |
||||
|
*/ |
||||
|
PROJECT_EVALUATION("project_evaluation"), |
||||
|
/** |
||||
|
* 创建社群 |
||||
|
*/ |
||||
|
GROUP_CREATE_APPLICATION("group_create_application"), |
||||
|
/** |
||||
|
* 申请加入社群 |
||||
|
*/ |
||||
|
GROUP_JOIN_APPLICATION("group_join_application"), |
||||
|
/** |
||||
|
* 同意加入社群 |
||||
|
*/ |
||||
|
GROUP_JOIN_SUCCESS("group_join_success"), |
||||
|
/** |
||||
|
* 不同意加入社群 |
||||
|
*/ |
||||
|
GROUP_JOIN_FAIL("group_join_fail"), |
||||
|
/** |
||||
|
* 同意创建社群 |
||||
|
*/ |
||||
|
GROUP_CREATE_SUCCESS("group_create_success"), |
||||
|
/** |
||||
|
* 不同意创建社群 |
||||
|
*/ |
||||
|
GROUP_APPLICATION_FAIL("group_application_fail"), |
||||
|
/** |
||||
|
* 修改社群信息 |
||||
|
*/ |
||||
|
GROUP_MODIFY_INFO("group_modify_info"), |
||||
|
/** |
||||
|
* 解散群 |
||||
|
*/ |
||||
|
GROUP_DISSOLUTION("group_dissolution"), |
||||
|
/** |
||||
|
* 邀请好友 |
||||
|
*/ |
||||
|
GROUP_INVITATION("group_invitation"), |
||||
|
/** |
||||
|
* 发布话题 |
||||
|
*/ |
||||
|
GROUP_TOPIC_PUBLISH("group_topic_publish"), |
||||
|
/** |
||||
|
* 话题转为议题 |
||||
|
*/ |
||||
|
GROUP_TOPIC_TO_EVENTS("group_topic_to_events"), |
||||
|
/** |
||||
|
* 话题点赞 |
||||
|
*/ |
||||
|
GROUP_TOPIC_SUPPORT("group_topic_support"), |
||||
|
/** |
||||
|
* 话题点踩 |
||||
|
*/ |
||||
|
GROUP_TOPIC_OPPOSITION("group_topic_opposition"), |
||||
|
/** |
||||
|
* 话题评论 |
||||
|
*/ |
||||
|
GROUP_COMMENT("group_comment"), |
||||
|
/** |
||||
|
* 话题评论的回复 |
||||
|
*/ |
||||
|
GROUP_COMMENT_REPLY("group_comment_reply"), |
||||
|
/** |
||||
|
* 话题评论的点赞 |
||||
|
*/ |
||||
|
GROUP_TOPIC_COMMENT_SUPPORT("group_topic_comment_support"), |
||||
|
|
||||
|
/** |
||||
|
* 话题评论的点踩 |
||||
|
*/ |
||||
|
GROUP_TOPIC_COMMENT_OPPOSITION("group_topic_comment_opposition"), |
||||
|
|
||||
|
/** |
||||
|
* 话题浏览 |
||||
|
*/ |
||||
|
GROUP_BROWSE("group_browse"), |
||||
|
/** |
||||
|
* 用户进入社群 |
||||
|
*/ |
||||
|
GROUP_OPEN("group_open"), |
||||
|
/** |
||||
|
* 爽约 |
||||
|
*/ |
||||
|
BREAK_PROMISE("break_promise"), |
||||
|
/** |
||||
|
* 手动调整志愿者积分 |
||||
|
*/ |
||||
|
HAND_REGULATION_BEHAVIOR("hand_regulation_behavior"), |
||||
|
|
||||
|
/** |
||||
|
* 活动积分 |
||||
|
*/ |
||||
|
JOIN_ACT("join_act"), |
||||
|
|
||||
|
/** |
||||
|
* 签到 |
||||
|
*/ |
||||
|
USER_SIGN("user_sign"), |
||||
|
/** |
||||
|
* 连续签到 |
||||
|
*/ |
||||
|
USER_CONSEQUENT_SIGN("user_consequent_sign"), |
||||
|
/** |
||||
|
* 通知浏览 |
||||
|
*/ |
||||
|
NOTICE_BROWSE("notice_browse"), |
||||
|
/** |
||||
|
* 志愿者完善信息 |
||||
|
*/ |
||||
|
VOLUNTEER_PERFECT_INFO("volunteer_perfect_info"); |
||||
|
|
||||
|
|
||||
|
private String value; |
||||
|
|
||||
|
BehaviorEnum(final String value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return this.value; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue