Browse Source

Merge remote-tracking branch 'origin/dev_heart' into dev_heart

# Conflicts:
#	epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
#	epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml
dev_shibei_match
yinzuomei 5 years ago
parent
commit
0c966dcdd5
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  2. 42
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java
  3. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  4. 6
      epmet-module/epmet-heart/epmet-heart-client/pom.xml
  5. 46
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java
  6. 38
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java
  7. 93
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  8. 100
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java
  9. 106
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java
  10. 56
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java
  11. 140
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java
  12. 18
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java
  13. 99
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java
  14. 55
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java
  15. 60
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java
  16. 46
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  17. 31
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  18. 123
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  19. 52
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  20. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java
  21. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java
  22. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java
  23. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  24. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java
  25. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java
  26. 78
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java
  27. 71
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java
  28. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java
  29. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java
  30. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java
  31. 71
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  32. 198
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  33. 128
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  34. 124
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java
  35. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java
  36. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  37. 39
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java
  38. 66
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  39. 43
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java
  40. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java
  41. 90
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java
  42. 69
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  43. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml
  44. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml
  45. 35
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml
  46. 28
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml
  47. 126
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java
  48. 21
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java
  49. 71
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java
  50. 23
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java
  51. 18
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java
  52. 24
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java
  53. 23
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java
  54. 12
      epmet-module/epmet-point/epmet-point-server/pom.xml
  55. 42
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java
  56. 43
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java
  57. 40
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java
  58. 100
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java
  59. 23
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java
  60. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java
  61. 32
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java
  62. 14
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java
  63. 76
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java
  64. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java
  65. 199
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java
  66. 22
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java
  67. 52
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/epmet_point.sql
  68. 19
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml
  69. 4
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml
  70. 10
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  71. 18
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  72. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java
  73. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java
  74. 41
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java
  75. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java
  76. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
  77. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java
  78. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java
  79. 19
      epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -48,4 +48,9 @@ public interface StrConstant {
* 中文顿号
*/
String COMMA_ZH = "、";
/**
* 反斜杠
*/
String SEPARATOR = "/";
}

42
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java

@ -0,0 +1,42 @@
package com.epmet.commons.tools.enums;
/**
* 通用操作类型 枚举类
* dev|test|prod
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum CommonOperateTypeEnum {
ADD("add", "添加"),
EDIT("edit", "编辑"),
DEL("del", "删除"),
;
private String code;
private String desc;
CommonOperateTypeEnum(String code, String name) {
this.code = code;
this.desc = name;
}
public static CommonOperateTypeEnum getEnum(String code) {
CommonOperateTypeEnum[] values = CommonOperateTypeEnum.values();
for (CommonOperateTypeEnum value : values) {
if (code != null && value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -74,6 +74,9 @@ public enum EpmetErrorCode {
IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"),
PROJECT_IS_CLOSED(8601,"项目已结案"),
// 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),

6
epmet-module/epmet-heart/epmet-heart-client/pom.xml

@ -26,6 +26,12 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

46
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java

@ -0,0 +1,46 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动内容(活动详情-已结束-回顾稿) 入参
*
* @Auther: zhangyong
* @Date: 2020-07-21 18:12
*/
@Data
public class ResiActContentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private String actId;
/**
* 页码从1开始
*/
@Min(value = 1, message = "页码必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private Integer pageNo;
/**
* 页容量默认20页
*/
@Min(value = 1, message = "每页条数必须大于必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private Integer pageSize;
}

38
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动详情 入参
*
* @Auther: zhangyong
* @Date: 2020-07-21 18:12
*/
@Data
public class ResiActDetailFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private String actId;
/**
* 用户id
*/
private String userId;
}

93
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java

@ -0,0 +1,93 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 活动-添加实况 入参
*
* @author zhangyong
* @since v1.0.0 2020-07-23
*/
@Data
public class ResiActInsertLiveFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动ID
*/
@NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 活动签到描述
*/
private String desc;
/**
* 活动签到位置经度
*/
@NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal longitude;
/**
* 活动签到位置纬度
*/
@NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal latitude;
/**
* 活动签到地址
*/
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
private String address;
/**
* 图片
*/
private List<String> images;
/**
* 用户id
*/
private String userId;
}

100
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java

@ -0,0 +1,100 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.awt.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 活动签到 入参
*
* @author zhangyong
* @since v1.0.0 2020-07-23
*/
@Data
public class ResiActSignInFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动ID
*/
@NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 活动签到描述
*/
private String desc;
/**
* 活动签到位置经度
*/
@NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal longitude;
/**
* 活动签到位置纬度
*/
@NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal latitude;
/**
* 活动签到地址
*/
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
private String address;
/**
* 图片
*/
private List<String> images;
/**
* 0不同步实况1同步到实况记录
*/
@NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
private Integer syncLive;
/**
* 用户id
*/
private String userId;
}

106
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java

@ -0,0 +1,106 @@
package com.epmet.dto.form.resi;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 志愿者认证 入参
*
* @Auther: zhangyong
* @Date: 2020-07-23 09:57
*/
@Data
public class ResiVolunteerAuthenticateFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
*
*/
@NotBlank(message = "姓不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String surname;
/**
*
*/
@NotBlank(message = "名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String name;
/**
* 性别1男2女0未知
*/
@NotBlank(message = "性别不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String gender;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String mobile;
/**
* 身份证号码
*/
@NotBlank(message = "身份证号码不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String idNum;
/**
* 街道
*/
@NotBlank(message = "街道不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String street;
/**
* 小区名
*/
@NotBlank(message = "小区名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String district;
/**
* 楼栋单元
*/
@NotBlank(message = "楼栋单元不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String buildingAddress;
/**
* 志愿者自我介绍
*/
private String volunteerIntroduce;
/**
* 昵称
*/
@NotBlank(message = "昵称不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String nickname;
/**
* 头像
*/
@NotBlank(message = "头像不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class })
private String headImgUrl;
/**
* 志愿者签名
*/
private String volunteerSignature;
}

56
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 活动内容
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiActContentResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actContentId;
/**
* 内容
*/
private String content;
/**
* 内容类型 图片img文字text
*/
private String contentType;
/**
* 内容顺序 从1开始
*/
private Integer orderNum;
}

140
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java

@ -0,0 +1,140 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 活动详情
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class ResiActDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actId;
/**
* 标题
*/
private String title;
/**
* 联系人
*/
private String contacts;
/**
* 联系电话
*/
private String tel;
/**
* 报名截止时间yyyy-MM-dd HH:mm
*/
private String signUpEndTime;
/**
* 活动开始时间yyyy-MM-dd HH:mm
*/
private String actStartTime;
/**
* 活动结束时间yyyy-MM-dd HH:mm
*/
private String actEndTime;
/**
* 活动地点
*/
private String actAddress;
/**
* 活动名额类型true:固定名额 false 不限制名额
*/
private Boolean actQuotaCategory;
/**
* 活动名额
*/
private Integer actQuota;
/**
* 已报名人数
*/
private Integer signupNum;
/**
* 积分奖励
*/
private Integer reward;
/**
* 招募要求
*/
private String requirement;
/**
* 活动详情
*/
private List<ResiActContentResultDTO> actContent;
/**
* 用户当前状态sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消
*/
private String currentUserStatus;
/**
* 用户是否是志愿者身份 (truefalse 不是)
*/
private Boolean userVolunteerFlag;
/**
* 是否需要是志愿者true只有志愿者才可以参加活动false: 只要是居民就可以参加活动
*/
private Boolean volunteerLimit;
/**
* 活动实际开始时间yyyy-MM-dd HH:mm
*/
private String actualStartTime;
/**
* 活动实际结束时间yyyy-MM-dd HH:mm
*/
private String actualEndTime;
/**
* 主办方
*/
private String sponsor;
/**
* 是否已签到(true已签到false未签到)
*/
private Boolean isSignUp;
}

18
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java → epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java

@ -22,27 +22,25 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 打卡列表
* 活动详情-已结束-现场实况列表
*
* @author zhangyong
* @since v1.0.0 2020-07-14
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ActClockListResultDTO implements Serializable {
public class ResiActLiveRecResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 活动打卡人次
* 现场实况次数
*/
private Integer clockNum;
private Integer actLiveNum;
/**
* 打卡列表
*/
private List<Object> clocks;
private List<Object> actLives;
}

99
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java

@ -0,0 +1,99 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 活动详情-未通过
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class ResiActRefusedDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actId;
/**
* 标题
*/
private String title;
/**
* 报名截止时间yyyy-MM-dd HH:mm
*/
private String signUpEndTime;
/**
* 活动开始时间yyyy-MM-dd HH:mm
*/
private String actStartTime;
/**
* 活动结束时间yyyy-MM-dd HH:mm
*/
private String actEndTime;
/**
* 活动地点
*/
private String actAddress;
/**
* 活动名额类型true:固定名额 false 不限制名额
*/
private Boolean actQuotaCategory;
/**
* 活动名额
*/
private Integer actQuota;
/**
* 联系人
*/
private String contacts;
/**
* 联系电话
*/
private String tel;
/**
* 积分奖励
*/
private Integer reward;
/**
* 主办方
*/
private String sponsor;
/**
* 未通过原因
*/
private String failureReason;
}

55
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 活动回顾列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiActSummaryResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String summaryId;
/**
* 内容
*/
private String content;
/**
* 内容类型 图片img文字text
*/
private String contentType;
/**
* 内容顺序 从1开始
*/
private Integer orderNum;
}

60
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java

@ -0,0 +1,60 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 爱心榜
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiLeaderboardResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 微信昵称
*/
private String nickname;
/**
* 微信头像
*/
private String headImg;
/**
* 是否是志愿者true是志愿者false: 不是志愿者
*/
private Boolean volunteerFlag;
/**
* 爱心时长(单位小时)
*/
private Integer kindnessTime;
/**
* 参加次数
*/
private Integer participationNum;
}

46
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -0,0 +1,46 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 用户模块
*
* @author zhangyong
* @date 2020/7/22 14:51
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
public interface EpmetUserFeignClient {
/**
* @param userIds
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.UserBaseInfoResultDTO>>
* @author zhangyong
* @description 传入用户id集合返回用户的基本信息包含微信基本信息
* @Date 2020/7/22 9:30
**/
@PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo")
Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(@RequestBody List<String> userIds);
/**
* 根据用户ID查询用户所属角色: 多种身份
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.UserRoleResultDTO>>
* @Author zhangyong
* @Date 14:13 2020-07-23
**/
@PostMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(@PathVariable("userId") String userId);
}

31
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -0,0 +1,31 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhangyong
* @date 2020/7/22 14:51
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(List<String> userIds) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds);
}
@Override
public Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId);
}
}

123
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java

