diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index b4a81ce53a..a7ae559a01 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/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 = "/"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java new file mode 100644 index 0000000000..1dc0b571c5 --- /dev/null +++ b/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; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 63cab186d4..59a602b124 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/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, "添加客户根级组织失败"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/pom.xml b/epmet-module/epmet-heart/epmet-heart-client/pom.xml index 8701e1a09d..454488ddc2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-client/pom.xml @@ -26,6 +26,12 @@ io.springfox springfox-swagger-ui + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java new file mode 100644 index 0000000000..e1bd5fc097 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java new file mode 100644 index 0000000000..10a03cfd90 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java new file mode 100644 index 0000000000..d84b3b4698 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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 images; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java new file mode 100644 index 0000000000..a587969ca2 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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 images; + + /** + * 0不同步实况1同步到实况记录 + */ + @NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private Integer syncLive; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java new file mode 100644 index 0000000000..26b8591599 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java new file mode 100644 index 0000000000..4d6e9bbf3f --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java new file mode 100644 index 0000000000..18dba0c301 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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 actContent; + + /** + * 用户当前状态(sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消) + */ + private String currentUserStatus; + + /** + * 用户是否是志愿者身份 (true:是,false 不是) + */ + 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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java similarity index 78% rename from epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java rename to epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java index cb3cc26361..8798dfb0ef 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java +++ b/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 clocks; - - - + private List actLives; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java new file mode 100644 index 0000000000..34d18ae9d2 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java new file mode 100644 index 0000000000..f52006de80 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java new file mode 100644 index 0000000000..d3d50da078 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java new file mode 100644 index 0000000000..f98f1bc474 --- /dev/null +++ b/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> + * @author zhangyong + * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) + * @Date 2020/7/22 9:30 + **/ + @PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo") + Result> heartQueryUserBaseInfo(@RequestBody List userIds); + + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:13 2020-07-23 + **/ + @PostMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE) + Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java new file mode 100644 index 0000000000..71447cb0a6 --- /dev/null +++ b/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> heartQueryUserBaseInfo(List userIds) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds); + } + + @Override + public Result> getUserRoleInfoByUserId(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 235dbca23b..7231d7132a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/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 + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) { + return actInfoService.actDetail(tokenDto, formDto); + } + + /** + * 活动详情-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("rejectdetail") + public Result rejectDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) { + return actInfoService.rejectDetail(tokenDto, formDto); + } + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("summary/list") + public Result summaryList(@RequestBody ResiActContentFormDTO formDto) { + return actSummaryService.summaryList(formDto); + } + + /** + * 活动详情-已结束-现场实况列表 + * + * @param actId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("livereclist") + public Result 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> + * @Author zhangyong + * @Date 17:42 2020-07-22 + **/ + @PostMapping("leaderboard") + public Result> 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); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java new file mode 100644 index 0000000000..f93e0da287 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index dfe34da353..1d4cf03f8b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/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 { * @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 + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + ResiActRefusedDetailResultDTO selectActRejectDetail(ResiActDetailFormDTO formDto); + + /** + * 从活动内容表,查询活动内容 + * + * @param actId + * @return java.util.List + * @Author zhangyong + * @Date 09:56 2020-07-22 + **/ + List selectListActContent(@Param("actId") String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java index dec7d0055b..61d04aa888 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java +++ b/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 { - -} \ No newline at end of file + + /** + * 根据活动id,查询活动下的所有活动实况 + * + * @param actId + * @return java.util.List + * @Author zhangyong + * @Date 16:27 2020-07-22 + **/ + List selectListActLives(@Param("actId") String actId); + + /** + * 根据实况id,查询每条实况对应的多张图片 + * + * @param liveIds + * @return java.util.List + * @Author zhangyong + * @Date 17:04 2020-07-22 + **/ + List selectListActLiveImg(@Param("liveId") List liveIds); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java index 9ebc0e3fed..cb4993d0b0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java +++ b/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 { - -} \ No newline at end of file + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.dto.result.resi.ResiActSummaryResultDTO + * @Author zhangyong + * @Date 15:11 2020-07-22 + **/ + ResiActSummaryResultDTO selectListSummary(ResiActContentFormDTO formDto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index 0aa11f07ef..547ea17bc7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -62,6 +62,26 @@ public interface ActUserRelationDao extends BaseDao { **/ 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 { * @Date 2020/7/23 15:57 **/ Integer countObtainPointsActNum(String userId); -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java index 8ec5974ac9..4a22ba2ce6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java +++ b/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 { * @Date 2020/7/21 22:48 **/ HeartUserInfoDTO selectByUserId(String userId); -} \ No newline at end of file + + + /** + * 查询用户是否是志愿者: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 + * @Author zhangyong + * @Date 18:06 2020-07-22 + **/ + List selectListLeaderboard(ResiActBaseFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java index 32c0978916..ec70e7e44b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java @@ -192,13 +192,24 @@ public interface ActInfoService extends BaseService { Result> actLookBack(ResiActBaseFormDTO formDTO); /** - * 取消活动报名 + * 活动详情 * * @param tokenDto - * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @param formDto + * @return com.epmet.commons.tools.utils.Result * @Author zhangyong - * @Date 09:29 2020-07-20 + * @Date 13:39 2020-07-21 + **/ + Result actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); + + /** + * 活动详情-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 **/ - Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO); + Result rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index aa89cb830a..4185eedf75 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/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 { /** - * 默认分页 + * 活动详情-已结束-现场实况列表 * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); + * @param actId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result liveRecList(String actId); /** - * 默认查询 + * 活动-添加实况 + * 返回实况id,主要是因为,当签到并转发实况时,表中需要存储【实况ID】 * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map 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); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:40 2020-07-23 + **/ + Result inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java index c8119da389..84aec10141 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java +++ b/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 { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map 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); -} \ No newline at end of file + * @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); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java index 6cc0b1e450..863626d44f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java +++ b/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 { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result summaryList(ResiActContentFormDTO formDto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java index a93a4936cd..17d7d0c93b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java +++ b/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 { * @Date 2020/7/21 22:48 **/ HeartUserInfoDTO getByUserId(String userId); -} \ No newline at end of file + + + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:42 2020-07-22 + **/ + Result> leaderboard(ResiActBaseFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index e7874814d2..6938871d5b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/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 { /** - * 默认分页 + * 志愿者认证 * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map 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); -} \ No newline at end of file + * @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); + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index a1b23bed6b..550e13d878 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/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 page(Map params) { IPage page = baseDao.selectPage( @@ -189,17 +198,165 @@ public class ActInfoServiceImpl extends BaseServiceImpl 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().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 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 rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + ResiActRefusedDetailResultDTO detail = baseDao.selectActRejectDetail(formDto); + return new Result().ok(detail); } @Override @@ -207,11 +364,10 @@ public class ActInfoServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActLiveRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActLiveRecDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public 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 liveRecList(String actId) { + // 查询实况记录 + List actLives = baseDao.selectListActLives(actId); + List userIds = new ArrayList<>(); + List liveIds = new ArrayList<>(); + for (ActLiveRecDTO actLive : actLives){ + userIds.add(actLive.getUserId()); + liveIds.add(actLive.getId()); + } + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds); + // 根据活动实况id,查询对应实况的图片集合 + List actLiveImg = baseDao.selectListActLiveImg(liveIds); + // 数据汇总 + ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO(); + List dataContainer = new ArrayList<>(); + for (int k = 0; k < actLives.size(); k++) { + Map 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 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().ok(resultDto); } @Override @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + public Result 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 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().ok(actLiveRecEntity.getId()); } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index ac608c807a..88719c0b99 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/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 page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActSignInRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActSignInRecDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } + @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 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 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(); } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java index 4bb9ad328f..d3f9087afc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java +++ b/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 summaryList(ResiActContentFormDTO formDto) { + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); + return new Result().ok(baseDao.selectListSummary(formDto)); + } + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index 06cb2f96ed..5169f119df 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/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 page(Map params) { @@ -140,5 +148,24 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl page(Map params) { @@ -113,4 +122,32 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl> leaderboard(ResiActBaseFormDTO formDTO) { + // 获取排好序的 排行榜 + List leaderboardList = baseDao.selectListLeaderboard(formDTO); + // 根据用户ID获取微信昵称、头像 + List userIds = new ArrayList<>(); + for (HeartUserInfoDTO list : leaderboardList){ + userIds.add(list.getUserId()); + } + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds); + + List resultDTOS = new ArrayList<>(); + for (HeartUserInfoDTO list : leaderboardList){ + ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO(); + dto.setKindnessTime(list.getKindnessTime()); + dto.setVolunteerFlag(list.getVolunteerFlag()); + dto.setParticipationNum(list.getParticipationNum()); + List wxInfo = userWxInfos.getData(); + for (UserBaseInfoResultDTO wx : wxInfo){ + if (list.getUserId().equals(wx.getUserId())){ + dto.setHeadImg(wx.getHeadImgUrl()); + dto.setNickname(wx.getNickname()); + } + } + } + return new Result>().ok(resultDTOS); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index c5e11e7f2c..88dd354a4c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/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 page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, VolunteerInfoDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } @Override - public 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)); - } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java new file mode 100644 index 0000000000..1ecbcecca1 --- /dev/null +++ b/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"; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java new file mode 100644 index 0000000000..7d2334a9b0 --- /dev/null +++ b/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"; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java new file mode 100644 index 0000000000..2b56bdc176 --- /dev/null +++ b/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 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 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 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()); + } + } + } + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 3f9eb4a072..4b50ae3bd4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/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} + + + + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml index 6ebfea5ed7..6e0281baf5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml @@ -19,5 +19,33 @@ + + - \ No newline at end of file + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml index f71666b3c1..6ff1b956d0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml @@ -17,5 +17,18 @@ - - \ No newline at end of file + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index ff144eb5d6..5d54c3309b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -62,6 +62,39 @@ AND aur.ACT_ID = #{actId} + + + + + UPDATE act_user_relation + SET + + STATUS = #{status}, + + + CANCEL_TIME = NOW(), + CANCEL_REASON = #{cancelReason}, + + + SIGN_IN_FLAG = #{signInFlag}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = NOW() + WHERE + DEL_FLAG = '0' + AND ACT_ID = #{actId} + AND USER_ID = #{userId} + + - \ No newline at end of file + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml index 341370c3f7..1c4fdba03f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml +++ b/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} - \ No newline at end of file + + + + + + + diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java deleted file mode 100644 index 25251dd36a..0000000000 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.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; - -} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java new file mode 100644 index 0000000000..d8a7fee9cb --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java new file mode 100644 index 0000000000..fca065c9d6 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java new file mode 100644 index 0000000000..93566a19b3 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java new file mode 100644 index 0000000000..817b94d7c1 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java new file mode 100644 index 0000000000..8ed856dc91 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java new file mode 100644 index 0000000000..bf8e546806 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 49ccab5b90..a6eef46a98 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -69,6 +69,18 @@ 2.0.0 compile + + com.epmet + oper-customize-client + 2.0.0 + compile + + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java new file mode 100644 index 0000000000..ab1d97453c --- /dev/null +++ b/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; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java new file mode 100644 index 0000000000..e7ff400906 --- /dev/null +++ b/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; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java new file mode 100644 index 0000000000..9d2b01d291 --- /dev/null +++ b/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 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().ok(true); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java new file mode 100644 index 0000000000..a0c7f479dd --- /dev/null +++ b/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> getFunctionList(@LoginUser TokenDto tokenDTO) { + return new Result>().ok(pointRuleService.getFunctionList(tokenDTO.getCustomerId())); + } + + /** + * desc:根据功能id获取积分规则 + * + * @param tokenDTO + * @param formDTO + * @return + */ + @PostMapping(value = "list") + public Result> list(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(pointRuleService.list(formDTO)); + } + + /** + * desc:根据规则id获取积分规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "detail") + public Result detail(@RequestBody PointDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(pointRuleService.detail(formDTO)); + } + + /** + * desc:根据功能id获取积分规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "update") + public Result update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + pointRuleService.update(tokenDTO,formDTO); + return new Result().ok(true); + } + + /** + * desc:添加规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "add") + public Result add(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + pointRuleService.add(tokenDTO,formDTO); + return new Result().ok(true); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java index 3ab8e48b42..2c8f5a214a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java +++ b/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 { - + + /** + * desc:获取该客户下有规则的功能Id + * + * @param customerId + * @return + */ + List selectFunctionIds(@Param("customerId") String customerId); + + /** + * desc:获取该客户下有规则的功能Id + * + * @param formDTO + * @return + */ + List selectListByFunctionId(PointRuleListFormDTO formDTO); + + int updateByCustomerId(PointRuleEntity entity); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java similarity index 88% rename from epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java index 2721c88716..a959af0219 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java +++ b/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 { +public interface RuleOperateLogDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java index affd55595e..c2132a4292 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java +++ b/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); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java similarity index 88% rename from epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java index 4068bba53b..573a9f52da 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java +++ b/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; diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java index 3c84c43cad..fa53b5be05 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java +++ b/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 { /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-20 + * desc:根据用户id获取积分规则-功能列表 + * @param customerId + * @return */ - PageData page(Map params); + List getFunctionList(String customerId); - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-20 - */ - List list(Map params); + /** + * desc:根据客户Id 及功能Id获取规则列表 + * @param formDTO + * @return + */ + List 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); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java index 962df38027..46e78037ec 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java +++ b/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 { +public interface SysOperateLogService extends BaseService { /** * 默认分页 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index c64ccfdc35..8e40169645 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/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 implements PointRuleService { - - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, PointRuleDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, PointRuleDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public 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 getFunctionList(String customerId) { + List result = new ArrayList<>(); + CustomerFunctionListFormDTO formDTO = new CustomerFunctionListFormDTO(); + formDTO.setCustomerId(customerId); + Result> 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 resultData = openedFunctionResult.getData(); + if (CollectionUtils.isEmpty(resultData)) { + log.warn("getFunctionList customerId:{} have opened any function", customerId); + return result; + } + List 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 list(PointRuleListFormDTO formDTO) { + List result = new ArrayList<>(); + List 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 resultStaff = epmetUserOpenFeignClient.getCustomerStaff(userId); + if (!resultStaff.success() || null == resultStaff.getData()) { + throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getMsg()); + } + return resultStaff.getData(); + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java index 59604433bf..b309d3f7a0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java +++ b/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 implements SysOperateLogService { +public class SysOperateLogServiceImpl extends BaseServiceImpl implements SysOperateLogService { @Override public PageData page(Map params) { - IPage page = baseDao.selectPage( + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); @@ -55,15 +55,15 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, SysOperateLogDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; @@ -71,21 +71,21 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl - - + @@ -23,6 +22,18 @@ - - + + + + 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} + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml similarity index 87% rename from epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml rename to epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml index 0fe2621044..e20a977e8f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml @@ -1,9 +1,9 @@ - + - + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 9e81857ef7..8707b1cf55 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/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> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index 5c2271f1b3..d8e2fa7249 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/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 getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto); + @Override + @PostMapping(value = "/oper/customize/customerfunction/getOpenedFunctionList", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public Result> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO){ + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getOpenedFunctionList", formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java index 7c2bbda050..71e165696b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java +++ b/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> customerOpenedFunction(@RequestBody CustomerFunctionListFormDTO formDTO) { - return new Result>().ok(customerFunctionService.customerOpenedFunction(formDTO)); + @PostMapping("openedfunctionlist") + public Result> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO) { + return new Result>().ok(customerFunctionService.getOpenedFunctionList(formDTO)); } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java index 17fcb2be66..70b5c55404 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java @@ -118,5 +118,5 @@ public interface CustomerFunctionService extends BaseService customerOpenedFunction(CustomerFunctionListFormDTO formDTO); + List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java index 7c68f32ec1..dadf4257ea 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java +++ b/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 implements CustomerFunctionService { @@ -211,8 +214,34 @@ public class CustomerFunctionServiceImpl extends BaseServiceImpl customerOpenedFunction(CustomerFunctionListFormDTO formDTO) { - return null; + public List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())){ + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + List result = new ArrayList<>(); + //查询所有已上架功能列表(默认、定制功能) + List funList = functionDao.selectFunctionList(); + if(CollectionUtils.isEmpty(funList)){ + return result; + } + //查询当前客户已拥有的功能 + List openedList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); + if(CollectionUtils.isEmpty(openedList)){ + log.warn("getOpenedFunctionList customerId:{} have any function",formDTO.getCustomerId()); + return result; + } + Set 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; } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java index f442da6e7f..f73fc1b52f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java @@ -120,4 +120,16 @@ public class UserRoleController { } -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + @PostMapping("getuserroleinfobyuserid/{userId}") + public Result> getUserRoleInfoByUserId(@PathVariable String userId) { + return userRoleService.getUserRoleInfoByUserId(userId); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java index 989c20b2f1..58b864bce3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java +++ b/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 { **/ List getUserRoleList(UserRoleFormDTO userRoleFormDTO); -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + Result> getUserRoleInfoByUserId(@Param("userId") String userId); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java index a22191edb0..c431331236 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java @@ -113,4 +113,13 @@ public interface UserRoleService extends BaseService { */ Result saveUserRole(UserRoleDTO userRoleDTO); -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + Result> getUserRoleInfoByUserId(String userId); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java index 3650de51fc..4c0eafdad9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java @@ -132,4 +132,9 @@ public class UserRoleServiceImpl extends BaseServiceImpl> getUserRoleInfoByUserId(String userId) { + return baseDao.getUserRoleInfoByUserId(userId); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml index af3e8cbfbb..803fa40621 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml @@ -71,4 +71,21 @@ - \ No newline at end of file + +