().ok(pointsRuleByBehaviorCode);
+ }
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsBehaviorController.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsBehaviorController.java
new file mode 100644
index 0000000..cf1080e
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsBehaviorController.java
@@ -0,0 +1,115 @@
+/**
+ * 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.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.UpdateGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.dto.PointsBehaviorDTO;
+import com.elink.esua.epdc.excel.PointsBehaviorExcel;
+import com.elink.esua.epdc.service.PointsBehaviorService;
+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 zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@RestController
+@RequestMapping("pointsbehavior")
+public class PointsBehaviorController {
+
+ @Autowired
+ private PointsBehaviorService pointsBehaviorService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = pointsBehaviorService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ PointsBehaviorDTO data = pointsBehaviorService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody PointsBehaviorDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ return pointsBehaviorService.save(dto);
+ }
+
+ @PutMapping
+ public Result update(@RequestBody PointsBehaviorDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ return pointsBehaviorService.update(dto);
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ return pointsBehaviorService.delete(ids);
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = pointsBehaviorService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, PointsBehaviorExcel.class);
+ }
+
+ /**
+ * @Description: 获取全部的动作编码
+ * @Param: []
+ * @return: com.elink.esua.epdc.commons.tools.utils.Result>
+ * @Author: zy
+ * @Date: 2020-04-29
+ */
+ @GetMapping("getBehaviorDesc")
+ public Result> getBehaviorDesc(){
+ List data = pointsBehaviorService.listBehaviorDesc();
+ return new Result>().ok(data);
+ }
+ /**
+ * @Description 志愿者服务使用- 获取全部动作编码
+ * @Author songyunpeng
+ * @Date 2020/5/12
+ * @Param []
+ * @return com.elink.esua.epdc.commons.tools.utils.Result>
+ **/
+ @GetMapping("getAllBehaviorDesc")
+ public Result> getAllBehaviorDesc(){
+ List data = pointsBehaviorService.selectAllListBehaviorDesc();
+ return new Result>().ok(data);
+ }
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsBehaviorRuleController.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsBehaviorRuleController.java
new file mode 100644
index 0000000..89cb4df
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsBehaviorRuleController.java
@@ -0,0 +1,94 @@
+/**
+ * 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.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.UpdateGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.dto.PointsBehaviorRuleDTO;
+import com.elink.esua.epdc.excel.PointsBehaviorRuleExcel;
+import com.elink.esua.epdc.service.PointsBehaviorRuleService;
+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 elink elink@elink-cn.com
+ * @since v1.0.0 2020-05-11
+ */
+@RestController
+@RequestMapping("pointsbehaviorrule")
+public class PointsBehaviorRuleController {
+
+ @Autowired
+ private PointsBehaviorRuleService pointsBehaviorRuleService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = pointsBehaviorRuleService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ PointsBehaviorRuleDTO data = pointsBehaviorRuleService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody PointsBehaviorRuleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ pointsBehaviorRuleService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody PointsBehaviorRuleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ pointsBehaviorRuleService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ pointsBehaviorRuleService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = pointsBehaviorRuleService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, PointsBehaviorRuleExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsController.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsController.java
new file mode 100644
index 0000000..a41ce3e
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsController.java
@@ -0,0 +1,45 @@
+package com.elink.esua.epdc.controller;
+
+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.PointsLogsDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsAddFormDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsFormDTO;
+import com.elink.esua.epdc.dto.result.BehaviorResultDto;
+import com.elink.esua.epdc.dto.result.PointsLogsResultDTO;
+import com.elink.esua.epdc.dto.result.PointsLogsSumResultDTO;
+import com.elink.esua.epdc.dto.result.PointsRuleResultDTO;
+import com.elink.esua.epdc.entity.PointsLogsEntity;
+import com.elink.esua.epdc.service.PointsBehaviorService;
+import com.elink.esua.epdc.service.PointsLogsService;
+import com.elink.esua.epdc.service.PointsRuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author songyunpeng
+ * @Description 提供外部接口Controller
+ * @create 2020-04-28
+ */
+@RestController
+@RequestMapping("points")
+public class PointsController {
+
+
+ @Autowired
+ private PointsBehaviorService pointsBehaviorService;
+
+ /**
+ * @return com.elink.esua.epdc.dto.result.BehaviorResultDto
+ * @Description 根据动作编码获取动作信息
+ * @Author songyunpeng
+ * @Date 2020/4/28
+ * @Param [behaviorCode]
+ **/
+ @PostMapping("getBehaviorCodeInfo/{behaviorCode}")
+ public Result getBehaviorCodeInfo(@PathVariable String behaviorCode) {
+ return pointsBehaviorService.getBehaviorCodeInfoByBehaviorCode(behaviorCode);
+ }
+
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/controller/PointsLogsController.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsLogsController.java
similarity index 65%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/controller/PointsLogsController.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsLogsController.java
index a119de4..7a8dd2d 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/controller/PointsLogsController.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsLogsController.java
@@ -15,7 +15,7 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.logs.controller;
+package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
@@ -25,15 +25,16 @@ 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.EpdcAdjustUserPointsDTO;
+import com.elink.esua.epdc.dto.PointsLogsDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcAdjustVolunteerPointsDTO;
-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 com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO;
+import com.elink.esua.epdc.excel.PointsLogsExcel;
+import com.elink.esua.epdc.service.PointsLogsService;
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;
@@ -105,8 +106,46 @@ public class PointsLogsController {
* @Date 2019/12/16 18:56
**/
@PostMapping("confirmAdjustPoint")
- public Result confirmAdjustPoint(@RequestBody EpdcAdjustVolunteerPointsDTO formDto){
+ public Result confirmAdjustPoint(@RequestBody EpdcAdjustVolunteerPointsDTO formDto){
ValidatorUtils.validateEntity(formDto);
return pointsLogsService.confirmAdjustPoint(formDto);
}
+ /**
+ * @Description 积分管理-积分统计 -统计调整积分
+ * @Author songyunpeng
+ * @Date 2020/6/9
+ * @Param [formDto]
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ **/
+ @PostMapping("confirmUserAdjustPoint")
+ public Result confirmUserAdjustPoint(@RequestBody EpdcAdjustUserPointsDTO formDto){
+ ValidatorUtils.validateEntity(formDto);
+ return pointsLogsService.confirmUserAdjustPoint(formDto);
+ }
+
+
+ /***
+ * 积分分类统计
+ * @param params
+ * @return com.elink.esua.epdc.commons.tools.utils.Result>
+ * @author qushutong
+ * @date 2020/7/21 9:22
+ */
+ @GetMapping("/point/listPagePoints")
+ public Result> listPagePoints(@RequestParam Map params) {
+ PageData list = pointsLogsService.listPagePoint(params);
+ return new Result>().ok(list);
+ }
+
+ /***
+ * 积分总览
+ * @param params
+ * @return com.elink.esua.epdc.commons.tools.utils.Result>
+ * @author qushutong
+ * @date 2020/7/21 9:22
+ */
+ @GetMapping("/point/pointsOverview")
+ public Result pointsOverview(@RequestParam Map params) {
+ return new Result().ok(pointsLogsService.getPointsOverview(params));
+ }
}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java
new file mode 100644
index 0000000..927a6c8
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java
@@ -0,0 +1,117 @@
+/**
+ * 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.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.UpdateGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.dto.PointsRuleDTO;
+import com.elink.esua.epdc.excel.PointsRuleExcel;
+import com.elink.esua.epdc.service.PointsRuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 积分规则管理表 积分规则管理表
+ *
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@RestController
+@RequestMapping("pointsrule")
+public class PointsRuleController {
+
+ @Autowired
+ private PointsRuleService pointsRuleService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = pointsRuleService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ PointsRuleDTO data = pointsRuleService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody PointsRuleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ return pointsRuleService.save(dto);
+ }
+
+ @PutMapping
+ public Result update(@RequestBody PointsRuleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ return pointsRuleService.update(dto);
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ pointsRuleService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = pointsRuleService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, PointsRuleExcel.class);
+ }
+
+ /**
+ * @param ruleCode
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据规则编码查询规则信息
+ * @Date 2019/12/12 16:29
+ **/
+ @GetMapping("getPointRule/{ruleCode}")
+ public Result getPointRule(@PathVariable("ruleCode") String ruleCode) {
+ return pointsRuleService.getPointRule(ruleCode);
+ }
+
+ /***
+ * 规则列表
+ * @param
+ * @return com.elink.esua.epdc.commons.tools.utils.Result>
+ * @author qushutong
+ * @date 2020/7/20 17:28
+ */
+ @GetMapping("ruleList")
+ public Result> getRuleList() {
+ List list = pointsRuleService.list(new HashMap<>());
+ return new Result>().ok(list);
+ }
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsBehaviorDao.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsBehaviorDao.java
new file mode 100644
index 0000000..6e6f77e
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsBehaviorDao.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.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.PointsBehaviorDTO;
+import com.elink.esua.epdc.dto.result.BehaviorResultDto;
+import com.elink.esua.epdc.entity.PointsBehaviorEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分动作管理表 积分动作管理表
+ *
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@Mapper
+public interface PointsBehaviorDao extends BaseDao {
+
+ /**
+ * 动作管理 列表查询
+ *
+ * @param params
+ * param behaviorCode 可选 动作编码
+ * param behaviorDesc 可选 动作描述
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * @return: java.util.List
+ * @Author: zy
+ * @Date: 2020-04-28
+ */
+ List selectListPointsBehavior(Map params);
+
+ /**
+ * @return com.elink.esua.epdc.dto.result.BehaviorResultDto
+ * @Description 根据动作编码获取动作信息
+ * @Author songyunpeng
+ * @Date 2020/4/28
+ * @Param []
+ **/
+ BehaviorResultDto getBehaviorCodeInfoByBehaviorCode(String behaviorCode);
+ /**
+ * @Description 志愿者服务使用- 获取全部动作编码
+ * @Author songyunpeng
+ * @Date 2020/5/12
+ * @Param []
+ * @return java.util.List
+ **/
+ List selectAllListBehaviorDesc();
+
+ /**
+ * 获取全部的动作编码
+ *
+ * @Param: []
+ * @return: com.elink.esua.epdc.commons.tools.utils.Result>
+ * @Author: zy
+ * @Date: 2020-04-29
+ */
+ List selectListBehaviorDesc();
+
+ /**
+ * 查询积分动作管理表 动作描述是否存在
+ * @param behaviorDesc 动作描述
+ * @return int
+ * @Author zhangyong
+ * @Date 17:33 2020-05-08
+ **/
+ int selectBehaviorDescItExist(String behaviorDesc);
+
+ /**
+ * 查询积分规则表 动作编码是否存在
+ * @param behaviorCode 动作编码
+ * @return int
+ * @Author zhangyong
+ * @Date 15:48 2020-05-08
+ **/
+ int selectBehaviorCodeDoestItExist(String behaviorCode);
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/dao/PointsLogsDao.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsBehaviorRuleDao.java
similarity index 61%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/dao/PointsLogsDao.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsBehaviorRuleDao.java
index b7e7297..df916eb 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/dao/PointsLogsDao.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsBehaviorRuleDao.java
@@ -15,29 +15,29 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.logs.dao;
+package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
-import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
-import com.elink.esua.epdc.modules.logs.entity.PointsLogsEntity;
+import com.elink.esua.epdc.entity.PointsBehaviorRuleEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
-import java.util.Map;
/**
- * 积分日志表
+ * 积分动作规则关系表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-13
+ * @author zhangyong
+ * @since v1.0.0 2020-05-11
*/
@Mapper
-public interface PointsLogsDao extends BaseDao {
+public interface PointsBehaviorRuleDao extends BaseDao {
+
/**
- * 志愿者管理 积分记录页面分页查询
- *
- * @param params
- * @return
- */
- List selectListVolunteerPointsLog(Map params);
+ * 根据参数,删除积分动作规则关系表中 与积分动作管理表 有关联的数据
+ * @param ruleId 积分规则管理表主键
+ * @return void
+ * @Author zhangyong
+ * @Date 10:54 2020-05-11
+ **/
+ void deletePointsBehaviorRule(String ruleId);
}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsLogsDao.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsLogsDao.java
new file mode 100644
index 0000000..d9387f3
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsLogsDao.java
@@ -0,0 +1,146 @@
+/**
+ * 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.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.PointsLogsDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsFormDTO;
+import com.elink.esua.epdc.dto.result.*;
+import com.elink.esua.epdc.dto.form.EpdcAppPointsRankingFormDTO;
+import com.elink.esua.epdc.dto.form.EpdcAppPointsRecordFormDTO;
+import com.elink.esua.epdc.entity.PointsLogsEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分记录表 积分记录表
+ *
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-04-29
+ */
+@Mapper
+public interface PointsLogsDao extends BaseDao {
+ /**
+ * @return com.elink.esua.epdc.dto.result.PointsLogsResultDTO
+ * @Description 根据用户,业务ID,行为编码获取日志记录
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [pointsLogsFormDTO]
+ **/
+ List selecOneLogsByBehaviorCodeAndUserIdAndReferenceId(PointsLogsFormDTO pointsLogsFormDTO);
+
+ /**
+ * @return java.lang.Integer
+ * @Description 根据行为编码和用户ID获取积分 该动作积分总和
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [pointsLogsFormDTO]
+ **/
+ Integer getPointsSumByBehaviorCodeAndUserId(PointsLogsFormDTO pointsLogsFormDTO);
+
+ /**
+ * @return com.elink.esua.epdc.dto.result.PointsLogsResultDTO
+ * @Description 获取指定人指定动作的最新一条工作日志
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [pointsLogsFormDTO]
+ **/
+ PointsLogsResultDTO getLastPointLogs(PointsLogsFormDTO pointsLogsFormDTO);
+
+ /**
+ * 当前登录用户 积分记录接口
+ *
+ * @param formDto
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * param userId 必选 用户ID
+ * @return: java.util.List
+ * @Author: zy
+ * @Date: 2020-04-29
+ */
+ List selectListPointsRecord(EpdcAppPointsRecordFormDTO formDto);
+
+ /**
+ * 积分排行接口(0 周排行、1 月排行)
+ *
+ * @param formDto
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * param rankingType 必选 排名方式:0-周,1-月
+ * @return: java.util.List
+ * @Author: zy
+ * @Date: 2020-04-30
+ */
+ List selectListPointsRanking(EpdcAppPointsRankingFormDTO formDto);
+
+ /**
+ * 志愿者管理 积分记录页面分页查询
+ * @param params
+ * param userId 必选 用户ID
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 15:31 2020-05-12
+ **/
+ List selectListVolunteerPointsLog(Map params);
+
+ /**
+ * 积分排行接口(0 周排行、1 月排行) - 查询用户个人排名名次 及 积分
+ *
+ * @param formDto
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * param rankingType 必选 排名方式:0-周,1-月
+ * @return: com.elink.esua.epdc.dto.result.EpdcAppPointsRankingUserDTO
+ * @Author: zy
+ * @Date: 2020-05-13
+ */
+ EpdcAppPointsRankingUserDTO selectUserPointsRanking(EpdcAppPointsRankingFormDTO formDto);
+
+ /**
+ * 积分排行接口(0 周排行、1 月排行) - 产生积分记录的总人数,相同积分做去重处理
+ *
+ * @param formDto
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * param rankingType 必选 排名方式:0-周,1-月
+ * @return: int
+ * @Author: zy
+ * @Date: 2020-05-13
+ */
+ int selectCountPointsRanking(EpdcAppPointsRankingFormDTO formDto);
+
+ /***
+ * 积分分类统计
+ * @param params
+ * @return java.util.List
+ * @author qushutong
+ * @date 2020/7/21 10:37
+ */
+ List selectPointsList(Map params);
+
+ /***
+ * 积分总览
+ * @param params
+ * @return com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO
+ * @author qushutong
+ * @date 2020/7/21 10:37
+ */
+ PointsStatisticsListResultDTO selectPointsOverview(Map params);
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java
new file mode 100644
index 0000000..73afce3
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java
@@ -0,0 +1,72 @@
+/**
+ * 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.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.PointsRuleDTO;
+import com.elink.esua.epdc.dto.result.PointsRuleResultDTO;
+import com.elink.esua.epdc.entity.PointsRuleEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分规则管理表 积分规则管理表
+ *
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@Mapper
+public interface PointsRuleDao extends BaseDao {
+
+ /**
+ * @return com.elink.esua.epdc.dto.result.PointsRuleResultDTO
+ * @Description 根据动作编码获取积分规则
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [behaviorCode]
+ **/
+ PointsRuleResultDTO selecOnePointsRuleByBehaviorCode(String behaviorCode);
+
+ /**
+ * 积分规则配置 列表查询
+ *
+ * @param params
+ * param ruleCode 可选 积分规则编码
+ * param ruleDesc 可选 积分规则描述
+ * param operationType 可选 规则操作类型 0-减积分,1-加积分
+ * param enableFlag 可选 启用标识 0-否,1-是
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * @return: java.util.List
+ * @Author: zy
+ * @Date: 2020-04-29
+ */
+ List selectListPointsRule(Map params);
+
+ /**
+ * 根据积分规则管理表ID,查询相关联的动作编码
+ *
+ * @param pointsRuldId 积分规则管理表ID
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:22 2020-05-11
+ **/
+ List selectListBehaviorCode(String pointsRuldId);
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsBehaviorEntity.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsBehaviorEntity.java
new file mode 100644
index 0000000..fbfe023
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsBehaviorEntity.java
@@ -0,0 +1,61 @@
+/**
+ * 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.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 zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("epdc_points_behavior")
+public class PointsBehaviorEntity extends BaseEpdcEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 动作编码
+ */
+ private String behaviorCode;
+
+ /**
+ * 动作描述
+ */
+ private String behaviorDesc;
+
+ /**
+ * 动作记录时机 0-方法执行前,1-方法执行后
+ */
+ private String behaviorRecordingTime;
+
+ /**
+ * 备注
+ */
+ private String remark;
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsBehaviorRuleEntity.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsBehaviorRuleEntity.java
new file mode 100644
index 0000000..3f0083f
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsBehaviorRuleEntity.java
@@ -0,0 +1,51 @@
+/**
+ * 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.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 elink elink@elink-cn.com
+ * @since v1.0.0 2020-05-11
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("epdc_points_behavior_rule")
+public class PointsBehaviorRuleEntity extends BaseEpdcEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 动作ID
+ */
+ private String behaviorId;
+
+ /**
+ * 规则ID
+ */
+ private String ruleId;
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/entity/PointsLogsEntity.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsLogsEntity.java
similarity index 58%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/entity/PointsLogsEntity.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsLogsEntity.java
index 06a7d22..8f501f2 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/entity/PointsLogsEntity.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsLogsEntity.java
@@ -15,9 +15,10 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.logs.entity;
+package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
+
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -25,80 +26,82 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
- * 积分日志表
+ * 积分记录表 积分记录表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-13
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-04-29
*/
@Data
-@EqualsAndHashCode(callSuper=false)
+@EqualsAndHashCode(callSuper = false)
@TableName("epdc_points_logs")
public class PointsLogsEntity extends BaseEpdcEntity {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
/**
- * 志愿者ID
+ * 用户ID
*/
- private String volunteerId;
+ private String userId;
+ /**
+ * 用户昵称
+ */
+ private String nickname;
+
/**
- * 用户ID
+ * 用户头像
+ */
+ private String faceImg;
+
+
+ /**
+ * 关联表ID
*/
- private String userId;
+ private String referenceId;
/**
- * 积分操作类型(0-减积分,1-加积分)
+ * 积分规则编码
+ */
+ private String ruleCode;
+
+ /**
+ * 积分行为编码
*/
- private String operationType;
+ private String behaviorCode;
+
+ /**
+ * 积分操作类型 0-减积分,1-加积分
+ */
+ private String operationType;
/**
* 操作积分值
*/
- private Integer points;
+ private Integer points;
/**
* 操作描述
*/
- private String operationDesc;
+ private String operationDesc;
/**
* 操作时间
*/
- private Date operationTime;
+ private Date operationTime;
/**
- * 操作方式(user-用户操作,admin-管理员操作,sys-系统操作)
+ * 操作方式 user-用户操作,admin-管理员操作,sys-系统操作
*/
- private String operationMode;
+ private String operationMode;
/**
- * 积分规则编码
+ * 剩余积分值
*/
- private String ruleCode;
+ private Integer lavePoints;
/**
- * 是否操作成功(0-失败,1-成功)
+ * 志愿者ID
*/
- private String status;
+ private String volunteerId;
- /**
- * 操作失败原因
- */
- private String failureReason;
-
- /**
- * 剩余积分值
- */
- private Integer lavePoints;
-
- /**
- * 积分行为编码
- */
- private String behaviorCode;
-
- /**
- * 关联表ID关联表id
- */
- private String referenceId;
-}
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/entity/PointsRuleEntity.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java
similarity index 69%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/entity/PointsRuleEntity.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java
index 488900d..f3083f0 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/entity/PointsRuleEntity.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java
@@ -15,7 +15,7 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.rule.entity;
+package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
- * 积分规则表
+ * 积分规则管理表 积分规则管理表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-11
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
*/
@Data
@EqualsAndHashCode(callSuper=false)
@@ -39,53 +39,52 @@ public class PointsRuleEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
- * 规则编码
+ * 积分规则编码
*/
private String ruleCode;
/**
- * 规则描述
+ * 积分规则描述
*/
private String ruleDesc;
/**
- * 积分值
- */
- private Integer points;
-
- /**
- * 规则操作类型(0-减积分,1-加积分)
+ * 规则操作类型 0-减积分,1-加积分
*/
private String operationType;
/**
- * 可用标记(0-不可用,1-可用)
+ * 积分规则值
*/
- private String available;
+ private Integer points;
/**
- * 积分行为编码
+ * 上线统计指标 0-分钟,1-小时,2-日,3-月,4-年
*/
- private String behaviorCode;
+ private String limitType;
/**
- * 积分行为描述
+ * 积分上限值
*/
- private String behaviorDesc;
+ private Integer upperLimitVal;
/**
- * 积分是否有上限限制(0-否,1-是)
+ * 启用标识 0-否,1-是
*/
- private String upperLimitFlag;
+ private String enableFlag;
/**
- * 限制时限(0-分钟,1-小时,2-日,3-月,4-年)
+ * 附加值
*/
- private String limitTimeType;
+ private String addedVal;
/**
- * 积分上限值
+ * 备注
*/
- private Integer upperLimitVal;
+ private String remark;
+ /**
+ * 动作上限次数0-不限 1-一次 ....
+ */
+ private String limitNum;
}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsBehaviorExcel.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsBehaviorExcel.java
new file mode 100644
index 0000000..505596c
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsBehaviorExcel.java
@@ -0,0 +1,68 @@
+/**
+ * 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.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 积分动作管理表 积分动作管理表
+ *
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@Data
+public class PointsBehaviorExcel {
+
+ @Excel(name = "ID")
+ private String id;
+
+ @Excel(name = "动作编码")
+ private String behaviorCode;
+
+ @Excel(name = "动作描述")
+ private String behaviorDesc;
+
+ @Excel(name = "动作记录时机 0-方法执行前,1-方法执行后")
+ private String behaviorRecordingTime;
+
+ @Excel(name = "备注")
+ private String remark;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0-否,1-是")
+ private String delFlag;
+
+ @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/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsBehaviorRuleExcel.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsBehaviorRuleExcel.java
new file mode 100644
index 0000000..cc8f739
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsBehaviorRuleExcel.java
@@ -0,0 +1,62 @@
+/**
+ * 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.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 积分动作规则关系表
+ *
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-05-11
+ */
+@Data
+public class PointsBehaviorRuleExcel {
+
+ @Excel(name = "ID")
+ private String id;
+
+ @Excel(name = "动作ID")
+ private String behaviorId;
+
+ @Excel(name = "规则ID")
+ private String ruleId;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0-否,1-是")
+ private String delFlag;
+
+ @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/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/excel/PointsLogsExcel.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsLogsExcel.java
similarity index 73%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/excel/PointsLogsExcel.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsLogsExcel.java
index 4377620..5351c3f 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/excel/PointsLogsExcel.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsLogsExcel.java
@@ -15,7 +15,7 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.logs.excel;
+package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@@ -23,24 +23,30 @@ import lombok.Data;
import java.util.Date;
/**
- * 积分日志表
+ * 积分记录表 积分记录表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-13
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-04-29
*/
@Data
public class PointsLogsExcel {
- @Excel(name = "主键")
+ @Excel(name = "ID")
private String id;
- @Excel(name = "志愿者ID")
- private String volunteerId;
-
@Excel(name = "用户ID")
private String userId;
- @Excel(name = "积分操作类型(0-减积分,1-加积分)")
+ @Excel(name = "关联表ID")
+ private String referenceId;
+
+ @Excel(name = "积分规则编码")
+ private String ruleCode;
+
+ @Excel(name = "积分行为编码")
+ private String behaviorCode;
+
+ @Excel(name = "积分操作类型 0-减积分,1-加积分")
private String operationType;
@Excel(name = "操作积分值")
@@ -52,24 +58,18 @@ public class PointsLogsExcel {
@Excel(name = "操作时间")
private Date operationTime;
- @Excel(name = "操作方式(user-用户操作,admin-管理员操作,sys-系统操作)")
+ @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 lavePoints;
@Excel(name = "乐观锁")
private Integer revision;
+ @Excel(name = "删除标识 0-否,1-是")
+ private String delFlag;
+
@Excel(name = "创建人")
private String createdBy;
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/excel/PointsRuleExcel.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java
similarity index 65%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/excel/PointsRuleExcel.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java
index 3342fae..4bae61d 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/excel/PointsRuleExcel.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java
@@ -15,7 +15,7 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.rule.excel;
+package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@@ -23,53 +23,53 @@ import lombok.Data;
import java.util.Date;
/**
- * 积分规则表
+ * 积分规则管理表 积分规则管理表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-11
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
*/
@Data
public class PointsRuleExcel {
- @Excel(name = "主键")
+ @Excel(name = "ID")
private String id;
- @Excel(name = "规则编码")
+ @Excel(name = "积分规则编码")
private String ruleCode;
- @Excel(name = "规则描述")
- private String ruleDesc;
+ @Excel(name = "动作编码")
+ private String behaviorCode;
- @Excel(name = "积分值")
- private Integer points;
+ @Excel(name = "积分规则描述")
+ private String ruleDesc;
- @Excel(name = "规则操作类型(0-减积分,1-加积分)")
+ @Excel(name = "规则操作类型 0-减积分,1-加积分")
private String operationType;
- @Excel(name = "可用标记(0-不可用,1-可用)")
- private String available;
-
- @Excel(name = "积分行为编码")
- private String behaviorCode;
-
- @Excel(name = "积分行为描述")
- private String behaviorDesc;
-
- @Excel(name = "积分是否有上限限制(0-否,1-是)")
- private String upperLimitFlag;
+ @Excel(name = "积分规则值")
+ private Integer points;
- @Excel(name = "限制时限(0-分钟,1-小时,2-日,3-月,4-年)")
- private String limitTimeType;
+ @Excel(name = "上线统计指标 0-分钟,1-小时,2-日,3-月,4-年")
+ private String limitType;
@Excel(name = "积分上限值")
private Integer upperLimitVal;
- @Excel(name = "删除标记")
- private String delFlag;
+ @Excel(name = "启用标识 0-否,1-是")
+ private String enableFlag;
+
+ @Excel(name = "附加值")
+ private String addedVal;
+
+ @Excel(name = "备注")
+ private String remark;
@Excel(name = "乐观锁")
private Integer revision;
+ @Excel(name = "删除标识 0-否,1-是")
+ private String delFlag;
+
@Excel(name = "创建人")
private String createdBy;
@@ -83,4 +83,4 @@ public class PointsRuleExcel {
private Date updatedTime;
-}
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/NewsFeignClient.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
similarity index 89%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/NewsFeignClient.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
index e780327..6a325e0 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/NewsFeignClient.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
@@ -1,9 +1,9 @@
-package com.elink.esua.epdc.modules.feign;
+package com.elink.esua.epdc.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.EpdcInformationFormDTO;
-import com.elink.esua.epdc.modules.feign.fallback.NewsFeignClientFallback;
+import com.elink.esua.epdc.feign.fallback.NewsFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/UsersFeignClient.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/UsersFeignClient.java
new file mode 100644
index 0000000..1fd09f9
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/UsersFeignClient.java
@@ -0,0 +1,61 @@
+package com.elink.esua.epdc.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.UserDTO;
+import com.elink.esua.epdc.dto.UserGridRelationDTO;
+import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO;
+import com.elink.esua.epdc.feign.fallback.UsersFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * @author songyunpeng
+ * @date 2020/04/28
+ */
+@FeignClient(name = ServiceConstant.EPDC_USER_SERVER, fallback = UsersFeignClientFallback.class)
+public interface UsersFeignClient {
+
+ /**
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Description 获取用户信息
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [id]
+ **/
+ @GetMapping(value = "app-user/user/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result getUserById(@PathVariable String id);
+
+ /**
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Description 更新用户信息
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [dto]
+ **/
+ @PutMapping(value = "app-user/user", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result updateUser(@RequestBody UserDTO dto);
+
+ /**
+ * @param formDTO
+ * @return com.elink.esua.epdc.dto.UserDTO
+ * @Author yinzuomei
+ * @Description 根据操作类型更新用户积分
+ * @Date 2019/12/13 15:12
+ **/
+ @PostMapping(value = "app-user/user/handleUserPoints", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result handleUserPoints(EpdcUserPointsFormDTO formDTO);
+
+ /**
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Description 获取用户最后一次切换网格信息
+ * @Author songyunpeng
+ * @Date 2020/5/14
+ * @Param [userId]
+ **/
+ @GetMapping(value = "app-user/usergrid/getUserLastSwitchGird/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result getUserLastSwitchGird(@PathVariable("userId") String userId);
+}
+
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/fallback/NewsFeignClientFallback.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
similarity index 85%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/fallback/NewsFeignClientFallback.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
index 0a2c9f2..b3a6e54 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/fallback/NewsFeignClientFallback.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
@@ -1,10 +1,10 @@
-package com.elink.esua.epdc.modules.feign.fallback;
+package com.elink.esua.epdc.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.EpdcInformationFormDTO;
-import com.elink.esua.epdc.modules.feign.NewsFeignClient;
+import com.elink.esua.epdc.feign.NewsFeignClient;
import org.springframework.stereotype.Component;
/**
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/fallback/UsersFeignClientFallback.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/fallback/UsersFeignClientFallback.java
new file mode 100644
index 0000000..49c34ca
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/feign/fallback/UsersFeignClientFallback.java
@@ -0,0 +1,38 @@
+package com.elink.esua.epdc.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.UserDTO;
+import com.elink.esua.epdc.dto.UserGridRelationDTO;
+import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO;
+import com.elink.esua.epdc.feign.UsersFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author songyunpeng
+ * @date 2020/4/28 9:30
+ */
+@Component
+public class UsersFeignClientFallback implements UsersFeignClient {
+
+ @Override
+ public Result getUserById(String id) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "get", id);
+ }
+
+ @Override
+ public Result updateUser(UserDTO dto) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "update", dto);
+ }
+
+ @Override
+ public Result handleUserPoints(EpdcUserPointsFormDTO formDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "handleUserPoints", formDTO);
+ }
+
+ @Override
+ public Result getUserLastSwitchGird(String userId) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getUserLastSwitchGird", userId);
+ }
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/jwt/JwtTokenProperties.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/jwt/JwtTokenProperties.java
new file mode 100644
index 0000000..3e938f9
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/jwt/JwtTokenProperties.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.elink.esua.epdc.jwt;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Jwt
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Configuration
+@ConfigurationProperties(prefix = "jwt.token")
+public class JwtTokenProperties {
+ private String secret;
+ private int expire;
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+ public int getExpire() {
+ return expire;
+ }
+
+ public void setExpire(int expire) {
+ this.expire = expire;
+ }
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/jwt/JwtTokenUtils.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/jwt/JwtTokenUtils.java
new file mode 100644
index 0000000..736be6d
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/jwt/JwtTokenUtils.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.elink.esua.epdc.jwt;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ * Jwt工具类
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Component
+public class JwtTokenUtils {
+ private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class);
+
+ @Autowired
+ private JwtTokenProperties jwtProperties;
+
+ /**
+ * 生成jwt token
+ */
+ public String generateToken(String userId) {
+ return Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setSubject(userId)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
+ .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
+ .compact();
+ }
+
+ public Claims getClaimByToken(String token) {
+ try {
+ return Jwts.parser()
+ .setSigningKey(jwtProperties.getSecret())
+ .parseClaimsJws(token)
+ .getBody();
+ } catch (Exception e) {
+ logger.debug("validate is token error, token = " + token, e);
+ return null;
+ }
+ }
+
+ /**
+ * token是否过期
+ *
+ * @return true:过期
+ */
+ public boolean isTokenExpired(Date expiration) {
+ return expiration.before(new Date());
+ }
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/UserFeignClient.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/UserFeignClient.java
deleted file mode 100644
index 6a5eb37..0000000
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/UserFeignClient.java
+++ /dev/null
@@ -1,42 +0,0 @@
-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.UserDTO;
-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.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-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)
-public interface UserFeignClient {
-
- /**
- * @param formDTO
- * @return com.elink.esua.epdc.dto.UserDTO
- * @Author yinzuomei
- * @Description 根据操作类型更新用户积分
- * @Date 2019/12/13 15:12
- **/
- @PostMapping(value = "app-user/user/handleUserPoints", consumes = MediaType.APPLICATION_JSON_VALUE)
- Result handleUserPoints(EpdcUserPointsFormDTO formDTO);
-
- /**
- * 查询用户基础信息
- *
- * @param userId
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @author work@yujt.net.cn
- * @date 2019/10/26 15:16
- */
- @GetMapping("app-user/epdc-app/user/getById/{userId}")
- Result getUserInfoById(@PathVariable("userId") String userId);
-}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/fallback/UserFeignClientFallback.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/fallback/UserFeignClientFallback.java
deleted file mode 100644
index 2494bf2..0000000
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/feign/fallback/UserFeignClientFallback.java
+++ /dev/null
@@ -1,28 +0,0 @@
-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.UserDTO;
-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);
- }
-
- @Override
- public Result getUserInfoById(String userId) {
- return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getUserInfoById", userId);
- }
-}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/service/impl/PointsLogsServiceImpl.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/service/impl/PointsLogsServiceImpl.java
deleted file mode 100644
index 8ab08c5..0000000
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/service/impl/PointsLogsServiceImpl.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * 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.constant.NumConstant;
-import com.elink.esua.epdc.commons.tools.constant.PointsConstant;
-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.enums.pointsenum.PointsOperationModeEnum;
-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.constant.PointsNoticeConstant;
-import com.elink.esua.epdc.dto.UserDTO;
-import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO;
-import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO;
-import com.elink.esua.epdc.dto.epdc.result.EpdcAdjustVolunteerPointsDTO;
-import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
-import com.elink.esua.epdc.modules.async.NewsTask;
-import com.elink.esua.epdc.modules.feign.UserFeignClient;
-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.Date;
-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;
-
- @Autowired
- private UserFeignClient userFeignClient;
-
- @Autowired
- private NewsTask newsTask;
-
- @Override
- public PageData page(Map params) {
- IPage page = getPage(params);
- List list = baseDao.selectListVolunteerPointsLog(params);
- return new PageData<>(list, page.getTotal());
- }
-
- @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));
- }
-
- /**
- * @param formDto
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 确定调整用户积分
- * @Date 2019/12/16 18:56
- **/
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result confirmAdjustPoint(EpdcAdjustVolunteerPointsDTO formDto) {
- if (formDto.getOperatePoints() == NumConstant.ZERO) {
- return new Result().error("操作积分不能为0");
- }
- PointsLogsEntity pointsLogsEntity = new PointsLogsEntity();
- pointsLogsEntity.setVolunteerId(formDto.getId());
- pointsLogsEntity.setUserId(formDto.getUserId());
- pointsLogsEntity.setOperationTime(new Date());
- pointsLogsEntity.setOperationMode(PointsOperationModeEnum.OPERATION_MODE_ADMIN.getOperationMode());//操作方式(user-用户操作,admin-管理员操作,sys-系统操作)
- pointsLogsEntity.setStatus(YesOrNoEnum.YES.value());
- pointsLogsEntity.setFailureReason("");
- pointsLogsEntity.setRuleCode(PointsConstant.ruleCode);
- pointsLogsEntity.setOperationDesc(formDto.getAdjustReason());//操作描述
- pointsLogsEntity.setPoints(formDto.getOperatePoints());
- pointsLogsEntity.setOperationType(formDto.getOperationType());//积分操作类型(0-减积分,1-加积分)
- EpdcUserPointsFormDTO userPointsFormDTO = new EpdcUserPointsFormDTO();
- userPointsFormDTO.setUserId(formDto.getUserId());
- userPointsFormDTO.setPoints(formDto.getOperatePoints());
- userPointsFormDTO.setOperationType(formDto.getOperationType());
- Result result = userFeignClient.handleUserPoints(userPointsFormDTO);
- if (!result.success()) {
- return new Result().error("调整用户积分失败");
- }
- //剩余积分
- pointsLogsEntity.setLavePoints(result.getData().getPoints());
- pointsLogsEntity.setBehaviorCode(formDto.getBehaviorCode());
- this.insert(pointsLogsEntity);
- //给用户发送消息通知
- this.issueSmsNotification(pointsLogsEntity);
- return new Result();
- }
-
- /**
- * @param pointsLogsEntity
- * @return void
- * @Author yinzuomei
- * @Description 调整积分完成后-给用户发送消息通知
- * @Date 2020/2/7 22:12
- **/
- private void issueSmsNotification(PointsLogsEntity pointsLogsEntity) {
- EpdcInformationFormDTO informationFormDTO = new EpdcInformationFormDTO();
- informationFormDTO.setUserId(pointsLogsEntity.getUserId());
- String content = "";
- //积分操作类型(0-减积分,1-加积分)
- if (PointsOperationEnum.OPERATION_TYPE_ADD.getOperationType().equals(pointsLogsEntity.getOperationType())) {
- informationFormDTO.setTitle(PointsNoticeConstant.ADD_POINTS_NOTICE);
- content = PointsNoticeConstant.ADD_POINTS + pointsLogsEntity.getPoints() + PointsNoticeConstant.REASON + pointsLogsEntity.getOperationDesc();
-
- } else if (PointsOperationEnum.OPERATION_TYPE_SUBSTRACT.getOperationType().equals(pointsLogsEntity.getOperationType())) {
- informationFormDTO.setTitle(PointsNoticeConstant.SUBTRACT_POINTS_NOTICE);
- content = PointsNoticeConstant.SUBTRACT_POINTS + pointsLogsEntity.getPoints() + PointsNoticeConstant.REASON + pointsLogsEntity.getOperationDesc();
- }
- informationFormDTO.setContent(content);
- informationFormDTO.setType(PointsNoticeConstant.NOTICE_TYPE_INTERACTIVE_NOTICE);
- informationFormDTO.setBusinessType(PointsNoticeConstant.NOTICE__BUSINESS_TYPE_ACTIVITY);
- informationFormDTO.setBusinessId(pointsLogsEntity.getId());
- informationFormDTO.setRelBusinessContent("");
- // 发送消息
- newsTask.insertUserInformation(informationFormDTO);
- }
-}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/controller/PointsRuleController.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/controller/PointsRuleController.java
deleted file mode 100644
index 37ddd36..0000000
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/controller/PointsRuleController.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * 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.rule.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.UpdateGroup;
-import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
-import com.elink.esua.epdc.dto.rule.PointsRuleDTO;
-import com.elink.esua.epdc.modules.rule.excel.PointsRuleExcel;
-import com.elink.esua.epdc.modules.rule.service.PointsRuleService;
-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-11
- */
-@RestController
-@RequestMapping("pointsrule")
-public class PointsRuleController {
-
- @Autowired
- private PointsRuleService pointsRuleService;
-
- @GetMapping("page")
- public Result> page(@RequestParam Map params) {
- PageData page = pointsRuleService.page(params);
- return new Result>().ok(page);
- }
-
- @GetMapping("{id}")
- public Result get(@PathVariable("id") String id) {
- PointsRuleDTO data = pointsRuleService.get(id);
- return new Result().ok(data);
- }
-
- @PostMapping
- public Result save(@RequestBody PointsRuleDTO dto) {
- //效验数据
- ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
- return pointsRuleService.save(dto);
- }
-
- @PutMapping
- public Result update(@RequestBody PointsRuleDTO dto) {
- //效验数据
- ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
- return pointsRuleService.update(dto);
- }
-
- @DeleteMapping
- public Result delete(@RequestBody String[] ids) {
- //效验数据
- AssertUtils.isArrayEmpty(ids, "id");
- pointsRuleService.delete(ids);
- return new Result();
- }
-
- @GetMapping("export")
- public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
- List list = pointsRuleService.list(params);
- ExcelUtils.exportExcelToTarget(response, null, list, PointsRuleExcel.class);
- }
-
- /**
- * @param ruleCode
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 根据规则编码查询规则信息
- * @Date 2019/12/12 16:29
- **/
- @GetMapping("getPointRule/{ruleCode}")
- public Result getPointRule(@PathVariable("ruleCode") String ruleCode) {
- return pointsRuleService.getPointRule(ruleCode);
- }
-}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java
deleted file mode 100644
index c0fbfc1..0000000
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/service/impl/PointsRuleServiceImpl.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * 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.rule.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-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.PointsLimitTimeEnum;
-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.modules.rule.dao.PointsRuleDao;
-import com.elink.esua.epdc.modules.rule.entity.PointsRuleEntity;
-import com.elink.esua.epdc.modules.rule.redis.PointsRuleRedis;
-import com.elink.esua.epdc.modules.rule.service.PointsRuleService;
-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-11
- */
-@Service
-public class PointsRuleServiceImpl extends BaseServiceImpl implements PointsRuleService {
-
- @Autowired
- private PointsRuleRedis pointsRuleRedis;
-
- @Autowired
- private RedisUtils redisUtils;
-
- @Override
- public PageData page(Map params) {
- String ruleDesc = (String) params.get("ruleDesc");
- String behaviorCode = (String) params.get("behaviorCode");
- String behaviorDesc = (String) params.get("behaviorDesc");
- String ruleCode = (String) params.get("ruleCode");
- String operationType = (String) params.get("operationType");
- String available = (String) params.get("available");
- String upperLimitFlag = (String) params.get("upperLimitFlag");
- String startTime = (String) params.get("startTime");
- String endTime = (String) params.get("endTime");
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.like(StringUtils.isNotBlank(ruleDesc), "RULE_DESC", ruleDesc.trim())
- .like(StringUtils.isNotBlank(behaviorDesc), "BEHAVIOR_DESC", behaviorDesc.trim())
- .like(StringUtils.isNotBlank(ruleCode), "RULE_CODE", ruleCode.trim())
- .eq(StringUtils.isNotBlank(operationType), "OPERATION_TYPE", operationType)
- .eq(StringUtils.isNotBlank(available), "AVAILABLE", available)
- .eq(StringUtils.isNotBlank(upperLimitFlag), "UPPER_LIMIT_FLAG", upperLimitFlag)
- .eq(StringUtils.isNotBlank(behaviorCode), "BEHAVIOR_CODE", behaviorCode)
- .between(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime),
- "DATE_FORMAT(CREATED_TIME, '%Y-%m-%d' )",
- startTime,
- endTime);
- IPage page = baseDao.selectPage(
- getPage(params, FieldConstant.CREATED_TIME, false),
- wrapper
- );
- return getPageData(page, PointsRuleDTO.class);
- }
-
- @Override
- public List list(Map params) {
- List entityList = baseDao.selectList(getWrapper(params));
-
- return ConvertUtils.sourceToTarget(entityList, PointsRuleDTO.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 PointsRuleDTO get(String id) {
- PointsRuleEntity entity = baseDao.selectById(id);
- return ConvertUtils.sourceToTarget(entity, PointsRuleDTO.class);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result save(PointsRuleDTO dto) {
- Result checkResult = checkPointsRuleDTO(dto);
- if (!checkResult.success()) {
- return checkResult;
- }
- if(StringUtils.isBlank(dto.getLimitTimeType())){
- dto.setLimitTimeType(PointsLimitTimeEnum.LIMIT_TIME_MINUTE.value());
- }
- dto.setAvailable(PointsRuleAvailableEnum.AVAILABLE_TRUE.value());//可用标记(0-不可用,1-可用) 新增时默认可用
- PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class);
- insert(entity);
- String pointsRuleKey = RedisKeys.getPointsRuleKey(dto.getRuleCode());
- redisUtils.set(pointsRuleKey, entity);
- return new Result();
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result update(PointsRuleDTO dto) {
- Result checkResult = checkPointsRuleDTO(dto);
- if (!checkResult.success()) {
- return checkResult;
- }
- if(StringUtils.isBlank(dto.getLimitTimeType())){
- dto.setLimitTimeType(PointsLimitTimeEnum.LIMIT_TIME_MINUTE.value());
- }
- PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class);
- updateById(entity);
- String pointsRuleKey = RedisKeys.getPointsRuleKey(dto.getRuleCode());
- redisUtils.set(pointsRuleKey, entity);
- return new Result();
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void delete(String[] ids) {
- // 逻辑删除(@TableLogic 注解)
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.in(FieldConstant.ID, ids);
- List pointsRuleEntityList = baseDao.selectList(wrapper);
- for (PointsRuleEntity pointsRuleEntity : pointsRuleEntityList) {
- String pointsRuleKey = RedisKeys.getPointsRuleKey(pointsRuleEntity.getRuleCode());
- redisUtils.delete(pointsRuleKey);
- }
- baseDao.deleteBatchIds(Arrays.asList(ids));
- }
-
- /**
- * @param
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 项目启动初始化积分规则到redis
- * @Date 2019/12/12 16:26
- **/
- @Override
- public Result initPointsRuleRedis() {
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq("AVAILABLE", PointsRuleAvailableEnum.AVAILABLE_TRUE.value());
- List pointsRuleEntityList = baseDao.selectList(wrapper);
- for (PointsRuleEntity pointsRuleEntity : pointsRuleEntityList) {
- String pointsRuleKey = RedisKeys.getPointsRuleKey(pointsRuleEntity.getRuleCode());
- redisUtils.set(pointsRuleKey, pointsRuleEntity);
- }
- return new Result();
- }
-
- /**
- * @param ruleCode
- * @return com.elink.esua.epdc.dto.rule.PointsRuleDTO
- * @Author yinzuomei
- * @Description 根据规则编码查询规则信息
- * @Date 2019/12/12 16:30
- **/
- @Override
- public Result getPointRule(String ruleCode) {
- if (StringUtils.isBlank(ruleCode)) {
- return new Result().error("规则编码不能为空");
- }
- String pointsRuleKey = RedisKeys.getPointsRuleKey(ruleCode);
- Object obj = redisUtils.get(pointsRuleKey);
- if (null == obj) {
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq("RULE_CODE", ruleCode);
- List pointsRuleEntityList = baseDao.selectList(wrapper);
- if (CollUtil.isEmpty(pointsRuleEntityList)) {
- return new Result().error("没有找到有效记录");
- } else if (pointsRuleEntityList.size() > 1) {
- return new Result().error("规则编码不唯一");
- }
- redisUtils.set(pointsRuleKey, pointsRuleEntityList.get(0));
- obj = redisUtils.get(pointsRuleKey);
- }
- PointsRuleDTO pointsRuleDTO = ConvertUtils.sourceToTarget(obj, PointsRuleDTO.class);
- return new Result().ok(pointsRuleDTO);
- }
-
- /**
- * @param dto
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 校验界面提交数据
- * @Date 2019/12/11 17:56
- **/
- public Result checkPointsRuleDTO(PointsRuleDTO dto) {
- //规则有上限值:积分值不能大于上限值
- if (PointsUpperLimitEnum.YES.value().equals(dto.getUpperLimitFlag())
- && dto.getPoints() > dto.getUpperLimitVal()) {
- return new Result().error("积分值不能大于上限值");
- }
- //校验规则编码是否唯一
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq("RULE_CODE", dto.getRuleCode())
- .ne(StringUtils.isNotBlank(dto.getId()), FieldConstant.ID, dto.getId());
- List list = baseDao.selectList(wrapper);
- if (CollUtil.isNotEmpty(list)) {
- return new Result().error("规则编码已存在");
- }
- return new Result();
- }
-}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/mq/PointsModifyConsumer.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/mq/PointsModifyConsumer.java
new file mode 100644
index 0000000..11c1715
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/mq/PointsModifyConsumer.java
@@ -0,0 +1,197 @@
+package com.elink.esua.epdc.mq;
+
+import com.alibaba.fastjson.JSONObject;
+import com.elink.esua.epdc.common.token.dto.TokenDto;
+import com.elink.esua.epdc.common.token.util.CpUserDetailRedis;
+import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.UserDTO;
+import com.elink.esua.epdc.dto.UserGridRelationDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsAddFormDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsFormDTO;
+import com.elink.esua.epdc.dto.result.PointsLogsResultDTO;
+import com.elink.esua.epdc.dto.result.PointsRuleResultDTO;
+import com.elink.esua.epdc.entity.PointsLogsEntity;
+import com.elink.esua.epdc.feign.UsersFeignClient;
+import com.elink.esua.epdc.jwt.JwtTokenProperties;
+import com.elink.esua.epdc.mq.dto.BehaviorDto;
+import com.elink.esua.epdc.service.PointsLogsService;
+import com.elink.esua.epdc.service.PointsRuleService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.spring.annotation.MessageModel;
+import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+import org.apache.rocketmq.spring.core.RocketMQListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 积分埋点-监听MQ消息
+ *
+ * @Author:songyunpeng
+ * @Date:2020/4/28 13:44
+ */
+@Slf4j
+@Component
+@RocketMQMessageListener(topic = RocketMqConstant.MQ_TOPIC_POINTS, consumerGroup = "${rocketmq.consumer.points-group}", messageModel = MessageModel.BROADCASTING)
+public class PointsModifyConsumer implements RocketMQListener {
+
+ @Autowired
+ private PointsLogsService pointsLogsService;
+ @Autowired
+ private PointsRuleService pointsRuleService;
+
+ @Autowired
+ private UsersFeignClient usersFeignClient;
+ @Autowired
+ private CpUserDetailRedis cpUserDetailRedis;
+ @Autowired
+ private JwtTokenProperties jwtTokenProperties;
+
+
+ /**
+ * 操作类型 加分
+ */
+ private static final String OPERATION_TYPE_ADD = "1";
+ /**
+ * 操作类型 减分
+ */
+ private static final String OPERATION_TYPE_SUB = "0";
+ /**
+ * 动作限制次数 无限次
+ */
+ private static final String OPERATION_LIMIT_NUM = "0";
+ /**
+ * 成功
+ */
+ private static final String SUCCESS_CODE = "success";
+
+ /**
+ * 处理逻辑:(1)根据业务ID和动作编码去日志里查看是够已经有这个记录,如果有根据规则判断是否进行积分加减
+ * (2)进行用户的积分的加和减。然后更新redis里用户的积分的值,更新数据库里用户积分的值
+ * (3)将用户操作记录存入日志表
+ **/
+ @Override
+ public void onMessage(MessageExt messageExt) {
+ log.info("EPDC-POINTS-SERVER消费消息START:{topic:{}, msgId:{}}", RocketMqConstant.MQ_TOPIC_ORGANIZATION, messageExt.getMsgId());
+ try {
+ String charset = "UTF-8";
+ String body = new String(messageExt.getBody(), charset);
+ BehaviorDto dto = JSONObject.parseObject(body, BehaviorDto.class);
+ String info = this.handlePoints(dto);
+ log.info("EPDC-POINTS-SERVER消费消息END:{topic:{}, msgId:{}, body:{}, info:{}}", RocketMqConstant.MQ_TOPIC_ORGANIZATION, messageExt.getMsgId(), body,info);
+ } catch (Exception e) {
+ log.info("EPDC-POINTS-SERVER消费消息失败:msgId:{}", messageExt.getMsgId());
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * 处理新闻浏览积分 同一新闻算一次
+ *
+ * 根据动作编码获取积分规则信息,
+ * 根据动作编码和用户ID获取此动作在一定时限内的总分,然后根据上线统计指标判断是否到达上限值,未到达加分或减分,达到则不进行操作
+ */
+ private String handlePoints(BehaviorDto dto) {
+ //解析参数
+ if (StringUtils.isBlank(dto.getReferenceId()) || StringUtils.isBlank(dto.getUserId()) || StringUtils.isBlank(dto.getBehavior())) {
+ return "mq参数传递出错:业务ID,用户ID或者行为为空";
+ }
+ //计算是否超过该动作的积分上限 -- 开始
+ //1.根据行为编码获取积分规则
+ PointsLogsFormDTO pointsLogsFormDTO = new PointsLogsFormDTO();
+ pointsLogsFormDTO.setBehaviorCode(dto.getBehavior());
+ pointsLogsFormDTO.setUserId(dto.getUserId());
+ pointsLogsFormDTO.setReferenceId(dto.getReferenceId());
+ PointsRuleResultDTO pointsRuleResultDTO = pointsRuleService.getPointsRuleByBehaviorCode(dto.getBehavior());
+ if (pointsRuleResultDTO == null) {
+ return "获取积分规则失败";
+ }
+ if(pointsRuleResultDTO.getUpperLimitVal() == 0){
+ return "积分限值为0,无法加分";
+ }
+ pointsLogsFormDTO.setRuleCode(pointsRuleResultDTO.getRuleCode());
+ //1.1如果规则里动作次数上限不为0则需要判断该动作是否超过次数上限
+ if (!OPERATION_LIMIT_NUM.equals(pointsRuleResultDTO.getLimitNum())) {
+ //此处通过规则编码获取日志信息
+ // (用于针对 同一个项目(同一个是关键:意思就是这里的业务ID必须是一样的,否则即使一个记分配置多个动作,也不生效)表态多次 只记录一次分数)
+ List pointsLogsResultDTs = pointsLogsService.getLogsByBehaviorCodeAndUserIdAndReferenceId(pointsLogsFormDTO);
+ //如果大于或者等于上限 代表不能再进行操作
+ if (pointsLogsResultDTs != null && pointsLogsResultDTs.size() >= Integer.parseInt(pointsRuleResultDTO.getLimitNum())) {
+ return "同一项目积分已达到上限值,无法继续加分";
+ }
+ }
+ //2.赋值积分规则的上限期限(小时,年。。。。)
+ pointsLogsFormDTO.setOperationFlag(pointsRuleResultDTO.getLimitType());
+ //3.获取前一分钟的总分
+ Integer total = pointsLogsService.getPointsSumByBehaviorCodeAndUserId(pointsLogsFormDTO);
+ //判断总分是否超过上限
+ if (total != null) {
+ if (Math.abs(total + pointsRuleResultDTO.getPoints()) > Math.abs(pointsRuleResultDTO.getUpperLimitVal())) {
+ return "该动作积分已达到上限值,无法继续加分";
+ }
+ }
+ //计算是否超过该动作的积分上限 -- 结束
+ //更新用户的积分 -- 开始
+ //1.获取用户信息
+ Result userById = usersFeignClient.getUserById(dto.getUserId());
+ if (!SUCCESS_CODE.equals(userById.getMsg())) {
+ return "通过Feign获取用户信息失败";
+ }
+ UserDTO userDTO = userById.getData();
+ if (userDTO == null) {
+ return "无法获取到用户信息";
+ }
+ //判断用户是否完善信息
+ Long gridId = 0L;
+ //获取网格人员关系表
+ Result userLastSwitchGird = usersFeignClient.getUserLastSwitchGird(userDTO.getId());
+ if(!userLastSwitchGird.success() || userLastSwitchGird.getData()==null){
+ return "无法获取到网格人员关系信息";
+ }
+ gridId = userLastSwitchGird.getData().getGridId();
+ //2.更新用户积分分数
+ if (OPERATION_TYPE_ADD.equals(pointsRuleResultDTO.getOperationType())) {
+ userDTO.setPoints(userDTO.getPoints() + pointsRuleResultDTO.getPoints());
+ userDTO.setPointsTotle(userDTO.getPointsTotle() == null ? 0 : userDTO.getPointsTotle() + pointsRuleResultDTO.getPoints());
+ } else if (OPERATION_TYPE_SUB.equals(pointsRuleResultDTO.getOperationType())) {
+ userDTO.setPoints(userDTO.getPoints() - pointsRuleResultDTO.getPoints());
+ }
+ //3.更新数据库用户积分
+ usersFeignClient.updateUser(userDTO);
+ //4.更新redis用户积分情况
+ TokenDto tokenDto = ConvertUtils.sourceToTarget(userDTO, TokenDto.class);
+ tokenDto.setUserId(userDTO.getId());
+ tokenDto.setGridId(gridId);
+ int expire = jwtTokenProperties.getExpire();
+ cpUserDetailRedis.set(tokenDto, expire);
+ //更新用户的积分 -- 结束
+ //添加操作日志 -- 开始
+ addRuleLog(pointsRuleResultDTO, dto, userDTO);
+ //添加操作日志 -- 结束
+ return "积分操作成功!动作描述:"+pointsRuleResultDTO.getBehaviorDesc() +" 积分描述:"+pointsRuleResultDTO.getRuleDesc() +" 分数统计:" +pointsRuleResultDTO.getPoints();
+ }
+
+ private void addRuleLog(PointsRuleResultDTO pointsRuleResultDTO, BehaviorDto dto, UserDTO userDTO) {
+ PointsLogsAddFormDTO pointsLogsAddFormDTO = new PointsLogsAddFormDTO();
+ pointsLogsAddFormDTO.setUserId(dto.getUserId());
+ pointsLogsAddFormDTO.setNickname(userDTO.getNickname());
+ pointsLogsAddFormDTO.setFaceImg(userDTO.getFaceImg());
+ pointsLogsAddFormDTO.setReferenceId(dto.getReferenceId());
+ pointsLogsAddFormDTO.setRuleCode(pointsRuleResultDTO.getRuleCode());
+ pointsLogsAddFormDTO.setBehaviorCode(pointsRuleResultDTO.getBehaviorCode());
+ pointsLogsAddFormDTO.setOperationType(pointsRuleResultDTO.getOperationType());
+ pointsLogsAddFormDTO.setPoints(pointsRuleResultDTO.getPoints());
+ pointsLogsAddFormDTO.setOperationDesc(pointsRuleResultDTO.getRuleDesc());
+ pointsLogsAddFormDTO.setOperationTime(dto.getOperationTime());
+ pointsLogsAddFormDTO.setOperationMode("user");
+ pointsLogsAddFormDTO.setLavePoints(userDTO.getPoints());
+ PointsLogsEntity pointsLogsEntity = ConvertUtils.sourceToTarget(pointsLogsAddFormDTO, PointsLogsEntity.class);
+ pointsLogsService.insert(pointsLogsEntity);
+ }
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/mq/dto/BehaviorDto.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/mq/dto/BehaviorDto.java
new file mode 100644
index 0000000..7f17636
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/mq/dto/BehaviorDto.java
@@ -0,0 +1,51 @@
+package com.elink.esua.epdc.mq.dto;
+
+import lombok.Data;
+import org.springframework.expression.Operation;
+
+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;
+
+
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/dao/PointsRuleDao.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsBehaviorRedis.java
similarity index 57%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/dao/PointsRuleDao.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsBehaviorRedis.java
index 558b37d..2329ecc 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/dao/PointsRuleDao.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsBehaviorRedis.java
@@ -15,20 +15,33 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.rule.dao;
+package com.elink.esua.epdc.redis;
-import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
-import com.elink.esua.epdc.modules.rule.entity.PointsRuleEntity;
-import org.apache.ibatis.annotations.Mapper;
+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-11
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
*/
-@Mapper
-public interface PointsRuleDao extends BaseDao {
+@Component
+public class PointsBehaviorRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+ public void delete(Object[] ids) {
-}
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsBehaviorRuleRedis.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsBehaviorRuleRedis.java
new file mode 100644
index 0000000..e1990c6
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsBehaviorRuleRedis.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.redis;
+
+import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 积分动作规则关系表
+ *
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-05-11
+ */
+@Component
+public class PointsBehaviorRuleRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/redis/PointsLogsRedis.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsLogsRedis.java
similarity index 89%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/redis/PointsLogsRedis.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsLogsRedis.java
index 81776df..8a83791 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/redis/PointsLogsRedis.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsLogsRedis.java
@@ -15,17 +15,17 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.logs.redis;
+package com.elink.esua.epdc.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
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-04-29
*/
@Component
public class PointsLogsRedis {
@@ -44,4 +44,4 @@ public class PointsLogsRedis {
return null;
}
-}
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/redis/PointsRuleRedis.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java
similarity index 89%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/redis/PointsRuleRedis.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java
index dd7028f..4488fd2 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/redis/PointsRuleRedis.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java
@@ -15,17 +15,17 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.rule.redis;
+package com.elink.esua.epdc.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-11
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
*/
@Component
public class PointsRuleRedis {
@@ -44,4 +44,4 @@ public class PointsRuleRedis {
return null;
}
-}
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/service/PointsLogsService.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsBehaviorRuleService.java
similarity index 55%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/service/PointsLogsService.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsBehaviorRuleService.java
index 6d43ada..221b0b2 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/logs/service/PointsLogsService.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsBehaviorRuleService.java
@@ -15,55 +15,53 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.logs.service;
+package com.elink.esua.epdc.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.epdc.result.EpdcAdjustVolunteerPointsDTO;
-import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
-import com.elink.esua.epdc.modules.logs.entity.PointsLogsEntity;
+import com.elink.esua.epdc.dto.PointsBehaviorRuleDTO;
+import com.elink.esua.epdc.entity.PointsBehaviorRuleEntity;
import java.util.List;
import java.util.Map;
/**
- * 积分日志表
+ * 积分动作规则关系表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-13
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-05-11
*/
-public interface PointsLogsService extends BaseService {
+public interface PointsBehaviorRuleService extends BaseService {
/**
* 默认分页
*
* @param params
- * @return PageData
+ * @return PageData
* @author generator
- * @date 2019-12-13
+ * @date 2020-05-11
*/
- PageData page(Map params);
+ PageData page(Map params);
/**
* 默认查询
*
* @param params
- * @return java.util.List
+ * @return java.util.List
* @author generator
- * @date 2019-12-13
+ * @date 2020-05-11
*/
- List list(Map params);
+ List list(Map params);
/**
* 单条查询
*
* @param id
- * @return PointsLogsDTO
+ * @return PointsBehaviorRuleDTO
* @author generator
- * @date 2019-12-13
+ * @date 2020-05-11
*/
- PointsLogsDTO get(String id);
+ PointsBehaviorRuleDTO get(String id);
/**
* 默认保存
@@ -71,9 +69,9 @@ public interface PointsLogsService extends BaseService {
* @param dto
* @return void
* @author generator
- * @date 2019-12-13
+ * @date 2020-05-11
*/
- Result save(PointsLogsDTO dto);
+ void save(PointsBehaviorRuleDTO dto);
/**
* 默认更新
@@ -81,9 +79,9 @@ public interface PointsLogsService extends BaseService {
* @param dto
* @return void
* @author generator
- * @date 2019-12-13
+ * @date 2020-05-11
*/
- void update(PointsLogsDTO dto);
+ void update(PointsBehaviorRuleDTO dto);
/**
* 批量删除
@@ -91,16 +89,7 @@ public interface PointsLogsService extends BaseService {
* @param ids
* @return void
* @author generator
- * @date 2019-12-13
+ * @date 2020-05-11
*/
void delete(String[] ids);
-
- /**
- * @param formDto
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 确定调整用户积分
- * @Date 2019/12/16 18:56
- **/
- Result confirmAdjustPoint(EpdcAdjustVolunteerPointsDTO formDto);
-}
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsBehaviorService.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsBehaviorService.java
new file mode 100644
index 0000000..df87463
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsBehaviorService.java
@@ -0,0 +1,126 @@
+/**
+ * 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.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.PointsBehaviorDTO;
+import com.elink.esua.epdc.dto.result.BehaviorResultDto;
+import com.elink.esua.epdc.entity.PointsBehaviorEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分动作管理表 积分动作管理表
+ *
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+public interface PointsBehaviorService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-04-28
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-04-28
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return PointsBehaviorDTO
+ * @author generator
+ * @date 2020-04-28
+ */
+ PointsBehaviorDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return Result
+ * @author generator
+ * @date 2020-04-28
+ */
+ Result save(PointsBehaviorDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return Result
+ * @author generator
+ * @date 2020-04-28
+ */
+ Result update(PointsBehaviorDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return Result
+ * @author generator
+ * @date 2020-04-28
+ */
+ Result delete(String[] ids);
+
+ /**
+ * @return com.elink.esua.epdc.dto.result.BehaviorResultDto
+ * @Description 根据动作编码获取动作信息
+ * @Author songyunpeng
+ * @Date 2020/4/28
+ * @Param [behaviorCode]
+ **/
+ Result getBehaviorCodeInfoByBehaviorCode(String behaviorCode);
+
+
+ /**
+ * 获取全部的动作编码
+ *
+ * @Param: []
+ * @return: com.elink.esua.epdc.commons.tools.utils.Result>
+ * @Author: zy
+ * @Date: 2020-04-29
+ */
+ List listBehaviorDesc();
+
+ /**
+ * @Description 志愿者服务使用- 获取全部动作编码
+ * @Author songyunpeng
+ * @Date 2020/5/12
+ * @Param []
+ * @return java.util.List
+ **/
+ List selectAllListBehaviorDesc();
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsLogsService.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsLogsService.java
new file mode 100644
index 0000000..9e506aa
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsLogsService.java
@@ -0,0 +1,193 @@
+/**
+ * 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.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.EpdcAdjustUserPointsDTO;
+import com.elink.esua.epdc.dto.PointsLogsDTO;
+import com.elink.esua.epdc.dto.epdc.result.EpdcAdjustVolunteerPointsDTO;
+import com.elink.esua.epdc.dto.form.EpdcAppPointsRankingFormDTO;
+import com.elink.esua.epdc.dto.form.EpdcAppPointsRecordFormDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsFormDTO;
+import com.elink.esua.epdc.dto.result.EpdcAppPointsRankingResultDTO;
+import com.elink.esua.epdc.dto.result.EpdcAppPointsRecordResultDTO;
+import com.elink.esua.epdc.dto.result.PointsLogsResultDTO;
+import com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO;
+import com.elink.esua.epdc.entity.PointsLogsEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分记录表 积分记录表
+ *
+ * @author elink elink@elink-cn.com
+ * @since v1.0.0 2020-04-29
+ */
+public interface PointsLogsService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-04-29
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-04-29
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return PointsLogsDTO
+ * @author generator
+ * @date 2020-04-29
+ */
+ PointsLogsDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-04-29
+ */
+ Result save(PointsLogsDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-04-29
+ */
+ void update(PointsLogsDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-04-29
+ */
+ void delete(String[] ids);
+
+ /**
+ * 当前登录用户 积分记录接口
+ *
+ * @param formDto
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * param userId 必选 用户ID
+ * @return: java.util.List
+ * @Author: zy
+ * @Date: 2020-04-29
+ */
+ List listPointsRecord(EpdcAppPointsRecordFormDTO formDto);
+
+ /**
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Description 根据用户,业务ID,行为编码获取日志记录嘻嘻
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [pointsLogsFormDTO]
+ **/
+ List getLogsByBehaviorCodeAndUserIdAndReferenceId(PointsLogsFormDTO pointsLogsFormDTO);
+
+ /**
+ * @return java.lang.Integer
+ * @Description 根据行为编码和用户ID获取积分 该动作积分总和
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [pointsLogsFormDTO]
+ **/
+ Integer getPointsSumByBehaviorCodeAndUserId(PointsLogsFormDTO pointsLogsFormDTO);
+
+ /**
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Description 获取指定人指定动作的最新一条工作日志
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [pointsLogsFormDTO]
+ **/
+ PointsLogsResultDTO getLastPointLogs(PointsLogsFormDTO pointsLogsFormDTO);
+
+ /**
+ * @param formDto
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 确定调整用户积分
+ * @Date 2019/12/16 18:56
+ **/
+ Result confirmAdjustPoint(EpdcAdjustVolunteerPointsDTO formDto);
+
+ /**
+ * 积分排行接口(0 周排行、1 月排行)
+ *
+ * @param formDto
+ * param pageIndex 必选 页码
+ * param pageSize 必选 页容量
+ * param rankingType 必选 排名方式:0-周,1-月
+ * @return: com.elink.esua.epdc.dto.result.EpdcAppPointsRankingResultDTO>
+ * @Author: zy
+ * @Date: 2020-04-30
+ */
+ EpdcAppPointsRankingResultDTO listPointsRanking(EpdcAppPointsRankingFormDTO formDto);
+ /**
+ * @Description 积分管理-积分统计 -统计调整积分
+ * @Author songyunpeng
+ * @Date 2020/6/9
+ * @Param [formDto]
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ **/
+ Result confirmUserAdjustPoint(EpdcAdjustUserPointsDTO formDto);
+
+ /***
+ * 积分分类统计
+ * @param params
+ * @return com.elink.esua.epdc.commons.tools.page.PageData
+ * @author qushutong
+ * @date 2020/7/21 10:36
+ */
+ PageData listPagePoint(Map params);
+
+ /***
+ * 积分总览
+ * @param params
+ * @return com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO
+ * @author qushutong
+ * @date 2020/7/21 10:36
+ */
+ PointsStatisticsListResultDTO getPointsOverview(Map params);
+}
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/service/PointsRuleService.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java
similarity index 71%
rename from epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/service/PointsRuleService.java
rename to epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java
index 35436cc..5eb043e 100644
--- a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/modules/rule/service/PointsRuleService.java
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java
@@ -15,22 +15,26 @@
* along with this program. If not, see .
*/
-package com.elink.esua.epdc.modules.rule.service;
+package com.elink.esua.epdc.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.rule.PointsRuleDTO;
-import com.elink.esua.epdc.modules.rule.entity.PointsRuleEntity;
+import com.elink.esua.epdc.dto.PointsRuleDTO;
+import com.elink.esua.epdc.dto.form.PointsLogsFormDTO;
+import com.elink.esua.epdc.dto.result.BehaviorResultDto;
+import com.elink.esua.epdc.dto.result.PointsLogsResultDTO;
+import com.elink.esua.epdc.dto.result.PointsRuleResultDTO;
+import com.elink.esua.epdc.entity.PointsRuleEntity;
import java.util.List;
import java.util.Map;
/**
- * 积分规则表
+ * 积分规则管理表 积分规则管理表
*
- * @author qu qu@elink-cn.com
- * @since v1.0.0 2019-12-11
+ * @author zhangyong
+ * @since v1.0.0 2020-04-28
*/
public interface PointsRuleService extends BaseService {
@@ -40,7 +44,7 @@ public interface PointsRuleService extends BaseService {
* @param params
* @return PageData
* @author generator
- * @date 2019-12-11
+ * @date 2020-04-28
*/
PageData page(Map params);
@@ -50,7 +54,7 @@ public interface PointsRuleService extends BaseService {
* @param params
* @return java.util.List
* @author generator
- * @date 2019-12-11
+ * @date 2020-04-28
*/
List list(Map params);
@@ -60,7 +64,7 @@ public interface PointsRuleService extends BaseService {
* @param id
* @return PointsRuleDTO
* @author generator
- * @date 2019-12-11
+ * @date 2020-04-28
*/
PointsRuleDTO get(String id);
@@ -68,9 +72,9 @@ public interface PointsRuleService extends BaseService {
* 默认保存
*
* @param dto
- * @return void
+ * @return Result
* @author generator
- * @date 2019-12-11
+ * @date 2020-04-28
*/
Result save(PointsRuleDTO dto);
@@ -78,9 +82,9 @@ public interface PointsRuleService extends BaseService {
* 默认更新
*
* @param dto
- * @return void
+ * @return Result
* @author generator
- * @date 2019-12-11
+ * @date 2020-04-28
*/
Result update(PointsRuleDTO dto);
@@ -90,18 +94,18 @@ public interface PointsRuleService extends BaseService {
* @param ids
* @return void
* @author generator
- * @date 2019-12-11
+ * @date 2020-04-28
*/
void delete(String[] ids);
/**
- * @param
- * @return com.elink.esua.epdc.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 项目启动初始化积分规则到redis
- * @Date 2019/12/12 16:27
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Description 根据动作编码获取积分规则
+ * @Author songyunpeng
+ * @Date 2020/4/29
+ * @Param [behaviorCode]
**/
- Result initPointsRuleRedis();
+ PointsRuleResultDTO getPointsRuleByBehaviorCode(String behaviorCode);
/**
* @param ruleCode
@@ -111,4 +115,13 @@ public interface PointsRuleService extends BaseService {
* @Date 2019/12/12 16:30
**/
Result getPointRule(String ruleCode);
-}
+
+ /**
+ * @param
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 项目启动初始化积分规则到redis
+ * @Date 2019/12/12 16:27
+ **/
+ Result initPointsRuleRedis();
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/impl/PointsBehaviorRuleServiceImpl.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/impl/PointsBehaviorRuleServiceImpl.java
new file mode 100644
index 0000000..1d79b3e
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/impl/PointsBehaviorRuleServiceImpl.java
@@ -0,0 +1,104 @@
+/**
+ * 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.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.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
+import com.elink.esua.epdc.dao.PointsBehaviorRuleDao;
+import com.elink.esua.epdc.dto.PointsBehaviorRuleDTO;
+import com.elink.esua.epdc.entity.PointsBehaviorRuleEntity;
+import com.elink.esua.epdc.redis.PointsBehaviorRuleRedis;
+import com.elink.esua.epdc.service.PointsBehaviorRuleService;
+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 elink elink@elink-cn.com
+ * @since v1.0.0 2020-05-11
+ */
+@Service
+public class PointsBehaviorRuleServiceImpl extends BaseServiceImpl implements PointsBehaviorRuleService {
+
+ @Autowired
+ private PointsBehaviorRuleRedis pointsBehaviorRuleRedis;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, PointsBehaviorRuleDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, PointsBehaviorRuleDTO.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 PointsBehaviorRuleDTO get(String id) {
+ PointsBehaviorRuleEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, PointsBehaviorRuleDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(PointsBehaviorRuleDTO dto) {
+ PointsBehaviorRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsBehaviorRuleEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(PointsBehaviorRuleDTO dto) {
+ PointsBehaviorRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsBehaviorRuleEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/impl/PointsBehaviorServiceImpl.java b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/impl/PointsBehaviorServiceImpl.java
new file mode 100644
index 0000000..8bca665
--- /dev/null
+++ b/epdc-cloud-points/src/main/java/com/elink/esua/epdc/service/impl/PointsBehaviorServiceImpl.java
@@ -0,0 +1,207 @@
+/**
+ * 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.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.NumConstant;
+import com.elink.esua.epdc.commons.tools.exception.ErrorCode;
+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.constant.FieldConstant;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dao.PointsBehaviorDao;
+import com.elink.esua.epdc.dto.PointsBehaviorDTO;
+import com.elink.esua.epdc.dto.result.BehaviorResultDto;
+import com.elink.esua.epdc.entity.PointsBehaviorEntity;
+import com.elink.esua.epdc.redis.PointsBehaviorRedis;
+import com.elink.esua.epdc.service.PointsBehaviorService;
+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 zhangyong
+ * @since v1.0.0 2020-04-28
+ */
+@Service
+public class PointsBehaviorServiceImpl extends BaseServiceImpl implements PointsBehaviorService {
+
+ @Autowired
+ private PointsBehaviorRedis pointsBehaviorRedis;
+
+ @Autowired
+ private RedisUtils redisUtils;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = getPage(params);
+ List list = baseDao.selectListPointsBehavior(params);
+ return new PageData<>(list, page.getTotal());
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, PointsBehaviorDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params) {
+ String id = (String) params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper