diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsLimitTimeEnum.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsLimitTimeEnum.java
new file mode 100644
index 000000000..a3092ed46
--- /dev/null
+++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsLimitTimeEnum.java
@@ -0,0 +1,27 @@
+package com.elink.esua.epdc.commons.tools.enums.pointsenum;
+
+/**
+ * @Auther: yinzuomei
+ * @Date: 2019/12/13 09:43
+ * @Description: 积分规则限制时限枚举类
+ */
+public enum PointsLimitTimeEnum {
+ /**
+ * 限制时限(0-分钟,1-小时,2-日,3-月,4-年)
+ */
+ LIMIT_TIME_MINUTE("0"),
+ LIMIT_TIME_HOUR("1"),
+ LIMIT_TIME_DAY("2"),
+ LIMIT_TIME_MONTH("3"),
+ LIMIT_TIME_YEAR("4");
+
+ private String value;
+
+ PointsLimitTimeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
+ }
+}
diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsOperationEnum.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsOperationEnum.java
new file mode 100644
index 000000000..6aa3fa9e3
--- /dev/null
+++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsOperationEnum.java
@@ -0,0 +1,24 @@
+package com.elink.esua.epdc.commons.tools.enums.pointsenum;
+
+/**
+ * @Auther: yinzuomei
+ * @Date: 2019/12/13 09:31
+ * @Description: 积分操作类型枚举类
+ */
+public enum PointsOperationEnum {
+ /**
+ * 规则操作类型(0-减积分,1-加积分)
+ */
+ OPERATION_TYPE_ADD("1"),
+ OPERATION_TYPE_SUBSTRACT("0");
+
+ private String operationType;
+
+ PointsOperationEnum(String operationType) {
+ this.operationType = operationType;
+ }
+
+ public String getOperationType() {
+ return operationType;
+ }
+}
diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsOperationModeEnum.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsOperationModeEnum.java
new file mode 100644
index 000000000..c486cfb7a
--- /dev/null
+++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsOperationModeEnum.java
@@ -0,0 +1,34 @@
+package com.elink.esua.epdc.commons.tools.enums.pointsenum;
+
+/**
+ * @Auther: yinzuomei
+ * @Date: 2019/12/13 09:33
+ * @Description: 积分操作方式枚举类
+ */
+public enum PointsOperationModeEnum {
+
+ /**
+ * user-用户操作
+ */
+ OPERATION_MODE_USER("user"),
+
+ /**
+ * admin-管理员操作
+ */
+ OPERATION_MODE_ADMIN("admin"),
+
+ /**
+ * sys-系统操作
+ */
+ OPERATION_MODE_SYS("sys");
+
+ private String operationMode;
+
+ PointsOperationModeEnum(String operationMode) {
+ this.operationMode = operationMode;
+ }
+
+ public String getOperationMode() {
+ return operationMode;
+ }
+}
diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsRuleAvailableEnum.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsRuleAvailableEnum.java
new file mode 100644
index 000000000..0ed15d169
--- /dev/null
+++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsRuleAvailableEnum.java
@@ -0,0 +1,26 @@
+package com.elink.esua.epdc.commons.tools.enums.pointsenum;
+
+/**
+ * @Auther: yinzuomei
+ * @Date: 2019/12/12 15:04
+ * @Description: 积分规则可用标志枚举类
+ */
+public enum PointsRuleAvailableEnum {
+
+
+ /**
+ * 可用标记(0-不可用,1-可用)
+ */
+ AVAILABLE_TRUE("1"),
+ AVAILABLE_FALSE("0");
+
+ private String value;
+
+ PointsRuleAvailableEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
+ }
+}
diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsUpperLimitEnum.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsUpperLimitEnum.java
new file mode 100644
index 000000000..d65c768a1
--- /dev/null
+++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/pointsenum/PointsUpperLimitEnum.java
@@ -0,0 +1,28 @@
+package com.elink.esua.epdc.commons.tools.enums.pointsenum;
+
+/**
+ * @Auther: yinzuomei
+ * @Date: 2019/12/13 09:48
+ * @Description: 积分是否有上限限制 枚举类
+ */
+public enum PointsUpperLimitEnum {
+ /**
+ * 是
+ */
+ YES("1"),
+
+ /**
+ * 否
+ */
+ NO("0");
+
+ private String value;
+
+ PointsUpperLimitEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
+ }
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/logs/PointsLogsDTO.java b/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/logs/PointsLogsDTO.java
new file mode 100644
index 000000000..d24b29e8b
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/logs/PointsLogsDTO.java
@@ -0,0 +1,121 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.dto.logs;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@Data
+public class PointsLogsDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ private String id;
+
+ /**
+ * 志愿者ID
+ */
+ private String volunteerId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 积分操作类型(0-减积分,1-加积分)
+ */
+ private String operationType;
+
+ /**
+ * 操作积分值
+ */
+ private Integer points;
+
+ /**
+ * 操作描述
+ */
+ private String operationDesc;
+
+ /**
+ * 操作时间
+ */
+ private Date operationTime;
+
+ /**
+ * 操作方式(user-用户操作,admin-管理员操作,sys-系统操作)
+ */
+ private String operationMode;
+
+ /**
+ * 积分规则编码
+ */
+ private String ruleCode;
+
+ /**
+ * 是否操作成功(0-失败,1-成功)
+ */
+ private String status;
+
+ /**
+ * 操作失败原因
+ */
+ private String failureReason;
+
+ /**
+ * 删除标记
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/logs/UserPointsLogDTO.java b/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/logs/UserPointsLogDTO.java
new file mode 100644
index 000000000..4134f3d43
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/logs/UserPointsLogDTO.java
@@ -0,0 +1,46 @@
+package com.elink.esua.epdc.dto.logs;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Description @PointsBehavior 入参DTO
+ * @Author yinzuomei
+ * @Date 2019/12/13 10:11
+ */
+@Data
+public class UserPointsLogDTO implements Serializable {
+ private static final long serialVersionUID = -4809148536169854292L;
+
+ /**
+ * 积分操作类型(加积分、减积分)
+ */
+ @NotBlank(message = "积分操作类型不能为空")
+ private String operationType;
+
+ /**
+ * 积分操作方式(user-用户操作,admin-管理员操作,sys-系统操作)
+ */
+ @NotBlank(message = "积分操作方式不能为空")
+ private String operationMode;
+
+ /**
+ * VOLUNTEER_ID 志愿者ID
+ */
+ @NotBlank(message = "志愿者id不能为空")
+ private String volunteerId;
+
+ /**
+ * 用户ID
+ */
+ @NotBlank(message = "用户id不能为空")
+ private String userId;
+
+ /**
+ * 规则编码
+ */
+ @NotBlank(message = "规则编码不能为空")
+ private String ruleCode;
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/enums/PointsRuleEnum.java b/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/enums/PointsRuleEnum.java
deleted file mode 100644
index d1af4767e..000000000
--- a/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/enums/PointsRuleEnum.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.elink.esua.epdc.enums;
-
-/**
- * @Auther: yinzuomei
- * @Date: 2019/12/12 15:04
- * @Description: 积分规则表枚举类
- */
-public enum PointsRuleEnum {
- /**
- * 规则操作类型(0-减积分,1-加积分)
- */
- OPERATION_TYPE_ADD("1"),
- OPERATION_TYPE_SUBSTRACT("0"),
-
- /**
- * 可用标记(0-不可用,1-可用)
- */
- AVAILABLE_TRUE("1"),
- AVAILABLE_FALSE("0"),
-
- /**
- * 积分是否有上限限制(0-否,1-是)
- */
- UPPER_LIMIT_FLAG_TRUE("1"),
- UPPER_LIMIT_FLAG_FALSE("0"),
- /**
- * 限制时限(0-分钟,1-小时,2-日,3-月,4-年)
- */
- LIMIT_TIME_MINUTE("0"),
- LIMIT_TIME_HOUR("1"),
- LIMIT_TIME_DAY("2"),
- LIMIT_TIME_MONTH("3"),
- LIMIT_TIME_YEAR("4");
-
- private String value;
-
- PointsRuleEnum(String value) {
- this.value = value;
- }
-
- public String value() {
- return value;
- }
-}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml b/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml
index b2d5dc3ab..f42162d44 100644
--- a/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml
@@ -50,6 +50,12 @@
org.springframework.cloud
spring-cloud-starter-zipkin
+
+ com.esua.epdc
+ epdc-user-client
+ 1.0.0
+ compile
+
@@ -121,7 +127,7 @@
elink@888
-
+
root
shibei@888
@@ -146,7 +152,7 @@
elink@888
-
+
epdc
elink888
@@ -171,7 +177,7 @@
elink@888
-
+
epdc
elink888
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/feign/UserFeignClient.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/feign/UserFeignClient.java
new file mode 100644
index 000000000..cb88cb305
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/feign/UserFeignClient.java
@@ -0,0 +1,29 @@
+package com.elink.esua.epdc.modules.feign;
+
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO;
+import com.elink.esua.epdc.modules.feign.fallback.UserFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @Description 用户模块
+ * @Author yinzuomei
+ * @Date 2019/12/13 10:00
+ */
+@FeignClient(name = ServiceConstant.EPDC_USER_SERVER, fallback = UserFeignClientFallback.class,url = "http://127.0.0.1:9068")
+public interface UserFeignClient {
+
+ /**
+ * @param formDTO
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据操作类型更新用户积分
+ * @Date 2019/12/13 15:12
+ **/
+ @PostMapping(value = "app-user/user/handleUserPoints", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result handleUserPoints(EpdcUserPointsFormDTO formDTO);
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/feign/fallback/UserFeignClientFallback.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/feign/fallback/UserFeignClientFallback.java
new file mode 100644
index 000000000..9ba719306
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/feign/fallback/UserFeignClientFallback.java
@@ -0,0 +1,22 @@
+package com.elink.esua.epdc.modules.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.dto.epdc.form.EpdcUserPointsFormDTO;
+import com.elink.esua.epdc.modules.feign.UserFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2019/12/13 10:00
+ */
+@Component
+public class UserFeignClientFallback implements UserFeignClient {
+
+ @Override
+ public Result handleUserPoints(EpdcUserPointsFormDTO formDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "handleUserPoints", formDTO);
+ }
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/controller/PointsLogsController.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/controller/PointsLogsController.java
new file mode 100644
index 000000000..2fb5c83ec
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/controller/PointsLogsController.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
+import com.elink.esua.epdc.modules.logs.excel.PointsLogsExcel;
+import com.elink.esua.epdc.modules.logs.service.PointsLogsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@RestController
+@RequestMapping("pointslogs")
+public class PointsLogsController {
+
+ @Autowired
+ private PointsLogsService pointsLogsService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = pointsLogsService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ PointsLogsDTO data = pointsLogsService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody PointsLogsDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ return pointsLogsService.save(dto);
+ }
+
+ @PutMapping
+ public Result update(@RequestBody PointsLogsDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ pointsLogsService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ pointsLogsService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = pointsLogsService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, PointsLogsExcel.class);
+ }
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/dao/PointsLogsDao.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/dao/PointsLogsDao.java
new file mode 100644
index 000000000..5d9945a62
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/dao/PointsLogsDao.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.modules.logs.entity.PointsLogsEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@Mapper
+public interface PointsLogsDao extends BaseDao {
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/entity/PointsLogsEntity.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/entity/PointsLogsEntity.java
new file mode 100644
index 000000000..b412d678d
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/entity/PointsLogsEntity.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("epdc_points_logs")
+public class PointsLogsEntity extends BaseEpdcEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 志愿者ID
+ */
+ private String volunteerId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 积分操作类型(0-减积分,1-加积分)
+ */
+ private String operationType;
+
+ /**
+ * 操作积分值
+ */
+ private Integer points;
+
+ /**
+ * 操作描述
+ */
+ private String operationDesc;
+
+ /**
+ * 操作时间
+ */
+ private Date operationTime;
+
+ /**
+ * 操作方式(user-用户操作,admin-管理员操作,sys-系统操作)
+ */
+ private String operationMode;
+
+ /**
+ * 积分规则编码
+ */
+ private String ruleCode;
+
+ /**
+ * 是否操作成功(0-失败,1-成功)
+ */
+ private String status;
+
+ /**
+ * 操作失败原因
+ */
+ private String failureReason;
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/excel/PointsLogsExcel.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/excel/PointsLogsExcel.java
new file mode 100644
index 000000000..4377620d9
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/excel/PointsLogsExcel.java
@@ -0,0 +1,86 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@Data
+public class PointsLogsExcel {
+
+ @Excel(name = "主键")
+ private String id;
+
+ @Excel(name = "志愿者ID")
+ private String volunteerId;
+
+ @Excel(name = "用户ID")
+ private String userId;
+
+ @Excel(name = "积分操作类型(0-减积分,1-加积分)")
+ private String operationType;
+
+ @Excel(name = "操作积分值")
+ private Integer points;
+
+ @Excel(name = "操作描述")
+ private String operationDesc;
+
+ @Excel(name = "操作时间")
+ private Date operationTime;
+
+ @Excel(name = "操作方式(user-用户操作,admin-管理员操作,sys-系统操作)")
+ private String operationMode;
+
+ @Excel(name = "积分规则编码")
+ private String ruleCode;
+
+ @Excel(name = "是否操作成功(0-失败,1-成功)")
+ private String status;
+
+ @Excel(name = "操作失败原因")
+ private String failureReason;
+
+ @Excel(name = "删除标记")
+ private String delFlag;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "创建人")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新人")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/redis/PointsLogsRedis.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/redis/PointsLogsRedis.java
new file mode 100644
index 000000000..81776df7a
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/redis/PointsLogsRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.redis;
+
+import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@Component
+public class PointsLogsRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/service/PointsLogsService.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/service/PointsLogsService.java
new file mode 100644
index 000000000..4ce070998
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/service/PointsLogsService.java
@@ -0,0 +1,96 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.service;
+
+import com.elink.esua.epdc.commons.mybatis.service.BaseService;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
+import com.elink.esua.epdc.modules.logs.entity.PointsLogsEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+public interface PointsLogsService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2019-12-13
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2019-12-13
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return PointsLogsDTO
+ * @author generator
+ * @date 2019-12-13
+ */
+ PointsLogsDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2019-12-13
+ */
+ Result save(PointsLogsDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2019-12-13
+ */
+ void update(PointsLogsDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2019-12-13
+ */
+ void delete(String[] ids);
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/service/impl/PointsLogsServiceImpl.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/service/impl/PointsLogsServiceImpl.java
new file mode 100644
index 000000000..2b301eb5d
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/logs/service/impl/PointsLogsServiceImpl.java
@@ -0,0 +1,106 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.logs.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
+import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
+import com.elink.esua.epdc.modules.logs.dao.PointsLogsDao;
+import com.elink.esua.epdc.modules.logs.entity.PointsLogsEntity;
+import com.elink.esua.epdc.modules.logs.redis.PointsLogsRedis;
+import com.elink.esua.epdc.modules.logs.service.PointsLogsService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分日志表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-12-13
+ */
+@Service
+public class PointsLogsServiceImpl extends BaseServiceImpl implements PointsLogsService {
+
+ @Autowired
+ private PointsLogsRedis pointsLogsRedis;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, PointsLogsDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, PointsLogsDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public PointsLogsDTO get(String id) {
+ PointsLogsEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, PointsLogsDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result save(PointsLogsDTO dto) {
+ PointsLogsEntity entity = ConvertUtils.sourceToTarget(dto, PointsLogsEntity.class);
+ insert(entity);
+ return new Result();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(PointsLogsDTO dto) {
+ PointsLogsEntity entity = ConvertUtils.sourceToTarget(dto, PointsLogsEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java
index e96653822..1bbfcdf8a 100644
--- a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java
@@ -22,13 +22,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
+import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsRuleAvailableEnum;
+import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsUpperLimitEnum;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.redis.RedisKeys;
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.dto.rule.PointsRuleDTO;
-import com.elink.esua.epdc.enums.PointsRuleEnum;
import com.elink.esua.epdc.modules.rule.dao.PointsRuleDao;
import com.elink.esua.epdc.modules.rule.entity.PointsRuleEntity;
import com.elink.esua.epdc.modules.rule.redis.PointsRuleRedis;
@@ -116,7 +117,7 @@ public class PointsRuleServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>();
- wrapper.eq("AVAILABLE", PointsRuleEnum.AVAILABLE_TRUE.value());
+ wrapper.eq("AVAILABLE", PointsRuleAvailableEnum.AVAILABLE_TRUE.value());
List pointsRuleEntityList = baseDao.selectList(wrapper);
for (PointsRuleEntity pointsRuleEntity : pointsRuleEntityList) {
String pointsRuleKey = RedisKeys.getPointsRuleKey(pointsRuleEntity.getRuleCode());
@@ -210,7 +211,7 @@ public class PointsRuleServiceImpl extends BaseServiceImpl dto.getUpperLimitVal()) {
return new Result().error("积分值不能大于上限值");
}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/support/annotion/PointsBehavior.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/support/annotion/PointsBehavior.java
new file mode 100644
index 000000000..e223d5e6e
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/support/annotion/PointsBehavior.java
@@ -0,0 +1,42 @@
+package com.elink.esua.epdc.support.annotion;
+
+import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsOperationEnum;
+import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsOperationModeEnum;
+
+import java.lang.annotation.*;
+
+/**
+ * @Auther: yinzuomei
+ * @Date: 2019/12/13 09:15
+ * @Description: 爱心互助积分注解
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+@Documented
+public @interface PointsBehavior {
+ /**
+ * 积分操作类型(加积分、减积分)
+ */
+ PointsOperationEnum operationType();
+
+ /**
+ * 积分操作方式(user-用户操作,admin-管理员操作,sys-系统操作)
+ */
+ PointsOperationModeEnum operationMode();
+
+ /**
+ * 志愿者ID
+ */
+ String volunteerId() default "";
+
+ /**
+ * 用户ID
+ */
+ String userId() default "";
+
+ /**
+ * 规则编码
+ */
+ String ruleCode() default "";
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/support/aop/PointsBehaviorAop.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/support/aop/PointsBehaviorAop.java
new file mode 100644
index 000000000..0ecdad1c2
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/support/aop/PointsBehaviorAop.java
@@ -0,0 +1,209 @@
+package com.elink.esua.epdc.support.aop;
+
+import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO;
+import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
+import com.elink.esua.epdc.dto.logs.UserPointsLogDTO;
+import com.elink.esua.epdc.dto.rule.PointsRuleDTO;
+import com.elink.esua.epdc.modules.feign.UserFeignClient;
+import com.elink.esua.epdc.modules.logs.service.PointsLogsService;
+import com.elink.esua.epdc.modules.rule.service.PointsRuleService;
+import com.elink.esua.epdc.support.annotion.PointsBehavior;
+import io.seata.spring.annotation.GlobalTransactional;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+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 org.springframework.transaction.annotation.Transactional;
+
+import java.lang.reflect.Method;
+import java.util.Date;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2019/12/13 10:00
+ */
+@Aspect
+@Component
+public class PointsBehaviorAop {
+ private final Logger logger = LogManager.getLogger(getClass());
+ @Autowired
+ private PointsLogsService pointsLogsService;
+
+ @Autowired
+ private PointsRuleService pointsRuleService;
+
+ @Autowired
+ private UserFeignClient userFeignClient;
+
+ @Pointcut("@annotation(com.elink.esua.epdc.support.annotion.PointsBehavior)")
+ public void recordUserPointsBehavior() {
+ }
+
+ @AfterReturning("recordUserPointsBehavior()")
+ public void handleUserPoints(JoinPoint joinPoint) throws Exception {
+ logger.info("handleUserPoints start");
+ MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+ Method method = signature.getMethod();
+ PointsBehavior pointsBehavior = method.getAnnotation(PointsBehavior.class);
+ Object[] args = joinPoint.getArgs();
+ String[] argNames = ((MethodSignature) joinPoint.getSignature()).getParameterNames();
+ //解析入参
+ UserPointsLogDTO userPointsLogDTO = this.packageUserPointsLogDTO(pointsBehavior, args, argNames);
+ //校验入参属性都不能为空
+ ValidatorUtils.validateEntity(userPointsLogDTO);
+ Result result = this.updateUserPoints(userPointsLogDTO);
+ if (!result.success()) {
+ throw new Exception("更新用户积分异常" + result.getMsg());
+ }
+ }
+
+ /**
+ * @param userPointsLogDTO
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description
+ * @Date 2019/12/13 15:17
+ **/
+ private Result updateUserPoints(UserPointsLogDTO userPointsLogDTO) {
+ //logger.info("解析后的UserPointsLogDTO:" + JSONObject.toJSONString(userPointsLogDTO));
+ //插入积分日志
+ PointsLogsDTO pointsLogDto = ConvertUtils.sourceToTarget(userPointsLogDTO, PointsLogsDTO.class);
+ Result pointsRuleDTOResult = pointsRuleService.getPointRule(pointsLogDto.getRuleCode());
+ pointsLogDto.setOperationDesc(pointsRuleDTOResult.getData().getBehaviorDesc());
+ pointsLogDto.setPoints(pointsRuleDTOResult.getData().getPoints());
+ pointsLogDto.setOperationTime(new Date());
+ pointsLogDto.setStatus(YesOrNoEnum.YES.value());//是否操作成功(0-失败,1-成功)
+ Result result = pointsLogsService.save(pointsLogDto);
+ if (!result.success()) {
+ return result;
+ }
+ //修改用户总积分数
+ EpdcUserPointsFormDTO formDTO = new EpdcUserPointsFormDTO();
+ formDTO.setOperationType(userPointsLogDTO.getOperationType());
+ formDTO.setPoints(pointsRuleDTOResult.getData().getPoints());
+ formDTO.setUserId(userPointsLogDTO.getUserId());
+ Result res = userFeignClient.handleUserPoints(formDTO);
+ return res;
+ }
+
+ /**
+ * @param pointsBehavior
+ * @param args
+ * @param argNames
+ * @return com.elink.esua.epdc.dto.logs.UserPointsLogDTO
+ * @Author yinzuomei
+ * @Description
+ * @Date 2019/12/13 10:29
+ **/
+ private UserPointsLogDTO packageUserPointsLogDTO(PointsBehavior pointsBehavior,
+ Object[] args,
+ String[] argNames) {
+ logger.info("packageUserPointsLogDTO start");
+ UserPointsLogDTO userPointsLogDTO = new UserPointsLogDTO();
+ userPointsLogDTO.setOperationMode(pointsBehavior.operationMode().getOperationMode());
+ userPointsLogDTO.setOperationType(pointsBehavior.operationType().getOperationType());
+ //志愿者ID
+ String volunteerIdKey = pointsBehavior.volunteerId();
+ //用户ID
+ String userIdKey = pointsBehavior.userId();
+ //规则编码
+ String ruleCodeKey = pointsBehavior.ruleCode();
+ if (volunteerIdKey.startsWith("#") && userIdKey.startsWith("#") && ruleCodeKey.startsWith("#")) {
+ String volunteerId = "";
+ String userId = "";
+ String ruleCode = "";
+
+ //解析志愿者id
+ String volunteerIdExpression = volunteerIdKey.substring(2, volunteerIdKey.length() - 1);
+ String[] volunteerIdStrArr = volunteerIdExpression.split("\\.");
+ if (volunteerIdStrArr.length > 2 || volunteerIdStrArr.length == 0) {
+ throw new RuntimeException("记录用户积分注解中volunteerId格式不正确");
+ }
+ if (volunteerIdStrArr.length == 1) {
+ for (int i = 0; i < argNames.length; i++) {
+ if (argNames[i].equals(volunteerIdStrArr[0])) {
+ volunteerId = String.valueOf(args[i]);
+ }
+ }
+ } else if (volunteerIdStrArr.length == 2) {
+ for (int i = 0; i < argNames.length; i++) {
+ if (argNames[i].equals(volunteerIdStrArr[0])) {
+ Object obj = args[i];
+ try {
+ Method method = obj.getClass().getDeclaredMethod(volunteerIdStrArr[1]);
+ volunteerId = String.valueOf(method.invoke(obj));
+ } catch (Exception e) {
+ throw new RuntimeException("记录用户积分注解中volunteerId反射失败");
+ }
+ }
+ }
+ }
+ //解析ruleCode
+ String ruleCodeExpression = ruleCodeKey.substring(2, ruleCodeKey.length() - 1);
+ String[] ruleCodeStrArr = ruleCodeExpression.split("\\.");
+ if (ruleCodeStrArr.length > 2 || ruleCodeStrArr.length == 0) {
+ throw new RuntimeException("记录用户积分注解中ruleCode格式不正确");
+ }
+ if (ruleCodeStrArr.length == 1) {
+ for (int i = 0; i < argNames.length; i++) {
+ if (argNames[i].equals(ruleCodeStrArr[0])) {
+ ruleCode = String.valueOf(args[i]);
+ }
+ }
+ } else if (ruleCodeStrArr.length == 2) {
+ for (int i = 0; i < argNames.length; i++) {
+ if (argNames[i].equals(ruleCodeStrArr[0])) {
+ Object obj = args[i];
+ try {
+ Method method = obj.getClass().getDeclaredMethod(ruleCodeStrArr[1]);
+ ruleCode = String.valueOf(method.invoke(obj));
+ } catch (Exception e) {
+ throw new RuntimeException("记录用户积分注解中ruleCode反射失败");
+ }
+ }
+ }
+ }
+ //解析userId
+ String userIdExpression = userIdKey.substring(2, userIdKey.length() - 1);
+ String[] userIdStrArr = userIdExpression.split("\\.");
+ if (userIdStrArr.length > 2 || userIdStrArr.length == 0) {
+ throw new RuntimeException("记录用户积分注解中userId格式不正确");
+ }
+ if (userIdStrArr.length == 1) {
+ for (int i = 0; i < argNames.length; i++) {
+ if (argNames[i].equals(userIdStrArr[0])) {
+ userId = String.valueOf(args[i]);
+ }
+ }
+ } else if (userIdStrArr.length == 2) {
+ for (int i = 0; i < argNames.length; i++) {
+ if (argNames[i].equals(userIdStrArr[0])) {
+ Object obj = args[i];
+ try {
+ Method method = obj.getClass().getDeclaredMethod(userIdStrArr[1]);
+ userId = String.valueOf(method.invoke(obj));
+ } catch (Exception e) {
+ throw new RuntimeException("记录用户积分注解中userId反射失败");
+ }
+ }
+ }
+ }
+ userPointsLogDTO.setVolunteerId(volunteerId);
+ userPointsLogDTO.setUserId(userId);
+ userPointsLogDTO.setRuleCode(ruleCode);
+ }
+ return userPointsLogDTO;
+ }
+
+
+}
diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/logs/PointsLogsDao.xml b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/logs/PointsLogsDao.xml
new file mode 100644
index 000000000..283aee7ae
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/logs/PointsLogsDao.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserPointsFormDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserPointsFormDTO.java
new file mode 100644
index 000000000..264ddfcc0
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserPointsFormDTO.java
@@ -0,0 +1,29 @@
+package com.elink.esua.epdc.dto.epdc.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description 根据操作类型更新用户积分 入参DTO
+ * @Author yinzuomei
+ * @Date 2019/12/13 13:57
+ */
+@Data
+public class EpdcUserPointsFormDTO {
+ /**
+ * 积分操作类型(加积分、减积分)
+ */
+ @NotBlank(message = "积分操作类型不能为空")
+ private String operationType;
+
+ /**
+ * 用户ID
+ */
+ @NotBlank(message = "用户id不能为空")
+ private String userId;
+
+ @NotNull
+ private Integer points;
+}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserController.java
index 0a56c1aed..4d44d26b1 100644
--- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserController.java
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserController.java
@@ -27,6 +27,7 @@ import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.UserDTO;
+import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO;
import com.elink.esua.epdc.enums.AppUserStatesEnum;
import com.elink.esua.epdc.excel.UserExcel;
import com.elink.esua.epdc.service.UserService;
@@ -34,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@@ -129,4 +131,15 @@ public class UserController {
ExcelUtils.exportExcelToTarget(response, fileName, list, UserExcel.class);
}
+ /**
+ * @param formDTO
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据操作类型更新用户积分
+ * @Date 2019/12/13 15:01
+ **/
+ @PostMapping("handleUserPoints")
+ public Result handleUserPoints(@RequestBody @Valid EpdcUserPointsFormDTO formDTO) {
+ return userService.handleUserPoints(formDTO);
+ }
}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java
index 6185fc88e..d69b82210 100644
--- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java
@@ -258,4 +258,13 @@ public interface UserService extends BaseService {
* @Date 2019/12/7 13:58
**/
Result queryUserDto(EpdcAppQueryUserInfoFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据操作类型更新用户积分
+ * @Date 2019/12/13 15:10
+ **/
+ Result handleUserPoints(EpdcUserPointsFormDTO formDTO);
}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java
index adba69d00..906afd0dc 100644
--- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java
@@ -26,6 +26,7 @@ import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.enums.UserSexEnum;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
+import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsOperationEnum;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.redis.UserDetailRedis;
@@ -757,6 +758,26 @@ public class UserServiceImpl extends BaseServiceImpl implem
return new Result();
}
+ /**
+ * @param formDTO
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据操作类型更新用户积分
+ * @Date 2019/12/13 15:02
+ **/
+ @Override
+ public Result handleUserPoints(EpdcUserPointsFormDTO formDTO) {
+ UserEntity userEntity = baseDao.selectById(formDTO.getUserId());
+ //规则操作类型(0-减积分,1-加积分)
+ if (PointsOperationEnum.OPERATION_TYPE_ADD.getOperationType().equals(formDTO.getOperationType())) {
+ userEntity.setPoints(userEntity.getPoints() + formDTO.getPoints());
+ } else if (PointsOperationEnum.OPERATION_TYPE_SUBSTRACT.getOperationType().equals(formDTO.getOperationType())) {
+ userEntity.setPoints(userEntity.getPoints() - formDTO.getPoints());
+ }
+ baseDao.updateById(userEntity);
+ return new Result();
+ }
+
/**
* 根据微信信息查询用户
*