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/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..96663f3503 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,32 @@ +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.feign.fallback.EpmetUserFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +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); +} 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..656c446b05 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -0,0 +1,25 @@ +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.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); + } +} 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..478bcfaa58 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,18 @@ public class ResiActListController { @Autowired private ActInfoService actInfoService; + @Autowired + private ActUserRelationService actUserRelationService; + + @Autowired + private ActSummaryService actSummaryService; + + @Autowired + private ActLiveRecService actLiveRecService; + + @Autowired + private HeartUserInfoService heartUserInfoService; + /** * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) * @@ -135,6 +147,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 +217,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 +235,20 @@ 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); + } + } 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..8d3508fce6 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -0,0 +1,40 @@ +/** + * 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.dao.VolunteerInfoDao; +import org.springframework.beans.factory.annotation.Autowired; +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 VolunteerInfoDao volunteerInfoDao; + + +} 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 facb735601..ccc5981b5a 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 @@ -61,4 +61,24 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/22 18:20 **/ Integer selectCountUser(@Param("actId") String actId, @Param("status")String status); -} \ No newline at end of file + + /** + * 根据活动id,查询活动已报名的人数 + * + * @param actId + * @return Integer + * @Author zhangyong + * @Date 10:51 2020-07-22 + **/ + Integer selectActSignupNum(@Param("actId") String actId); + + /** + * 将用户与活动的状态修改为 已取消 + * + * @param userRelationDTO + * @return void + * @Author zhangyong + * @Date 14:39 2020-07-22 + **/ + void updateUserStatusToCanceld(ActUserRelationDTO userRelationDTO); +} 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..a0b32263c4 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,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.ActLiveRecDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; import java.util.List; @@ -92,4 +95,14 @@ public interface ActLiveRecService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 活动详情-已结束-现场实况列表 + * + * @param actId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result liveRecList(String actId); +} 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/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( @@ -101,4 +108,40 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl 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); + } + +} 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..cfea34e14e 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/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..dcde4657a7 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java @@ -0,0 +1,38 @@ +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"; +} 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 f7531ff65a..0cd324f25c 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 @@ -61,4 +61,26 @@ AND aur.`STATUS` =#{status} AND aur.ACT_ID = #{actId} - \ No newline at end of file + + + + + + UPDATE act_user_relation + SET + STATUS = #{status}, + CANCEL_TIME = NOW(), + CANCEL_REASON = #{cancelReason} + WHERE + DEL_FLAG = '0' + AND ACT_ID = #{actId} + AND USER_ID = #{userId} + + 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 + + + + + + +