@ -5,7 +5,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.resi.*;
import com.epmet.dto.result.resi.*;
import com.epmet.service.ActInfoService;
import com.epmet.service.*;
import com.epmet.commons.tools.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 居民端-活动列表相关api
* 居民端-活动相关api
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/19 23:17
@ -25,6 +25,21 @@ public class ResiActListController {
@Autowired
private ActInfoService actInfoService;
@Autowired
private ActUserRelationService actUserRelationService;
@Autowired
private ActSummaryService actSummaryService;
@Autowired
private ActLiveRecService actLiveRecService;
@Autowired
private HeartUserInfoService heartUserInfoService;
@Autowired
private ActSignInRecService actSignInRecService;
/**
* 活动列表(包含状态报名中signing_up已报满enough截止报名: end_sign_up; 已开始 in_progress; 已结束finished)
*
@ -135,6 +150,64 @@ public class ResiActListController {
return actInfoService.actLookBack(formDto);
}
//
/**
* 活动详情
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("detail")
public Result<ResiActDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) {
return actInfoService.actDetail(tokenDto, formDto);
}
/**
* 活动详情-未通过
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("rejectdetail")
public Result<ResiActRefusedDetailResultDTO> rejectDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) {
return actInfoService.rejectDetail(tokenDto, formDto);
}
/**
* 活动详情-已结束-回顾稿
*
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActSummaryResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("summary/list")
public Result<ResiActSummaryResultDTO> summaryList(@RequestBody ResiActContentFormDTO formDto) {
return actSummaryService.summaryList(formDto);
}
/**
* 活动详情-已结束-现场实况列表
*
* @param actId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActLiveRecResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("livereclist")
public Result<ResiActLiveRecResultDTO> liveRecList(@RequestBody String actId) {
return actLiveRecService.liveRecList(actId);
}
//
/**
* 取消活动报名
*
@ -147,7 +220,7 @@ public class ResiActListController {
@PostMapping("cancelsignup")
public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return actInfoService.cancelSignUp(tokenDto, formDTO);
return actUserRelationService.cancelSignUp(tokenDto, formDTO);
}
/**
@ -165,4 +238,48 @@ public class ResiActListController {
return actInfoService.checkSignInAddress(formDTO);
}
/**
* 爱心榜
* 显示报名参加过活动的用户/志愿者
* 排序规则按照爱心时长一致按照参加次数排序
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLeaderboardResultDTO>>
* @Author zhangyong
* @Date 17:42 2020-07-22
**/
@PostMapping("leaderboard")
public Result<List<ResiLeaderboardResultDTO>> leaderboard(@RequestBody ResiActBaseFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return heartUserInfoService.leaderboard(formDTO);
}
/**
* 活动-添加实况
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 10:29 2020-07-23
**/
@PostMapping("insertlive")
public Result inSertlive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return actLiveRecService.inSertlive(tokenDto, formDTO);
}
/**
* 活动-签到
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 10:29 2020-07-23
**/
@PostMapping("signin")
public Result actSignIn(@LoginUser TokenDto tokenDto, @RequestBody ResiActSignInFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return actSignInRecService.actSignIn(tokenDto, formDTO);
}
}

52
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -0,0 +1,52 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.service.VolunteerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 居民端-志愿者相关api
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@RestController
@RequestMapping("/resi/volunteer")
public class ResiVolunteerController {
@Autowired
private VolunteerInfoService volunteerInfoService;
@PostMapping("authenticate")
public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return volunteerInfoService.authenticate(tokenDto, formDTO);
}
}

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.form.resi.ResiActDetailFormDTO;
import com.epmet.dto.form.resi.ResiLatestActFormDTO;
import com.epmet.dto.form.resi.ResiMyActFormDTO;
import com.epmet.dto.result.resi.*;
@ -184,4 +185,34 @@ public interface ActInfoDao extends BaseDao<ActInfoEntity> {
* @Date 2020/7/22 17:08
**/
ActSignUpStatResultDTO getActSignUpStat(String actId);
/**
* 活动详情
*
* @param formDto
* @return com.epmet.dto.result.resi.ResiActDetailResultDTO
* @Author zhangyong
* @Date 09:20 2020-07-22
**/
ResiActDetailResultDTO selectActInfoDetail(ResiActDetailFormDTO formDto);
/**
* 活动详情-未通过
*
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
ResiActRefusedDetailResultDTO selectActRejectDetail(ResiActDetailFormDTO formDto);
/**
* 从活动内容表查询活动内容
*
* @param actId
* @return java.util.List<com.epmet.dto.result.resi.ResiActContentResultDTO>
* @Author zhangyong
* @Date 09:56 2020-07-22
**/
List<ResiActContentResultDTO> selectListActContent(@Param("actId") String actId);
}

29
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java

@ -18,8 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ActLivePicDTO;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.entity.ActLiveRecEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 活动实况记录
@ -29,5 +35,24 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ActLiveRecDao extends BaseDao<ActLiveRecEntity> {
}
/**
* 根据活动id查询活动下的所有活动实况
*
* @param actId
* @return java.util.List<com.epmet.dto.ActLiveRecDTO>
* @Author zhangyong
* @Date 16:27 2020-07-22
**/
List<ActLiveRecDTO> selectListActLives(@Param("actId") String actId);
/**
* 根据实况id查询每条实况对应的多张图片
*
* @param liveIds
* @return java.util.List<com.epmet.dto.ActLivePicDTO>
* @Author zhangyong
* @Date 17:04 2020-07-22
**/
List<ActLivePicDTO> selectListActLiveImg(@Param("liveId") List liveIds);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java

@ -18,6 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActSummaryResultDTO;
import com.epmet.entity.ActSummaryEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ActSummaryDao extends BaseDao<ActSummaryEntity> {
}
/**
* 活动详情-已结束-回顾稿
*
* @param formDto
* @return com.epmet.dto.result.resi.ResiActSummaryResultDTO
* @Author zhangyong
* @Date 15:11 2020-07-22
**/
ResiActSummaryResultDTO selectListSummary(ResiActContentFormDTO formDto);
}

22
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java

@ -62,6 +62,26 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
**/
Integer selectCountUser(@Param("actId") String actId, @Param("status")String status);
/**
* 根据活动id查询活动已报名的人数
*
* @param actId
* @return Integer
* @Author zhangyong
* @Date 10:51 2020-07-22
**/
Integer selectActSignupNum(@Param("actId") String actId);
/**
* 根据用户id和活动id修改 用户活动关系表
*
* @param userRelationDTO
* @return void
* @Author zhangyong
* @Date 14:39 2020-07-22
**/
void updateUserRelationByActIdAndUserId(ActUserRelationDTO userRelationDTO);
/**
* @return java.lang.Integer
* @param userId
@ -88,4 +108,4 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
* @Date 2020/7/23 15:57
**/
Integer countObtainPointsActNum(String userId);
}
}

29
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java

@ -19,8 +19,12 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.entity.HeartUserInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户信息
@ -39,4 +43,27 @@ public interface HeartUserInfoDao extends BaseDao<HeartUserInfoEntity> {
* @Date 2020/7/21 22:48
**/
HeartUserInfoDTO selectByUserId(String userId);
}
/**
* 查询用户是否是志愿者1是志愿者0不是志愿者
*
* @param userId
* @return java.lang.Integer
* @Author zhangyong
* @Date 13:53 2020-07-22
**/
Integer selectUserVolunteerFlag(@Param("userId") String userId);
/**
* 爱心榜
* 显示报名参加过活动的用户/志愿者
* 排序规则按照爱心时长一致按照参加次数排序
*
* @param formDTO
* @return java.util.List<com.epmet.dto.HeartUserInfoDTO>
* @Author zhangyong
* @Date 18:06 2020-07-22
**/
List<HeartUserInfoDTO> selectListLeaderboard(ResiActBaseFormDTO formDTO);
}

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java

@ -192,13 +192,24 @@ public interface ActInfoService extends BaseService<ActInfoEntity> {
Result<List<ResiLookBackActResultDTO>> actLookBack(ResiActBaseFormDTO formDTO);
/**
* 取消活动报名
* 活动详情
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActDetailResultDTO>
* @Author zhangyong
* @Date 09:29 2020-07-20
* @Date 13:39 2020-07-21
**/
Result<ResiActDetailResultDTO> actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto);
/**
* 活动详情-未通过
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO);
Result<ResiActRefusedDetailResultDTO> rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto);
}

78
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java

@ -19,7 +19,13 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLiveRecEntity;
import java.util.List;
@ -34,62 +40,24 @@ import java.util.Map;
public interface ActLiveRecService extends BaseService<ActLiveRecEntity> {
/**
* 默认分页
* 活动详情-已结束-现场实况列表
*
* @param params
* @return PageData<ActLiveRecDTO>
* @author generator
* @date 2020-07-19
*/
PageData<ActLiveRecDTO> page(Map<String, Object> params);
* @param actId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActLiveRecResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result<ResiActLiveRecResultDTO> liveRecList(String actId);
/**
* 默认查询
* 活动-添加实况
* 返回实况id主要是因为当签到并转发实况时表中需要存储实况ID
*
* @param params
* @return java.util.List<ActLiveRecDTO>
* @author generator
* @date 2020-07-19
*/
List<ActLiveRecDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ActLiveRecDTO
* @author generator
* @date 2020-07-19
*/
ActLiveRecDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-19
*/
void save(ActLiveRecDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-19
*/
void update(ActLiveRecDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-19
*/
void delete(String[] ids);
}
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author zhangyong
* @Date 13:40 2020-07-23
**/
Result<String> inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO);
}

71
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActSignInRecDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.entity.ActSignInRecEntity;
import java.util.List;
@ -32,64 +35,14 @@ import java.util.Map;
* @since v1.0.0 2020-07-19
*/
public interface ActSignInRecService extends BaseService<ActSignInRecEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ActSignInRecDTO>
* @author generator
* @date 2020-07-19
*/
PageData<ActSignInRecDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ActSignInRecDTO>
* @author generator
* @date 2020-07-19
*/
List<ActSignInRecDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ActSignInRecDTO
* @author generator
* @date 2020-07-19
*/
ActSignInRecDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-19
*/
void save(ActSignInRecDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-19
*/
void update(ActSignInRecDTO dto);
/**
* 批量删除
* 活动-签到
*
* @param ids
* @return void
* @author generator
* @date 2020-07-19
*/
void delete(String[] ids);
}
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 10:29 2020-07-23
**/
Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActSummaryDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActSummaryResultDTO;
import com.epmet.entity.ActSummaryEntity;
import java.util.List;
@ -92,4 +95,14 @@ public interface ActSummaryService extends BaseService<ActSummaryEntity> {
* @date 2020-07-19
*/
void delete(String[] ids);
}
/**
* 活动详情-已结束-回顾稿
*
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActSummaryResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result<ResiActSummaryResultDTO> summaryList(ResiActContentFormDTO formDto);
}

17
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.entity.ActUserRelationEntity;
import org.apache.ibatis.annotations.Param;
@ -123,4 +126,16 @@ public interface ActUserRelationService extends BaseService<ActUserRelationEntit
* @Date 2020/7/22 18:17
**/
Integer selectCountUser(@Param("actId") String actId, @Param("status") String status);
}
/**
* 取消活动报名
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 09:29 2020-07-20
**/
Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO);
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.result.resi.ResiLeaderboardResultDTO;
import com.epmet.entity.HeartUserInfoEntity;
import java.util.List;
@ -101,4 +104,17 @@ public interface HeartUserInfoService extends BaseService<HeartUserInfoEntity> {
* @Date 2020/7/21 22:48
**/
HeartUserInfoDTO getByUserId(String userId);
}
/**
* 爱心榜
* 显示报名参加过活动的用户/志愿者
* 排序规则按照爱心时长一致按照参加次数排序
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLeaderboardResultDTO>>
* @Author zhangyong
* @Date 17:42 2020-07-22
**/
Result<List<ResiLeaderboardResultDTO>> leaderboard(ResiActBaseFormDTO formDTO);
}

71
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.entity.VolunteerInfoEntity;
import java.util.List;
@ -34,62 +37,14 @@ import java.util.Map;
public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
/**
* 默认分页
* 志愿者认证
*
* @param params
* @return PageData<VolunteerInfoDTO>
* @author generator
* @date 2020-07-19
*/
PageData<VolunteerInfoDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<VolunteerInfoDTO>
* @author generator
* @date 2020-07-19
*/
List<VolunteerInfoDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return VolunteerInfoDTO
* @author generator
* @date 2020-07-19
*/
VolunteerInfoDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-19
*/
void save(VolunteerInfoDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-19
*/
void update(VolunteerInfoDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-19
*/
void delete(String[] ids);
}
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 10:09 2020-07-23
**/
Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO);
}

198
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

@ -29,23 +29,26 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActInfoDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.form.resi.*;
import com.epmet.dto.result.resi.*;
import com.epmet.entity.ActInfoEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.redis.ActInfoRedis;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ActUserRelationStatusConstant;
import com.epmet.utils.ActUserStatusConstant;
import com.epmet.utils.CaculateDistance;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 活动信息
@ -62,6 +65,12 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
@Autowired
private ActUserRelationService relationService;
@Autowired
private ActUserRelationDao actUserRelationDao;
@Autowired
private HeartUserInfoDao heartUserInfoDao;
@Override
public PageData<ActInfoDTO> page(Map<String, Object> params) {
IPage<ActInfoEntity> page = baseDao.selectPage(
@ -189,17 +198,165 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
}
@Override
public Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO) {
// 判断用户是否已报名该活动
ActInfoDTO actInfoDTO = baseDao.queryActAccordingToActIdAndUserId(formDTO.getActId(),formDTO.getUserId());
// if (null == actInfoDTO){
// throw new RenException(EpmetErrorCode.NO_ACT_TO_CANCEL_SIGN_UP_WERE_FOUND.getCode());
// }
//1、更新用户活动关系表
// relationService.update();
//2、插入用户活动关系日志表
//3、更新act_info的已报名名额
return null;
public Result<ResiActDetailResultDTO> actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
// 从活动表查询活动信息
ResiActDetailResultDTO detailResultDTO = baseDao.selectActInfoDetail(formDto);
// 获取活动内容
detailResultDTO.setActContent(baseDao.selectListActContent(formDto.getActId()));
// 查询用户是否是志愿者
Integer volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId());
detailResultDTO.setUserVolunteerFlag(volunteerFlag == 1);
// 获取用户报名状态
String currentUserStatus = getCurrentUserStatus(formDto.getActId(), formDto.getUserId());
detailResultDTO.setCurrentUserStatus(currentUserStatus);
return new Result<ResiActDetailResultDTO>().ok(detailResultDTO);
}
/**
* 返回当前活动下用户状态
* sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消
*
* @param actId 活动id
* @param userId 用户id
* @return java.lang.String
* @Author zhangyong
* @Date 2020/7/22 10:54
**/
private String getCurrentUserStatus(String actId, String userId) {
Date currentTime = new Date();
ActInfoEntity actInfoEntity =baseDao.selectById(actId);
// 活动已取消
if (ActUserStatusConstant.CANCELED.equals(actInfoEntity.getActStatus())) {
return ActUserStatusConstant.CANCELED;
}
// 活动已经结束
if (ActUserStatusConstant.FINISHED.equals(actInfoEntity.getActStatus())) {
return ActUserStatusConstant.FINISHED;
}
// 查询用户是否报名该活动
QueryWrapper<ActUserRelationEntity> actUserRelationWrapper = new QueryWrapper<>();
actUserRelationWrapper.eq("ACT_ID", actId)
.eq("USER_ID", userId)
.orderByDesc("CREATED_TIME").last("limit 1");
ActUserRelationEntity actUserRelationEntity = actUserRelationDao.selectOne(actUserRelationWrapper);
// 查询活动已报名的人数
Integer signUpNum = actUserRelationDao.selectActSignupNum(actId);
if (null == actUserRelationEntity) {
return getCurrentUserStatusNotSignUp(actInfoEntity, signUpNum, currentTime);
} else {
return getCurrentUserStatusHasSignUp(actInfoEntity, actUserRelationEntity, signUpNum, currentTime);
}
}
/**
* 用户未报名活动时判断用户活动状态
*
* @param actInfoEntity 当前活动
* @param signUpNum 活动报名人数
* @param currentTime 当前时间
* @return java.lang.String
* @author zhangyong
* @date 2020/7/22 10:54
*/
private String getCurrentUserStatusNotSignUp(ActInfoEntity actInfoEntity, Integer signUpNum, Date currentTime) {
if (currentTime.before(actInfoEntity.getSignUpEndTime())) {
/*报名结束前*/
if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) || actInfoEntity.getActQuota() > signUpNum) {
// 我要报名(不限名额或者未报满的)
return ActUserStatusConstant.SIGN_UP;
} else {
// 已报满(限制名额且已经报满的)
return ActUserStatusConstant.ENOUGH;
}
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/*报名结束,活动未开始:显示:截止报名*/
return ActUserStatusConstant.END_SIGN_UP;
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
// 活动打卡时间段内: 显示:已开始
return ActUserStatusConstant.IN_PROGRESS;
} else {
return ActUserStatusConstant.FINISHED;
}
}
/**
* 用户已报名活动时判断用户活动状态
*
* @param actInfoEntity 当前活动
* @param actUserRelationEntity 用户活动关系
* @param signUpNum 活动报名人数
* @param currentTime 当前时间
* @return java.lang.String
* @author zhangyong
* @date 2020/7/22 17:11
*/
private String getCurrentUserStatusHasSignUp(ActInfoEntity actInfoEntity, ActUserRelationEntity actUserRelationEntity, Integer signUpNum, Date currentTime) {
String actUserStatus = actUserRelationEntity.getStatus();
// 已确认过积分,直接返回
if (ActUserRelationStatusConstant.AGREE.equals(actUserRelationEntity.getRewardFlag())
|| ActUserRelationStatusConstant.DENY.equals(actUserRelationEntity.getRewardFlag())) {
return ActUserStatusConstant.POINTS_CONFIRM;
}
if (currentTime.after(actInfoEntity.getActEndTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/*活动结束;打卡未截止*/
// (未审核的、审核未通过、取消报名的)- 已结束
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)
|| ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)
|| ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.FINISHED;
}
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/* 活动打卡时间段内 */
// (未审核的、审核未通过、取消报名的)- 已开始
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)
|| ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)
|| ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.IN_PROGRESS;
}
} else if (currentTime.before(actInfoEntity.getSignUpEndTime())) {
/* 报名截至时间前 */
//(未审核、审核通过的)底部显示按钮 取消报名
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus) || ActUserRelationStatusConstant.PASSED.equals(actUserStatus)) {
return ActUserStatusConstant.CANCELD;
}
// 活动限制名额,且报名人数已满 已报满
if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) && signUpNum >= actInfoEntity.getActQuota()) {
return ActUserStatusConstant.ENOUGH;
}
// (报名审核未通过或者已经取消报名的)可再次报名-我要报名
if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.SIGN_UP;
}
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/* 报名截止但 活动未开始 */
// 已经取消报名的-报名截止
if (ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.END_SIGN_UP;
}
// 已报名审核不通过 -报名截止
if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)) {
return ActUserStatusConstant.END_SIGN_UP;
}
// 已报名且审核通过、未审核 -取消报名
if (ActUserRelationStatusConstant.PASSED.equals(actUserStatus) || ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)) {
return ActUserStatusConstant.CANCELD;
}
}
return ActUserStatusConstant.FINISHED;
}
@Override
public Result<ResiActRefusedDetailResultDTO> rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
ResiActRefusedDetailResultDTO detail = baseDao.selectActRejectDetail(formDto);
return new Result<ResiActRefusedDetailResultDTO>().ok(detail);
}
@Override
@ -207,11 +364,10 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
// 根据活动id,查询活动基本信息
ActInfoEntity entity = baseDao.selectById(formDTO.getActId());
Double distance = CaculateDistance.getDistance(formDTO.getLongitude(),formDTO.getLatitude(),entity.getActLongitude().doubleValue(),entity.getActLatitude().doubleValue());
// if (distance <= entity.getSigninRadius()){
// return new Result();
// } else {
// throw new RenException(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getCode());
// }
return new Result();
if (distance <= entity.getSignInRadius()){
return new Result();
} else {
throw new RenException(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getCode());
}
}
}

128
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java

@ -17,25 +17,29 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActLivePicDao;
import com.epmet.dao.ActLiveRecDao;
import com.epmet.dao.ActUserLogDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActLivePicDTO;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLivePicEntity;
import com.epmet.entity.ActLiveRecEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.ActLiveRecRedis;
import com.epmet.service.ActLiveRecService;
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;
import java.util.*;
/**
* 活动实况记录
@ -49,56 +53,72 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
@Autowired
private ActLiveRecRedis actLiveRecRedis;
@Override
public PageData<ActLiveRecDTO> page(Map<String, Object> params) {
IPage<ActLiveRecEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ActLiveRecDTO.class);
}
@Override
public List<ActLiveRecDTO> list(Map<String, Object> params) {
List<ActLiveRecEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ActLiveRecDTO.class);
}
private QueryWrapper<ActLiveRecEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ActLiveRecEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ActLiveRecDTO get(String id) {
ActLiveRecEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ActLiveRecDTO.class);
}
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ActLiveRecDTO dto) {
ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class);
insert(entity);
}
@Autowired
private ActLivePicDao actLivePicDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ActLiveRecDTO dto) {
ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class);
updateById(entity);
public Result<ResiActLiveRecResultDTO> liveRecList(String actId) {
// 查询实况记录
List<ActLiveRecDTO> actLives = baseDao.selectListActLives(actId);
List<String> userIds = new ArrayList<>();
List<String> liveIds = new ArrayList<>();
for (ActLiveRecDTO actLive : actLives){
userIds.add(actLive.getUserId());
liveIds.add(actLive.getId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds);
// 根据活动实况id,查询对应实况的图片集合
List<ActLivePicDTO> actLiveImg = baseDao.selectListActLiveImg(liveIds);
// 数据汇总
ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO();
List<Object> dataContainer = new ArrayList<>();
for (int k = 0; k < actLives.size(); k++) {
Map<String, Object> map = new HashMap<>();
map.put("nickname", userWxInfos.getData().get(k).getNickname());
map.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl());
map.put("desc", actLives.get(k).getDesc());
map.put("createdTime", actLives.get(k).getCreatedTime());
// 查询打卡对应图片
List<String> imgUrlList = new ArrayList<>();
for (ActLivePicDTO urlDto : actLiveImg) {
if (actLives.get(k).getId().equals(urlDto.getLiveId())) {
imgUrlList.add(urlDto.getPicUrl());
}
}
map.put("images", imgUrlList);
dataContainer.add(map);
}
return new Result<ResiActLiveRecResultDTO>().ok(resultDto);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
public Result<String> inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
// 存储活动实况记录表
ActLiveRecEntity actLiveRecEntity = new ActLiveRecEntity();
actLiveRecEntity.setActId(formDTO.getActId());
actLiveRecEntity.setUserId(formDTO.getUserId());
actLiveRecEntity.setLongitude(formDTO.getLongitude());
actLiveRecEntity.setLatitude(formDTO.getLatitude());
actLiveRecEntity.setAddress(formDTO.getAddress());
actLiveRecEntity.setDesc(formDTO.getDesc());
baseDao.insert(actLiveRecEntity);
//存储活动实况图片
List<String> imgList = formDTO.getImages();
for (int i = 0; i < imgList.size(); i++) {
String imgUrl = imgList.get(i);
ActLivePicEntity actLivePicEntity = new ActLivePicEntity();
actLivePicEntity.setLiveId(actLiveRecEntity.getId());
actLivePicEntity.setPicUrl(imgUrl);
actLivePicEntity.setSort(i + NumConstant.ONE);
actLivePicDao.insert(actLivePicEntity);
}
return new Result<String>().ok(actLiveRecEntity.getId());
}
}
}

124
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java

@ -17,25 +17,30 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActSignInPicDao;
import com.epmet.dao.ActSignInRecDao;
import com.epmet.dto.ActSignInRecDTO;
import com.epmet.dao.ActUserLogDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.entity.ActSignInPicEntity;
import com.epmet.entity.ActSignInRecEntity;
import com.epmet.entity.ActUserLogEntity;
import com.epmet.redis.ActSignInRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.service.ActSignInRecService;
import org.apache.commons.lang3.StringUtils;
import com.epmet.utils.ActUserRelationStatusConstant;
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;
/**
* 活动签到记录
@ -49,56 +54,67 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
@Autowired
private ActSignInRecRedis actSignInRecRedis;
@Override
public PageData<ActSignInRecDTO> page(Map<String, Object> params) {
IPage<ActSignInRecEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ActSignInRecDTO.class);
}
@Override
public List<ActSignInRecDTO> list(Map<String, Object> params) {
List<ActSignInRecEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ActSignInRecDTO.class);
}
private QueryWrapper<ActSignInRecEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ActSignInRecEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Autowired
private ActUserRelationDao actUserRelationDao;
@Override
public ActSignInRecDTO get(String id) {
ActSignInRecEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ActSignInRecDTO.class);
}
@Autowired
private ActUserLogDao actUserLogDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ActSignInRecDTO dto) {
ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class);
insert(entity);
}
@Autowired
private ActSignInPicDao actSignInPicDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ActSignInRecDTO dto) {
ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class);
updateById(entity);
}
@Autowired
private ActLiveRecService actLiveRecService;
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
// 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO();
actUserRelationDTO.setActId(formDTO.getActId());
actUserRelationDTO.setUserId(formDTO.getUserId());
actUserRelationDTO.setSignInFlag(ActUserRelationStatusConstant.SIGNED_IN);
actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO);
// 存储用户活动关系日志表
ActUserLogEntity actUserLogEntity = new ActUserLogEntity();
actUserLogEntity.setActId(formDTO.getActId());
actUserLogEntity.setUserId(formDTO.getUserId());
actUserLogEntity.setOperationType(ActUserRelationStatusConstant.SIGNED_IN);
actUserLogDao.insert(actUserLogEntity);
//" 实况id,当sync_live=1时此列有值"
String liveId = "";
if (formDTO.getSyncLive() == 1){
// 签到内容同步到实况
ResiActInsertLiveFormDTO liveFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiActInsertLiveFormDTO.class);
Result<String> inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO);
liveId = inSertlive.getData();
}
// 存储活动签到记录表
ActSignInRecEntity actSignInRecEntity = new ActSignInRecEntity();
actSignInRecEntity.setActId(formDTO.getActId());
actSignInRecEntity.setUserId(formDTO.getUserId());
actSignInRecEntity.setLongitude(formDTO.getLongitude());
actSignInRecEntity.setLatitude(formDTO.getLatitude());
actSignInRecEntity.setAddress(formDTO.getAddress());
actSignInRecEntity.setDesc(formDTO.getDesc());
actSignInRecEntity.setSyncLive(formDTO.getSyncLive());
actSignInRecEntity.setLiveId(liveId);
baseDao.insert(actSignInRecEntity);
//存储活动签到图片
List<String> imgList = formDTO.getImages();
for (int i = 0; i < imgList.size(); i++) {
String imgUrl = imgList.get(i);
ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity();
actLivePicEntity.setSignInId(actSignInRecEntity.getId());
actLivePicEntity.setPicUrl(imgUrl);
actLivePicEntity.setSort(i + NumConstant.ONE);
actSignInPicDao.insert(actLivePicEntity);
}
return new Result();
}
}
}

13
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java

@ -20,11 +20,15 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActSummaryDao;
import com.epmet.dto.ActSummaryDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActSummaryResultDTO;
import com.epmet.entity.ActSummaryEntity;
import com.epmet.redis.ActSummaryRedis;
import com.epmet.service.ActSummaryService;
@ -101,4 +105,11 @@ public class ActSummaryServiceImpl extends BaseServiceImpl<ActSummaryDao, ActSum
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
@Override
public Result<ResiActSummaryResultDTO> summaryList(ResiActContentFormDTO formDto) {
int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize();
formDto.setPageNo(pageIndex);
return new Result<ResiActSummaryResultDTO>().ok(baseDao.selectListSummary(formDto));
}
}

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java

@ -21,13 +21,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActUserLogDTO;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.redis.ActUserRelationRedis;
import com.epmet.service.ActUserLogService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ActUserRelationStatusConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -48,6 +54,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Autowired
private ActUserRelationRedis actUserRelationRedis;
@Autowired
private ActUserLogService actUserLogService;
@Override
public PageData<ActUserRelationDTO> page(Map<String, Object> params) {
@ -140,5 +148,24 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
return baseDao.selectCountUser(actId, status);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO) {
//1、更新用户活动关系表 的用户状态
ActUserRelationDTO userRelationDTO = new ActUserRelationDTO();
userRelationDTO.setActId(formDTO.getActId());
userRelationDTO.setUserId(tokenDto.getUserId());
userRelationDTO.setCancelReason(formDTO.getFailureReason());
userRelationDTO.setStatus(ActUserRelationStatusConstant.CANCELD);
baseDao.updateUserRelationByActIdAndUserId(userRelationDTO);
//2、插入用户活动关系日志表
ActUserLogDTO userLogDTO = new ActUserLogDTO();
userLogDTO.setActId(formDTO.getActId());
userLogDTO.setUserId(tokenDto.getUserId());
userLogDTO.setOperationType(ActUserRelationStatusConstant.CANCELD);
userLogDTO.setReason(formDTO.getFailureReason());
actUserLogService.save(userLogDTO);
return new Result();
}
}

39
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java

@ -23,9 +23,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiLeaderboardResultDTO;
import com.epmet.entity.HeartUserInfoEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.HeartUserInfoRedis;
import com.epmet.service.HeartUserInfoService;
import org.apache.commons.lang3.StringUtils;
@ -33,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -48,6 +55,8 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl<HeartUserInfoDao,
@Autowired
private HeartUserInfoRedis heartUserInfoRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<HeartUserInfoDTO> page(Map<String, Object> params) {
@ -113,4 +122,32 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl<HeartUserInfoDao,
return baseDao.selectByUserId(userId);
}
}
@Override
public Result<List<ResiLeaderboardResultDTO>> leaderboard(ResiActBaseFormDTO formDTO) {
// 获取排好序的 排行榜
List<HeartUserInfoDTO> leaderboardList = baseDao.selectListLeaderboard(formDTO);
// 根据用户ID获取微信昵称、头像
List<String> userIds = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
userIds.add(list.getUserId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds);
List<ResiLeaderboardResultDTO> resultDTOS = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO();
dto.setKindnessTime(list.getKindnessTime());
dto.setVolunteerFlag(list.getVolunteerFlag());
dto.setParticipationNum(list.getParticipationNum());
List<UserBaseInfoResultDTO> wxInfo = userWxInfos.getData();
for (UserBaseInfoResultDTO wx : wxInfo){
if (list.getUserId().equals(wx.getUserId())){
dto.setHeadImg(wx.getHeadImgUrl());
dto.setNickname(wx.getNickname());
}
}
}
return new Result<List<ResiLeaderboardResultDTO>>().ok(resultDTOS);
}
}

66
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -21,10 +21,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.redis.VolunteerInfoRedis;
import com.epmet.service.VolunteerInfoService;
@ -49,56 +52,19 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
@Autowired
private VolunteerInfoRedis volunteerInfoRedis;
@Override
public PageData<VolunteerInfoDTO> page(Map<String, Object> params) {
IPage<VolunteerInfoEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, VolunteerInfoDTO.class);
}
@Override
public List<VolunteerInfoDTO> list(Map<String, Object> params) {
List<VolunteerInfoEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.class);
}
private QueryWrapper<VolunteerInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<VolunteerInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public VolunteerInfoDTO get(String id) {
VolunteerInfoEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, VolunteerInfoDTO.class);
public Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO) {
// 检查是否是志愿者
// 是志愿者
// 更新志愿者信息表
// 更新用户基础信息表
// 更新用户微信表
// 不是志愿者
// 插入志愿者信息表
// 更新用户基础信息表
// 更新用户微信表
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(VolunteerInfoDTO dto) {
VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(VolunteerInfoDTO dto) {
VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
}

43
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java

@ -0,0 +1,43 @@
package com.epmet.utils;
/**
* @Description 用户活动关系表当前状态
* @Auther: zhangyong
* @Date: 2020-07-21 17:36
*/
public interface ActUserRelationStatusConstant {
/**
* 已报名/待审核
*/
String AUDITING="auditing";
/**
* 审核通过
*/
String PASSED="passed";
/**
* 审核不通过
*/
String REFUSED = "refused";
/**
* 取消报名
*/
String CANCELD = "canceld";
/**
* 给积分
*/
String AGREE = "agree";
/**
* 不给积分
*/
String DENY = "deny";
/**
* 已签到
*/
String SIGNED_IN = "signed_in";
}

49
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java

@ -0,0 +1,49 @@
package com.epmet.utils;
/**
* 用户当前状态sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消points_confirm-已确认积分
* @Auther: zhangyong
* @Date: 2020-07-21 17:36
*/
public interface ActUserStatusConstant {
/**
* 我要报名
*/
String SIGN_UP = "sign_up";
/**
* 取消报名
*/
String CANCELD = "canceld";
/**
* 已报满
*/
String ENOUGH = "enough";
/**
* 截止报名
*/
String END_SIGN_UP = "end_sign_up";
/**
* 已开始
*/
String IN_PROGRESS = "in_progress";
/**
* 已结束
*/
String FINISHED = "finished";
/**
* 已取消
*/
String CANCELED = "canceled";
/**
* 已确认积分
*/
String POINTS_CONFIRM = "points_confirm";
}

90
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java

@ -0,0 +1,90 @@
package com.epmet.utils;
import com.alibaba.nacos.client.utils.StringUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import org.springframework.beans.factory.annotation.Value;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.UUID;
/**
* 文字图片合法性校验
*
* @author zhangyong
* @date 2020-07-15 14:26
*/
@Slf4j
public class ValidityVerification {
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
/**
* 文本校验
* @param context 被校验的文本不能超过10000
* @param businessEnum 业务枚举定义校验失败后输出的日志信息
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void textScanVerification(String context, String businessEnum){
if (StringUtils.isNotBlank(context)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(context);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
// 业务枚举:例如:评论话题失败,评论内容为:%s"
log.error(String.format(businessEnum, context));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
}
}
/**
* 图片列表校验
* @param imgList 被校验的图片列表
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void imgScanVerification(List<String> imgList){
if (NumConstant.ZERO != imgList.size()){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
}
}
}

69
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

@ -375,4 +375,73 @@
ai.DEL_FLAG = '0'
AND ai.id =#{actId}
</select>
<!-- 活动详情 -->
<select id="selectActInfoDetail" parameterType="com.epmet.dto.form.resi.ResiActDetailFormDTO"
resultType="com.epmet.dto.result.resi.ResiActDetailResultDTO">
SELECT
i.ID actId,
i.TITLE title,
i.SPONSOR_CONTACTS contacts,
i.SPONSOR_TEL tel,
DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i') signUpEndTime,
DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
i.ACT_ADDRESS actAddress,
IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
i.ACT_QUOTA actQuota,
IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
i.REWARD reward,
i.REQUIREMENT requirement,
IF(i.VOLUNTEER_LIMIT = 1, true , false ) as volunteerLimit, -- 是否是志愿者(true:只有志愿者才可以参加活动1,false: 只要是居民就可以参加活动0)
i.SPONSOR_NAME sponsor,
DATE_FORMAT(i.ACTUAL_START_TIME,'%Y-%m-%d %H:%i') actualStartTime,
DATE_FORMAT(i.ACTUAL_END_TIME,'%Y-%m-%d %H:%i') actualEndTime,
IF(aur.SIGN_IN_FLAG = 'signed_in', true , false ) as isSignUp-- 是否已签到(true已签到,false未签到)
FROM
act_info i
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
LEFT JOIN act_user_relation aur ON aur.ACT_ID = i.ID AND aur.DEL_FLAG = '0' AND aur.USER_ID = #{userId}
WHERE
i.DEL_FLAG = '0'
AND i.id = #{actId}
</select>
<!--活动详情-未通过-->
<select id="selectActRejectDetail" parameterType="com.epmet.dto.form.resi.ResiActDetailFormDTO"
resultType="com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO">
SELECT
i.ID actId,
i.TITLE title,
DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i') signUpEndTime,
DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
i.ACT_ADDRESS actAddress,
IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
i.ACT_QUOTA actQuota,
i.SPONSOR_CONTACTS contacts,
i.SPONSOR_TEL tel,
i.REWARD reward,
i.SPONSOR_NAME sponsor,
u.FAILURE_REASON failureReason
FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0'
WHERE i.DEL_FLAG = '0'
AND i.ID = #{actId}
AND u.USER_ID = #{userId}
</select>
<!-- 活动内容 -->
<select id="selectListActContent" parameterType="java.lang.String"
resultType="com.epmet.dto.result.resi.ResiActContentResultDTO">
SELECT
c.CONTENT content,
c.CONTENT_TYPE contentType,
c.ORDER_NUM orderNum,
c.ID actContentId
FROM act_content c
WHERE c.DEL_FLAG = '0'
AND c.ACT_ID = #{actId}
ORDER BY c.ORDER_NUM ASC
</select>
</mapper>

30
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml

@ -19,5 +19,33 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--查询活动下的所有活动实况-->
<select id="selectListActLives" parameterType="java.lang.String"
resultType="com.epmet.dto.ActLiveRecDTO">
SELECT
ID id,
ACT_ID actId,
USER_ID userId,
ADDRESS address,
`DESC` `desc`,
CREATED_TIME createdTime
FROM act_live_rec r
WHERE r.DEL_FLAG = '0'
AND r.ACT_ID = #{actId}
</select>
</mapper>
<!--根据实况id,查询每条实况对应的多张图片-->
<select id="selectListActLiveImg" resultType="com.epmet.dto.ActLivePicDTO">
select
LIVE_ID liveId,
PIC_URL picUrl,
SORT sort
from act_live_pic
where DEL_FLAG = '0'
and LIVE_ID IN
<foreach collection="liveId" item="liveId" index="index" open="(" close=")" separator=",">
#{liveId}
</foreach>
order by SORT asc
</select>
</mapper>

17
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml

@ -17,5 +17,18 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
<!-- 活动详情-已结束-回顾稿 -->
<select id="selectListSummary" parameterType="com.epmet.dto.form.resi.ResiActContentFormDTO"
resultType="com.epmet.dto.result.resi.ResiActSummaryResultDTO">
SELECT
s.CONTENT content,
s.CONTENT_TYPE contentType,
s.ORDER_NUM orderNum,
s.ID summaryId
FROM act_summary s
WHERE s.DEL_FLAG = '0'
AND s.ACT_ID = #{actId}
ORDER BY s.ORDER_NUM ASC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

35
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

@ -62,6 +62,39 @@
AND aur.ACT_ID = #{actId}
</select>
<!-- 根据活动id,查询活动已报名的人数 -->
<select id="selectActSignupNum" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
count(1) signupNum
FROM act_user_relation re
WHERE re.DEL_FLAG = '0'
AND re.ACT_ID = #{actId}
GROUP BY re.ACT_ID
</select>
<update id="updateUserRelationByActIdAndUserId" parameterType="com.epmet.dto.ActUserRelationDTO">
UPDATE act_user_relation
SET
<if test="status != null and status.trim() != ''">
STATUS = #{status},
</if>
<if test="cancelReason != null and cancelReason.trim() != ''">
CANCEL_TIME = NOW(),
CANCEL_REASON = #{cancelReason},
</if>
<if test="signInFlag != null and signInFlag != ''">
SIGN_IN_FLAG = #{signInFlag},
</if>
<if test="userId != null and userId != ''">
UPDATED_BY = #{userId},
</if>
UPDATED_TIME = NOW()
WHERE
DEL_FLAG = '0'
AND ACT_ID = #{actId}
AND USER_ID = #{userId}
</update>
<!-- 实际参加活动个数(已经签到的) -->
<select id="countSignInActNum" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT
@ -96,4 +129,4 @@
and REWARD_FLAG='agree'
AND acu.USER_ID = #{userId}
</select>
</mapper>
</mapper>

28
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml

@ -29,4 +29,30 @@
hui.DEL_FLAG = '0'
AND hui.USER_ID =#{userId}
</select>
</mapper>
<!-- 查询用户志愿者标识 -->
<select id="selectUserVolunteerFlag" parameterType="java.lang.String"
resultType="java.lang.Integer">
SELECT
VOLUNTEER_FLAG
FROM heart_user_info u
WHERE u.DEL_FLAG = '0'
AND u.USER_ID = #{userId}
</select>
<!-- 爱心榜 -->
<select id="selectListLeaderboard" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.HeartUserInfoDTO">
SELECT
ui.USER_ID userId,
volunteerFlag,
IF(ui.VOLUNTEER_FLAG = 1, true , false )
ui.KINDNESS_TIME kindnessTime,
ui.PARTICIPATION_NUM participationNum
FROM heart_user_info ui
WHERE ui.DEL_FLAG = '0'
AND ui.CUSTOMER_ID = #{customerId}
ORDER BY ui.KINDNESS_TIME DESC, ui.PARTICIPATION_NUM DESC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

126
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java

@ -1,126 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 积分规则表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
@Data
public class PointRuleDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 规则名称 与事件名称保持一致即可
*/
private String ruleName;
/**
* 规则说明 事件说明
*/
private String ruleDesc;
/**
* 事件CODE 来自事件表
*/
private String eventCode;
/**
* 事件名称 来自事件表
*/
private String eventName;
/**
* 操作类型 加积分:add;减积分:subtract
*/
private String operateType;
/**
* 积分上限
*/
private Integer upLimit;
/**
* 积分上限描述
*/
private String upLimitDesc;
/**
* 获得积分值
*/
private Integer pointNum;
/**
* 获得积分单位 time分钟minute小时hour
*/
private String pointUnit;
/**
* 是否启用 0-1-
*/
private String enabledFlag;
/**
* 删除标识 0-1-
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

21
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* desc:积分规则Id详情获取 规则列表
* @author jianjun liu
* @date 2020-07-22 15:28
**/
@Data
public class PointDetailFormDTO implements Serializable {
private static final long serialVersionUID = 7587939716742608164L;
/**
* 积分规则Id
*/
@NotBlank(message = "积分规则Id不能为空")
private String ruleId;
}

71
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java

@ -0,0 +1,71 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* desc:积分规则保存/修改 规则列表
*
* @author jianjun liu
* @date 2020-07-22 15:28
**/
@Data
public class PointRuleFormDTO implements Serializable {
private static final long serialVersionUID = -3228252683629912008L;
/**
* 积分规则Id
*/
@NotBlank(message = "积分规则Id不能为空", groups = UpdateGroup.class)
private String ruleId;
/**
* 积分
*/
@NotBlank(message = "积分不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String point;
/**
* 是否开启
*/
@NotBlank(message = "是否开启不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String enabledFlag;
/**
* 上限开启
*/
@NotBlank(message = "积分上限不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String upLimit;
/**
* 积分规则Id
*/
@NotBlank(message = "客户Id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String customerId;
//=======系统添加时的属性======
/**
* 规则说明 事件说明
*/
@NotBlank(message = "规则描述不能为空", groups = AddGroup.class)
private String ruleDesc;
/**
* 事件CODE 来自事件表
*/
@NotBlank(message = "事件code不能为空", groups = AddGroup.class)
private String eventCode;
/**
* 操作类型 加积分:add;减积分:subtract
*/
@NotBlank(message = "操作类型不能为空", groups = AddGroup.class)
private String operateType;
/**
* 获得积分单位 time分钟minute小时hour
*/
@NotBlank(message = "积分单位不能为空", groups = AddGroup.class)
private String pointUnit;
}

23
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* desc:根据功能Id获取 规则列表
* @author jianjun liu
* @date 2020-07-22 15:28
**/
@Data
public class PointRuleListFormDTO implements Serializable {
private static final long serialVersionUID = -1918653281170340608L;
/**
* 功能Id
*/
@NotBlank(message = "功能Id不能为空")
private String functionId;
@NotBlank(message = "客户Id不能为空")
private String customerId;
}

18
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* desc:积分规则-获取客户功能列表 result
* @author jianjun liu
* @date 2020-07-22 14:43
**/
@Data
public class CustomerFunctionResultDTO implements Serializable {
private static final long serialVersionUID = -3761765064811136295L;
private String functionId;
private String functionName;
}

24
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* desc:积分规则-详情 result
* @author jianjun liu
* @date 2020-07-22 14:43
**/
@Data
public class PointDetailResultDTO implements Serializable {
private static final long serialVersionUID = 2426172750860788081L;
private String ruleId;
private String ruleName;
private String ruleDesc;
private Integer point;
private String pointUnit;
private String upLimit;
private String enabledFlag;
private String upLimitDesc;
}

23
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* desc:积分规则-列表 result
* @author jianjun liu
* @date 2020-07-22 14:43
**/
@Data
public class PointRuleResultDTO implements Serializable {
private static final long serialVersionUID = -2327977101138032573L;
private String ruleId;
private String ruleName;
private String ruleDesc;
/**
* 拼接好的 积分值/单位
*/
private String pointValue;
}

12
epmet-module/epmet-point/epmet-point-server/pom.xml

@ -69,6 +69,18 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-customize-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

42
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java

@ -0,0 +1,42 @@
package com.epmet.common.enu;
/**
* 系积分系统-积分单位枚举类
* dev|test|prod
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum PointUnitEnum {
TIME("time", "次"),
MINUTE("minute", "分种"),
HOUR("hour", "小时"),
;
private String code;
private String name;
PointUnitEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static PointUnitEnum getEnum(String code) {
PointUnitEnum[] values = PointUnitEnum.values();
for (PointUnitEnum value : values) {
if (code != null && value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

43
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java

@ -0,0 +1,43 @@
package com.epmet.common.enu;
/**
* @author jianjun liu
* @date 2020-06-04 21:39
**/
public enum SysResponseEnum {
/**
*
* 业务代码枚举类
*
* 编码样式CCCBBOOXX
* 编码示例说明
* CCC 中心编码&业务系统 (112与端口号一致-积分系统服务)
* BB 业务类型00-默认
* OO 操作类型00-默认
* XX 具体编码00-成功,01-失败,02-参数错误,10-异常 99-系统错误
*
*/
/*通用枚举 */
EXCEPTION(10001,"系统异常"),
/*积分规则 业务 01*/
THIRD_SERVICE_ERROR(112010001,"调用第三方接口异常"),
POINT_RULE_IS_NOT_EXIST(112010002,"积分规则不存在"),
;
private Integer code;
private String msg;
SysResponseEnum(Integer code, String msg){
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}

40
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java

@ -0,0 +1,40 @@
package com.epmet.controller;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.service.PointRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author jianjun liu
* @date 2020-06-04 20:39
**/
@RestController
@RequestMapping("opback")
public class BackDoorController {
@Autowired
private PointRuleService pointRuleService;
/**
* desc:添加规则
*
* @param formDTO
* @return
*/
@PostMapping(value = "sysadd")
public Result<Boolean> add(@RequestBody PointRuleFormDTO formDTO) {
TokenDto tokenDTO = new TokenDto();
tokenDTO.setUserId("default");
formDTO.setCustomerId(tokenDTO.getCustomerId());
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
pointRuleService.add(tokenDTO, formDTO);
return new Result<Boolean>().ok(true);
}
}

100
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java

@ -0,0 +1,100 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.dto.result.CustomerFunctionResultDTO;
import com.epmet.dto.result.PointDetailResultDTO;
import com.epmet.dto.result.PointRuleResultDTO;
import com.epmet.service.PointRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 积分规则controller
*
* @author jianjun liu
* @date 2020-07-22 14:39
**/
@RestController
@RequestMapping("rule")
public class PointRuleController {
@Autowired
private PointRuleService pointRuleService;
/**
* desc:积分规则-获取客户有积分规则的功能列表
*
* @param tokenDTO
* @return
*/
@PostMapping(value = "functionlist")
public Result<List<CustomerFunctionResultDTO>> getFunctionList(@LoginUser TokenDto tokenDTO) {
return new Result<List<CustomerFunctionResultDTO>>().ok(pointRuleService.getFunctionList(tokenDTO.getCustomerId()));
}
/**
* desc:根据功能id获取积分规则
*
* @param tokenDTO
* @param formDTO
* @return
*/
@PostMapping(value = "list")
public Result<List<PointRuleResultDTO>> list(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleListFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
ValidatorUtils.validateEntity(formDTO);
return new Result<List<PointRuleResultDTO>>().ok(pointRuleService.list(formDTO));
}
/**
* desc:根据规则id获取积分规则
*
* @param formDTO
* @return
*/
@PostMapping(value = "detail")
public Result<PointDetailResultDTO> detail(@RequestBody PointDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<PointDetailResultDTO>().ok(pointRuleService.detail(formDTO));
}
/**
* desc:根据功能id获取积分规则
*
* @param formDTO
* @return
*/
@PostMapping(value = "update")
public Result<Boolean> update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
pointRuleService.update(tokenDTO,formDTO);
return new Result<Boolean>().ok(true);
}
/**
* desc:添加规则
*
* @param formDTO
* @return
*/
@PostMapping(value = "add")
public Result<Boolean> add(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
pointRuleService.add(tokenDTO,formDTO);
return new Result<Boolean>().ok(true);
}
}

23
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.entity.PointRuleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 积分规则表
@ -29,5 +33,22 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PointRuleDao extends BaseDao<PointRuleEntity> {
/**
* desc:获取该客户下有规则的功能Id
*
* @param customerId
* @return
*/
List<String> selectFunctionIds(@Param("customerId") String customerId);
/**
* desc:获取该客户下有规则的功能Id
*
* @param formDTO
* @return
*/
List<PointRuleEntity> selectListByFunctionId(PointRuleListFormDTO formDTO);
int updateByCustomerId(PointRuleEntity entity);
}

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java → epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java

@ -18,7 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.SysOperateLogEntity;
import com.epmet.entity.RuleOperateLogEntity;
import org.apache.ibatis.annotations.Mapper;
/**
@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper;
* @since v1.0.0 2020-07-20
*/
@Mapper
public interface SysOperateLogDao extends BaseDao<SysOperateLogEntity> {
public interface RuleOperateLogDao extends BaseDao<RuleOperateLogEntity> {
}

32
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java

@ -18,12 +18,11 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.Objects;
/**
* 积分规则表
@ -58,11 +57,6 @@ public class PointRuleEntity extends BaseEpmetEntity {
*/
private String eventCode;
/**
* 事件名称 来自事件表
*/
private String eventName;
/**
* 操作类型 加积分:add;减积分:subtract
*/
@ -81,7 +75,7 @@ public class PointRuleEntity extends BaseEpmetEntity {
/**
* 获得积分值
*/
private Integer pointNum;
private Integer point;
/**
* 获得积分单位 time分钟minute小时hour
@ -93,4 +87,26 @@ public class PointRuleEntity extends BaseEpmetEntity {
*/
private String enabledFlag;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PointRuleEntity entity = (PointRuleEntity) o;
return customerId.equals(entity.customerId) &&
ruleName.equals(entity.ruleName) &&
ruleDesc.equals(entity.ruleDesc) &&
eventCode.equals(entity.eventCode) &&
operateType.equals(entity.operateType) &&
upLimit.equals(entity.upLimit) &&
upLimitDesc.equals(entity.upLimitDesc) &&
point.equals(entity.point) &&
pointUnit.equals(entity.pointUnit) &&
enabledFlag.equals(entity.enabledFlag);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, operateType, upLimit, upLimitDesc, point, pointUnit, enabledFlag);
}
}

14
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java → epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java

@ -18,13 +18,10 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 积分系统操作记录表
*
@ -34,7 +31,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_operate_log")
public class SysOperateLogEntity extends BaseEpmetEntity {
public class RuleOperateLogEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
@ -44,14 +41,9 @@ public class SysOperateLogEntity extends BaseEpmetEntity {
private String customerId;
/**
* 操作对象ID
*/
private String objectId;
/**
* 对象类型 规则:rule
* 规则ID
*/
private String objectType;
private String ruleId;
/**
* 操作类型 新建:add,编辑:edit删除:del

76
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java

@ -18,12 +18,16 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PointRuleDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.dto.result.CustomerFunctionResultDTO;
import com.epmet.dto.result.PointDetailResultDTO;
import com.epmet.dto.result.PointRuleResultDTO;
import com.epmet.entity.PointRuleEntity;
import java.util.List;
import java.util.Map;
/**
* 积分规则表
@ -34,62 +38,22 @@ import java.util.Map;
public interface PointRuleService extends BaseService<PointRuleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PointRuleDTO>
* @author generator
* @date 2020-07-20
* desc:根据用户id获取积分规则-功能列表
* @param customerId
* @return
*/
PageData<PointRuleDTO> page(Map<String, Object> params);
List<CustomerFunctionResultDTO> getFunctionList(String customerId);
/**
* 默认查询
*
* @param params
* @return java.util.List<PointRuleDTO>
* @author generator
* @date 2020-07-20
*/
List<PointRuleDTO> list(Map<String, Object> params);
/**
* desc根据客户Id 及功能Id获取规则列表
* @param formDTO
* @return
*/
List<PointRuleResultDTO> list(PointRuleListFormDTO formDTO);
/**
* 单条查询
*
* @param id
* @return PointRuleDTO
* @author generator
* @date 2020-07-20
*/
PointRuleDTO get(String id);
PointDetailResultDTO detail(PointDetailFormDTO formDTO);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-20
*/
void save(PointRuleDTO dto);
void update(TokenDto tokenDTO, PointRuleFormDTO formDTO);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-20
*/
void update(PointRuleDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-20
*/
void delete(String[] ids);
void add(TokenDto tokenDTO, PointRuleFormDTO formDTO);
}

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java

@ -20,7 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.SysOperateLogDTO;
import com.epmet.entity.SysOperateLogEntity;
import com.epmet.entity.RuleOperateLogEntity;
import java.util.List;
import java.util.Map;
@ -31,7 +31,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
public interface SysOperateLogService extends BaseService<SysOperateLogEntity> {
public interface SysOperateLogService extends BaseService<RuleOperateLogEntity> {
/**
* 默认分页

199
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -17,23 +17,40 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.alibaba.fastjson.JSON;
import com.epmet.common.enu.PointUnitEnum;
import com.epmet.common.enu.SysResponseEnum;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.CommonOperateTypeEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.PointRuleDao;
import com.epmet.dto.PointRuleDTO;
import com.epmet.dao.RuleOperateLogDao;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.CustomerFunctionListFormDTO;
import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.dto.result.CustomerFunctionResultDTO;
import com.epmet.dto.result.DefaultFunctionListResultDTO;
import com.epmet.dto.result.PointDetailResultDTO;
import com.epmet.dto.result.PointRuleResultDTO;
import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.RuleOperateLogEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.PointRuleService;
import org.apache.commons.lang3.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 积分规则表
@ -41,60 +58,116 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
@Slf4j
@Service
public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRuleEntity> implements PointRuleService {
@Override
public PageData<PointRuleDTO> page(Map<String, Object> params) {
IPage<PointRuleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PointRuleDTO.class);
}
@Override
public List<PointRuleDTO> list(Map<String, Object> params) {
List<PointRuleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PointRuleDTO.class);
}
private QueryWrapper<PointRuleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PointRuleEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public PointRuleDTO get(String id) {
PointRuleEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PointRuleDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PointRuleDTO dto) {
PointRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointRuleEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PointRuleDTO dto) {
PointRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointRuleEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private RuleOperateLogDao ruleOperateLogDao;
@Override
public List<CustomerFunctionResultDTO> getFunctionList(String customerId) {
List<CustomerFunctionResultDTO> result = new ArrayList<>();
CustomerFunctionListFormDTO formDTO = new CustomerFunctionListFormDTO();
formDTO.setCustomerId(customerId);
Result<List<DefaultFunctionListResultDTO>> openedFunctionResult = operCustomizeOpenFeignClient.getOpenedFunctionList(formDTO);
if (!openedFunctionResult.success()) {
log.warn("getFunctionList getOpenedFunctionList fail,result:{}", JSON.toJSONString(openedFunctionResult));
throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getCode(), SysResponseEnum.THIRD_SERVICE_ERROR.getMsg());
}
List<DefaultFunctionListResultDTO> resultData = openedFunctionResult.getData();
if (CollectionUtils.isEmpty(resultData)) {
log.warn("getFunctionList customerId:{} have opened any function", customerId);
return result;
}
List<String> functionIds = baseDao.selectFunctionIds(customerId);
if (CollectionUtils.isEmpty(functionIds)) {
log.warn("getFunctionList customerId:{} have any pointRules", customerId);
return result;
}
return resultData.stream().filter(function -> functionIds.contains(function.getFunctionId()))
.map(fun -> ConvertUtils.sourceToTarget(fun, CustomerFunctionResultDTO.class))
.collect(Collectors.toList());
}
@Override
public List<PointRuleResultDTO> list(PointRuleListFormDTO formDTO) {
List<PointRuleResultDTO> result = new ArrayList<>();
List<PointRuleEntity> list = baseDao.selectListByFunctionId(formDTO);
if (CollectionUtils.isEmpty(list)) {
log.warn("list functionId:{} return empty", formDTO.getFunctionId());
return result;
}
result = list.stream().map(pointRuleEntity -> {
PointRuleResultDTO resultDTO = new PointRuleResultDTO();
resultDTO.setRuleId(pointRuleEntity.getId());
resultDTO.setRuleName(pointRuleEntity.getRuleName());
resultDTO.setRuleDesc(pointRuleEntity.getRuleDesc());
PointUnitEnum pointUnitEnum = PointUnitEnum.getEnum(pointRuleEntity.getPointUnit());
if (pointRuleEntity == null || pointRuleEntity.getPoint() == null) {
log.error("list ruleId:{} have not pointUnit or pointNum,pointRule:{}", JSON.toJSONString(pointRuleEntity));
return null;
}
resultDTO.setPointValue(pointRuleEntity.getPoint().toString().concat(StrConstant.SEPARATOR).concat(pointUnitEnum.getCode()));
return resultDTO;
}).filter(fun -> fun != null).collect(Collectors.toList());
return result;
}
@Override
public PointDetailResultDTO detail(PointDetailFormDTO formDTO) {
PointRuleEntity pointRuleEntity = baseDao.selectById(formDTO.getRuleId());
if (pointRuleEntity == null) {
throw new RenException(SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getCode(), SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getMsg());
}
return ConvertUtils.sourceToTarget(pointRuleEntity, PointDetailResultDTO.class);
}
@Override
public void update(TokenDto tokenDTO, PointRuleFormDTO formDTO) {
PointRuleEntity entityDB = baseDao.selectById(formDTO.getRuleId());
//数据库不存在或者客户Id不相等 则抛出异常
if (entityDB == null || !entityDB.getCustomerId().equals(formDTO.getCustomerId())) {
throw new RenException(SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getCode(), SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getMsg());
}
PointRuleEntity entityNew = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class);
if (entityDB.equals(entityNew)) {
log.warn("update ignore tow entity is same");
return;
}
insertOperateRecord(tokenDTO, formDTO, entityDB, CommonOperateTypeEnum.EDIT.getCode());
baseDao.updateByCustomerId(entityNew);
}
@Override
public void add(TokenDto tokenDTO, PointRuleFormDTO formDTO) {
PointRuleEntity entity = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class);
if (tokenDTO == null){
insertOperateRecord(tokenDTO, formDTO, null, CommonOperateTypeEnum.ADD.getCode());
}
baseDao.insert(entity);
}
private void insertOperateRecord(TokenDto tokenDTO, PointRuleFormDTO formDTO, PointRuleEntity entityDB, String opType) {
CustomerStaffDTO userInfo = getCustomerStaff(tokenDTO.getUserId());
RuleOperateLogEntity record = new RuleOperateLogEntity();
record.setCustomerId(formDTO.getCustomerId());
record.setRuleId(entityDB.getId());
record.setOpType(opType);
record.setOpUser(userInfo.getRealName());
record.setBefordData(JSON.toJSONString(entityDB));
record.setAfterData(JSON.toJSONString(formDTO));
ruleOperateLogDao.insert(record);
}
private CustomerStaffDTO getCustomerStaff(String userId) {
Result<CustomerStaffDTO> resultStaff = epmetUserOpenFeignClient.getCustomerStaff(userId);
if (!resultStaff.success() || null == resultStaff.getData()) {
throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getMsg());
}
return resultStaff.getData();
}
}

22
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java

@ -20,12 +20,12 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.SysOperateLogDao;
import com.epmet.dao.RuleOperateLogDao;
import com.epmet.dto.SysOperateLogDTO;
import com.epmet.entity.SysOperateLogEntity;
import com.epmet.entity.RuleOperateLogEntity;
import com.epmet.service.SysOperateLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -42,11 +42,11 @@ import java.util.Map;
* @since v1.0.0 2020-07-20
*/
@Service
public class SysOperateLogServiceImpl extends BaseServiceImpl<SysOperateLogDao, SysOperateLogEntity> implements SysOperateLogService {
public class SysOperateLogServiceImpl extends BaseServiceImpl<RuleOperateLogDao, RuleOperateLogEntity> implements SysOperateLogService {
@Override
public PageData<SysOperateLogDTO> page(Map<String, Object> params) {
IPage<SysOperateLogEntity> page = baseDao.selectPage(
IPage<RuleOperateLogEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
@ -55,15 +55,15 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl<SysOperateLogDao,
@Override
public List<SysOperateLogDTO> list(Map<String, Object> params) {
List<SysOperateLogEntity> entityList = baseDao.selectList(getWrapper(params));
List<RuleOperateLogEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, SysOperateLogDTO.class);
}
private QueryWrapper<SysOperateLogEntity> getWrapper(Map<String, Object> params){
private QueryWrapper<RuleOperateLogEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<SysOperateLogEntity> wrapper = new QueryWrapper<>();
QueryWrapper<RuleOperateLogEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
@ -71,21 +71,21 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl<SysOperateLogDao,
@Override
public SysOperateLogDTO get(String id) {
SysOperateLogEntity entity = baseDao.selectById(id);
RuleOperateLogEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, SysOperateLogDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(SysOperateLogDTO dto) {
SysOperateLogEntity entity = ConvertUtils.sourceToTarget(dto, SysOperateLogEntity.class);
RuleOperateLogEntity entity = ConvertUtils.sourceToTarget(dto, RuleOperateLogEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(SysOperateLogDTO dto) {
SysOperateLogEntity entity = ConvertUtils.sourceToTarget(dto, SysOperateLogEntity.class);
RuleOperateLogEntity entity = ConvertUtils.sourceToTarget(dto, RuleOperateLogEntity.class);
updateById(entity);
}

52
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/epmet_point.sql

@ -1,33 +1,33 @@
CREATE TABLE point_rule(
ID VARCHAR(64) NOT NULL COMMENT '主键' ,
CUSTOMER_ID VARCHAR(64) COMMENT '客户ID' ,
RULE_NAME VARCHAR(32) COMMENT '规则名称 与事件名称保持一致即可' ,
RULE_DESC VARCHAR(32) COMMENT '规则说明 事件说明' ,
EVENT_CODE VARCHAR(32) COMMENT '事件CODE 来自事件表' ,
EVENT_NAME VARCHAR(32) COMMENT '事件名称 来自事件表' ,
OPERATE_TYPE VARCHAR(32) COMMENT '操作类型 加积分:add;减积分:subtract' ,
UP_LIMIT INT COMMENT '积分上限' ,
UP_LIMIT_DESC VARCHAR(64) COMMENT '积分上限描述' ,
POINT_NUM INT DEFAULT 0 COMMENT '获得积分值' ,
POINT_UNIT VARCHAR(32) COMMENT '获得积分单位 次:time;分钟:minute;小时:hour' ,
ENABLED_FLAG VARCHAR(1) COMMENT '是否启用 0-否,1-是' ,
DEL_FLAG VARCHAR(1) COMMENT '删除标识 0-否,1-是' ,
REVISION INT COMMENT '乐观锁' ,
CREATED_BY VARCHAR(32) COMMENT '创建人' ,
CREATED_TIME DATETIME COMMENT '创建时间' ,
UPDATED_BY VARCHAR(32) COMMENT '更新人' ,
UPDATED_TIME DATETIME COMMENT '更新时间' ,
PRIMARY KEY (ID)
) COMMENT = '积分规则表';
CREATE TABLE `point_rule` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) DEFAULT NULL COMMENT '客户ID',
`RULE_NAME` varchar(32) DEFAULT NULL COMMENT '规则名称 与事件名称保持一致即可',
`RULE_DESC` varchar(32) DEFAULT NULL COMMENT '规则说明 事件说明',
`EVENT_CODE` varchar(32) DEFAULT NULL COMMENT '事件CODE 来自事件表',
`FUNCTION_ID` varchar(32) DEFAULT NULL COMMENT '功能分组Id 来自customize.function',
`OPERATE_TYPE` varchar(32) DEFAULT NULL COMMENT '操作类型 加积分:add;减积分:subtract',
`UP_LIMIT` int(11) DEFAULT NULL COMMENT '积分上限',
`UP_LIMIT_DESC` varchar(64) DEFAULT NULL COMMENT '积分上限描述',
`POINT` int(11) DEFAULT '0' COMMENT '单位积分值',
`POINT_UNIT` varchar(32) DEFAULT NULL COMMENT '获得积分单位 次:time;分钟:minute;小时:hour',
`ENABLED_FLAG` varchar(1) DEFAULT NULL COMMENT '是否启用 0-否,1-是',
`DEL_FLAG` varchar(1) DEFAULT NULL COMMENT '删除标识 0-否,1-是',
`REVISION` int(11) DEFAULT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人',
`CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
`UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`),
UNIQUE KEY `unx_cus_event` (`CUSTOMER_ID`,`EVENT_CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分规则表';
CREATE TABLE sys_operate_log(
CREATE TABLE rule_operate_log(
ID VARCHAR(64) NOT NULL COMMENT '主键' ,
CUSTOMER_ID VARCHAR(64) COMMENT '客户ID' ,
OBJECT_ID VARCHAR(64) COMMENT '操作对象ID' ,
OBJECT_TYPE VARCHAR(64) COMMENT '对象类型 规则:rule' ,
RULE_ID VARCHAR(64) COMMENT '规则ID' ,
OP_TYPE VARCHAR(32) COMMENT '操作类型 新建:add,编辑:edit,删除:del;' ,
OP_USER VARCHAR(64) COMMENT '操作用户 操作人' ,
BEFORD_DATA VARCHAR(1024) COMMENT '变更前数据 JSON串' ,
BEFORE_DATA VARCHAR(1024) COMMENT '变更前数据 JSON串' ,
AFTER_DATA VARCHAR(1024) COMMENT '变更后数据 JSON串' ,
DEL_FLAG VARCHAR(1) COMMENT '删除标识 0-否,1-是' ,
REVISION INT COMMENT '乐观锁' ,
@ -36,4 +36,4 @@ CREATE TABLE sys_operate_log(
UPDATED_BY VARCHAR(32) COMMENT '更新人' ,
UPDATED_TIME DATETIME COMMENT '更新时间' ,
PRIMARY KEY (ID)
) COMMENT = '积分系统操作记录表';
) COMMENT = '积分规则操作记录表';

19
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml

@ -9,11 +9,10 @@
<result property="ruleName" column="RULE_NAME"/>
<result property="ruleDesc" column="RULE_DESC"/>
<result property="eventCode" column="EVENT_CODE"/>
<result property="eventName" column="EVENT_NAME"/>
<result property="operateType" column="OPERATE_TYPE"/>
<result property="upLimit" column="UP_LIMIT"/>
<result property="upLimitDesc" column="UP_LIMIT_DESC"/>
<result property="pointNum" column="POINT_NUM"/>
<result property="point" column="POINT"/>
<result property="pointUnit" column="POINT_UNIT"/>
<result property="enabledFlag" column="ENABLED_FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
@ -23,6 +22,18 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectFunctionIds" resultType="java.lang.String">
SELECT DISTINCT FUNCTION_ID FROM point_rule WHERE CUSTOMSER_ID = #{customerId,jdbcType=VARCHAR}
</select>
<select id="selectListByFunctionId" resultMap="pointRuleMap">
SELECT ID,RULE_NAME,RULE_DESC,POINT_NUM,POINT_UNIT FROM point_rule WHERE CUSTOMSER_ID = #{customerId,jdbcType=VARCHAR}
</select>
<update id="updateByCustomerId">
UPDATE point_rule
SET
POINT = #{point,jdbcType=INTEGER},
ENABLED_FLAG = #{enabledFlag,jdbcType=VARCHAR},
UP_LIMIT = #{upLimit,jdbcType=INTEGER}
WHERE id = #{id,jdbcType=VARCHAR} and CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
</update>
</mapper>

4
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml → epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.SysOperateLogDao">
<mapper namespace="com.epmet.dao.RuleOperateLogDao">
<resultMap type="com.epmet.entity.SysOperateLogEntity" id="sysOperateLogMap">
<resultMap type="com.epmet.entity.RuleOperateLogEntity" id="sysOperateLogMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="objectId" column="OBJECT_ID"/>

10
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java

@ -1,9 +1,13 @@
package com.epmet.feign;
import org.springframework.cloud.openfeign.FeignClient;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerFunctionListFormDTO;
import com.epmet.dto.result.DefaultFunctionListResultDTO;
import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import java.util.List;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -13,5 +17,5 @@ import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback;
*/
@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeOpenFeignClientFallback.class)
public interface OperCustomizeOpenFeignClient {
Result<List<DefaultFunctionListResultDTO>> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO);
}

18
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java

@ -1,7 +1,16 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerFunctionListFormDTO;
import com.epmet.dto.result.DefaultFunctionListResultDTO;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -12,10 +21,13 @@ import org.springframework.stereotype.Component;
@Component
public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFeignClient {
/**
* 从缓存中查询已登录用户的基本信息以及角色等相关信息
* 获取客户已开通的功能列表
*
* @return
*/
//@PostMapping(value = "/epmetuser/user/loginuserdetails", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//Result<LoginUserDetailsResultDTO> getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto);
@Override
@PostMapping(value = "/oper/customize/customerfunction/getOpenedFunctionList", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Result<List<DefaultFunctionListResultDTO>> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO){
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getOpenedFunctionList", formDTO);
}
}

6
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java

@ -133,8 +133,8 @@ public class CustomerFunctionController {
* @param formDTO
* @return
*/
@PostMapping("customeropenedfunction")
public Result<List<DefaultFunctionListResultDTO>> customerOpenedFunction(@RequestBody CustomerFunctionListFormDTO formDTO) {
return new Result<List<DefaultFunctionListResultDTO>>().ok(customerFunctionService.customerOpenedFunction(formDTO));
@PostMapping("openedfunctionlist")
public Result<List<DefaultFunctionListResultDTO>> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO) {
return new Result<List<DefaultFunctionListResultDTO>>().ok(customerFunctionService.getOpenedFunctionList(formDTO));
}
}

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java

@ -118,5 +118,5 @@ public interface CustomerFunctionService extends BaseService<CustomerFunctionEnt
* @param formDTO
* @return
*/
List<DefaultFunctionListResultDTO> customerOpenedFunction(CustomerFunctionListFormDTO formDTO);
List<DefaultFunctionListResultDTO> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO);
}

41
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java

@ -17,11 +17,13 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -41,15 +43,15 @@ import com.epmet.entity.CustomerFunctionEntity;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerFunctionRedis;
import com.epmet.service.CustomerFunctionService;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 客户功能权限表
@ -57,6 +59,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-10
*/
@Slf4j
@Service
public class CustomerFunctionServiceImpl extends BaseServiceImpl<CustomerFunctionDao, CustomerFunctionEntity> implements CustomerFunctionService {
@ -211,8 +214,34 @@ public class CustomerFunctionServiceImpl extends BaseServiceImpl<CustomerFunctio
}
@Override
public List<DefaultFunctionListResultDTO> customerOpenedFunction(CustomerFunctionListFormDTO formDTO) {
return null;
public List<DefaultFunctionListResultDTO> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getCustomerId())){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
List<DefaultFunctionListResultDTO> result = new ArrayList<>();
//查询所有已上架功能列表(默认、定制功能)
List<FunctionDTO> funList = functionDao.selectFunctionList();
if(CollectionUtils.isEmpty(funList)){
return result;
}
//查询当前客户已拥有的功能
List<CustomerFunctionDTO> openedList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId());
if(CollectionUtils.isEmpty(openedList)){
log.warn("getOpenedFunctionList customerId:{} have any function",formDTO.getCustomerId());
return result;
}
Set<String> openedFunIdSet = openedList.stream().map(CustomerFunctionDTO::getFunctionId).collect(Collectors.toSet());
for (FunctionDTO function : funList) {
if (openedFunIdSet.contains(function.getId())) {
DefaultFunctionListResultDTO resultDTO = ConvertUtils.sourceToTarget(function, DefaultFunctionListResultDTO.class);
if (resultDTO == null) {
log.error("getOpenedFunctionList convert return null,function:{}", JSON.toJSONString(function));
continue;
}
result.add(resultDTO);
}
}
return result;
}
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java

@ -120,4 +120,16 @@ public class UserRoleController {
}
}
/**
* 根据用户ID查询用户所属角色: 多种身份
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.UserRoleResultDTO>>
* @Author zhangyong
* @Date 14:24 2020-07-23
**/
@PostMapping("getuserroleinfobyuserid/{userId}")
public Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(@PathVariable String userId) {
return userRoleService.getUserRoleInfoByUserId(userId);
}
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java

@ -18,16 +18,18 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.entity.UserRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户角色关系表
* 用户角色关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-30
@ -52,4 +54,13 @@ public interface UserRoleDao extends BaseDao<UserRoleEntity> {
**/
List<String> getUserRoleList(UserRoleFormDTO userRoleFormDTO);
}
/**
* 根据用户ID查询用户所属角色: 多种身份
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.UserRoleResultDTO>>
* @Author zhangyong
* @Date 14:24 2020-07-23
**/
Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(@Param("userId") String userId);
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java

@ -113,4 +113,13 @@ public interface UserRoleService extends BaseService<UserRoleEntity> {
*/
Result saveUserRole(UserRoleDTO userRoleDTO);
}
/**
* 根据用户ID查询用户所属角色: 多种身份
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.UserRoleResultDTO>>
* @Author zhangyong
* @Date 14:24 2020-07-23
**/
Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(String userId);
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java

@ -132,4 +132,9 @@ public class UserRoleServiceImpl extends BaseServiceImpl<UserRoleDao, UserRoleEn
return new Result();
}
}
@Override
public Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(String userId) {
return baseDao.getUserRoleInfoByUserId(userId);
}
}

19
epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

@ -71,4 +71,21 @@
</select>
</mapper>
<select id="getUserRoleInfoByUserId" parameterType="java.lang.String"
resultType="com.epmet.dto.result.UserRoleResultDTO">
SELECT
DISTINCT
er.ROLE_NAME,
er.ROLE_KEY
FROM
USER_ROLE ur
JOIN EPMET_ROLE er ON ur.ROLE_ID = er.ID
<where>
er.DEL_FLAG = 0
AND
ur.DEL_FLAG = 0
AND
ur.USER_ID = #{userId}
</where>
</select>
</mapper>

Loading…
Cancel
Save