diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActBaseFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActBaseFormDTO.java new file mode 100644 index 0000000000..04a0b710aa --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActBaseFormDTO.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动列表(标准) 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActBaseFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = { AddUserInternalGroup.class }) + private String customerId; + + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class }) + private Integer pageNo; + + /** + * 页容量,默认20页 + */ + @Min(value = 1, message = "每页条数必须大于必须大于0", groups = { AddUserInternalGroup.class }) + private Integer pageSize; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiLatestActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiLatestActFormDTO.java new file mode 100644 index 0000000000..0f9af626e5 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiLatestActFormDTO.java @@ -0,0 +1,57 @@ +/** + * 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 lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 最新活动列表 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-21 + */ +@Data +public class ResiLatestActFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = { AddUserInternalGroup.class }) + private String customerId; + + /** + * 页容量,默认20页 + */ + @Min(value = 1, message = "每页条数必须大于必须大于0", groups = { AddUserInternalGroup.class }) + private Integer num; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java new file mode 100644 index 0000000000..1cad8308bc --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 我的活动列表 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiMyActFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class }) + private Integer pageNo; + + /** + * 页容量,默认20页 + */ + @Min(value = 1, message = "每页条数必须大于必须大于0", groups = { AddUserInternalGroup.class }) + private Integer pageSize; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActInfoResultDTO.java new file mode 100644 index 0000000000..c842cef5e4 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActInfoResultDTO.java @@ -0,0 +1,90 @@ +/** + * 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 ResiActInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 活动ID + */ + private String actId; + + /** + * 标题 + */ + private String title; + + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动开始时间 + */ + private String actStartTime; + + /** + * 活动结束时间 + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 已报名人数 + */ + private Integer signupNum; + + /** + * 活动状态:(报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;取消报名canceld;) + */ + private String actCurrentState; + + /** + *用户报名状态(no_signed_up: 未报名,signed_up: 已报名) + */ + private String signupFlag; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiInProgressActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiInProgressActResultDTO.java new file mode 100644 index 0000000000..b6905711fe --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiInProgressActResultDTO.java @@ -0,0 +1,44 @@ +/** + * 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-21 + */ +@Data +public class ResiInProgressActResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLatestActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLatestActResultDTO.java new file mode 100644 index 0000000000..1bf6b8124e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLatestActResultDTO.java @@ -0,0 +1,85 @@ +/** + * 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 ResiLatestActResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动开始时间 + */ + private String actStartTime; + + /** + * 活动结束时间 + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 已报名人数 + */ + private Integer signupNum; + + /** + * 活动状态:(报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress;) + */ + private String actCurrentState; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLookBackActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLookBackActResultDTO.java new file mode 100644 index 0000000000..fc7d7d39e7 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLookBackActResultDTO.java @@ -0,0 +1,69 @@ +/** + * 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 ResiLookBackActResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动开始时间 + */ + private String actStartTime; + + /** + * 活动结束时间 + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动状态:(已结束:finished;) + */ + private String actCurrentState; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiMyActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiMyActResultDTO.java new file mode 100644 index 0000000000..b477f6d513 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiMyActResultDTO.java @@ -0,0 +1,85 @@ +/** + * 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 ResiMyActResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动开始时间 + */ + private String actStartTime; + + /** + * 活动结束时间 + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额(1) false: 不限制名额(0)) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 已报名人数 + */ + private Integer signupNum; + + /** + * 活动当前状态(审核中auditing,审核通过passed,审核不通过refused,已结束canceld) + */ + private String actCurrentState; +} 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 new file mode 100644 index 0000000000..235dbca23b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -0,0 +1,168 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +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.commons.tools.utils.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 居民端-活动列表相关api + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/19 23:17 + */ +@RestController +@RequestMapping("/resi/act") +public class ResiActListController { + + @Autowired + private ActInfoService actInfoService; + + /** + * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("list") + public Result> listAct(@LoginUser TokenDto tokenDto, @RequestBody ResiActBaseFormDTO formDto) { + return actInfoService.listAct(tokenDto, formDto); + } + + + /** + * 我的活动-审核中 + * + * @param tokenDto + * @param formDto + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-21 + **/ + @PostMapping("list/auditing") + public Result> listAuditing(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + return actInfoService.myActListAuditing(tokenDto, formDto); + } + + /** + * 我的活动-未通过 + * + * @param tokenDto + * @param formDto + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-21 + **/ + @PostMapping("list/refused") + public Result> listRefused(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + return actInfoService.myActListRefused(tokenDto, formDto); + } + + /** + * 我的活动-已通过 + * + * @param tokenDto + * @param formDto + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-21 + **/ + @PostMapping("list/passed") + public Result> listPassed(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + return actInfoService.myActListPassed(tokenDto, formDto); + } + + /** + * 我的活动-已结束 + * + * @param tokenDto + * @param formDto + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-21 + **/ + @PostMapping("list/canceld") + public Result> listcanceld(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + return actInfoService.myActListCanceld(tokenDto, formDto); + } + + /** + * 最新活动列表 + * + * @param formDto + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-21 + **/ + @PostMapping("list/latestact") + public Result> latestAct(@RequestBody ResiLatestActFormDTO formDto) { + return actInfoService.latestAct(formDto); + } + + /* + * 正在进行中的活动 + * 进入活动的快捷入口, 前端只取第一条 + * + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:56 2020-07-21 + **/ + @PostMapping("inprogress") + public Result> inProgressAct(@LoginUser TokenDto tokenDto) { + return actInfoService.inProgressAct(tokenDto); + } + + /** + * 活动回顾列表(包含状态:已结束:finished;) + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("actlookback") + public Result> actLookBack(@RequestBody ResiActBaseFormDTO formDto) { + return actInfoService.actLookBack(formDto); + } + + /** + * 取消活动报名 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:29 2020-07-20 + **/ + @PostMapping("cancelsignup") + public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return actInfoService.cancelSignUp(tokenDto, formDTO); + } + + /** + * 重新定位 + * 根据活动id、前端传的实时经纬度,与活动设置的经纬度相比较,判断用户是否已到达打卡地点 + * + * @param formDTO + * @return javax.xml.transform.Result + * @Author zhangyong + * @Date 16:48 2020-07-20 + **/ + @PostMapping("checksigninaddress") + public Result cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return actInfoService.checkSignInAddress(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 a5cdb23ff9..ddd1dc1088 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 @@ -18,8 +18,16 @@ 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.ResiLatestActFormDTO; +import com.epmet.dto.form.resi.ResiMyActFormDTO; +import com.epmet.dto.result.resi.*; import com.epmet.entity.ActInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 活动信息 @@ -29,5 +37,141 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActInfoDao extends BaseDao { - -} \ No newline at end of file + + /** + * 活动列表 - 报名中(未报满) - signing_up + * 列表排序第一组 无分页 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListActSigningUp(ResiActBaseFormDTO formDTO); + + /** + * 活动列表 - (报名中),已报满 - enough + * 列表排序第二组 无分页 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListActQuotaIsEnough(ResiActBaseFormDTO formDTO); + + /** + * 活动列表 - 截止报名 - end_sign_up + * 列表排序第三组 无分页 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListActEndSignUp(ResiActBaseFormDTO formDTO); + + /** + * 活动列表 - 已开始 - in_progress + * 列表排序第四组 无分页 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListActInProgress(ResiActBaseFormDTO formDTO); + + /** + * 活动列表 - 已结束 - finished + * 列表排序第四无组 分页 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListActFinished(ResiActBaseFormDTO formDTO); + // 活动列表End + + /** + * 我的活动-审核中 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-20 + **/ + List selectListMyActAuditing(ResiMyActFormDTO formDTO); + + /** + * 我的活动-审核不通过 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-20 + **/ + List selectListActRefused(ResiMyActFormDTO formDTO); + + /** + * 我的活动-已通过 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-20 + **/ + List selectListActMyHavePassed(ResiMyActFormDTO formDTO); + + /** + * 我的活动-已结束 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-20 + **/ + List selectListMyActCanceld(ResiMyActFormDTO formDTO); + // 我的活动End + + /** + * 最新活动列表(未结束的、未取消的活动) + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListLatestAct(ResiLatestActFormDTO formDTO); + + /** + * 即将进行/正在进行中的活动 + * 进入活动的快捷入口,滚动显示 当前用户正在(或将要)进行的一条活动 + * 活动开始前1小时,此处展示:您报名的“情暖夕阳,爱在锦水”的活动还有xx分钟开始。 + * 活动开始后显示:正在进行中的活动:“情暖夕阳。。。 + * + * @param userId + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListInProgress(@Param("userId") String userId); + + /** + * 活动回顾列表 + * 已结束的活动,并且有实况或有回顾 + * 按照时间顺序排序 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 11:00 2020-07-20 + **/ + List selectListLookBackAct(ResiActBaseFormDTO formDTO); + + /** + * 根据活动id、用户id 查询用户报名的活动信息 + * + * @param actId + * @param userId + * @return com.epmet.dto.ActInfoDTO + * @Author zhangyong + * @Date 17:39 2020-07-20 + **/ + ActInfoDTO queryActAccordingToActIdAndUserId(@Param("actId") String actId, @Param("userId") String userId); +} 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 3f948abe52..32c0978916 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 @@ -19,9 +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.dto.ActInfoDTO; +import com.epmet.dto.form.resi.*; +import com.epmet.dto.result.resi.*; import com.epmet.entity.ActInfoEntity; +import com.epmet.commons.tools.utils.Result; import java.util.List; import java.util.Map; @@ -92,4 +96,109 @@ public interface ActInfoService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 根据活动id、前端传的实时经纬度,与活动设置的经纬度相比较,判断用户是否已到达打卡地点 + * @param fromDTO + * @return javax.xml.transform.Result + * @Author zhangyong + * @Date 16:48 2020-07-20 + **/ + Result checkSignInAddress(ResiActCaculateDistanceFormDTO fromDTO); + + /** + * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result> listAct(TokenDto tokenDto, ResiActBaseFormDTO formDto); + + /* + * 我的活动-审核中 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:15 2020-07-21 + **/ + Result> myActListAuditing(TokenDto tokenDto, ResiMyActFormDTO formDto); + + /* + * 我的活动-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:15 2020-07-21 + **/ + Result> myActListRefused(TokenDto tokenDto, ResiMyActFormDTO formDto); + + /* + * 我的活动-已通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:15 2020-07-21 + **/ + Result> myActListPassed(TokenDto tokenDto, ResiMyActFormDTO formDto); + + /* + * 我的活动-已结束 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:15 2020-07-21 + **/ + Result> myActListCanceld(TokenDto tokenDto, ResiMyActFormDTO formDto); + + /** + * 最新活动列表 + * + * @param formDto + * @return java.util.List + * @Author zhangyong + * @Date 13:53 2020-07-21 + **/ + Result> latestAct(ResiLatestActFormDTO formDto); + + /** + * 正在进行中的活动 + * 进入活动的快捷入口, 前端只取第一条 + * + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:00 2020-07-21 + **/ + Result> inProgressAct(TokenDto tokenDto); + + /** + * 活动回顾列表(包含状态:已结束:finished;) + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result> actLookBack(ResiActBaseFormDTO formDTO); + + /** + * 取消活动报名 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:29 2020-07-20 + **/ + Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO); +} 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 c5edbe2337..548c11c454 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 @@ -20,19 +20,29 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.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.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.ActInfoDao; 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.redis.ActInfoRedis; import com.epmet.service.ActInfoService; +import com.epmet.service.ActUserRelationService; +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; @@ -49,6 +59,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -101,4 +114,104 @@ public class ActInfoServiceImpl extends BaseServiceImpl> listAct(TokenDto tokenDto, ResiActBaseFormDTO formDto) { + List list = new ArrayList<>(); + formDto.setUserId(tokenDto.getUserId()); + // 查询活动状态是:报名中 signing_up + List signingUp = baseDao.selectListActSigningUp(formDto); + list.addAll(signingUp); + + // 查询活动状态是:已报满 enough + List enough = baseDao.selectListActQuotaIsEnough(formDto); + list.addAll(enough); + + // 查询活动状态是:截止报名 end_sign_up + List endSignUp = baseDao.selectListActEndSignUp(formDto); + list.addAll(endSignUp); + + // 查询活动状态是:已开始 in_progress + List inProgress = baseDao.selectListActInProgress(formDto); + list.addAll(inProgress); + + // 查询活动状态是:已结束 finished + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); + List finished = baseDao.selectListActFinished(formDto); + list.addAll(finished); + return new Result>().ok(list); + } + + @Override + public Result> myActListAuditing(TokenDto tokenDto, ResiMyActFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + List myAct = baseDao.selectListMyActAuditing(formDto); + return new Result>().ok(myAct); + } + + @Override + public Result> myActListRefused(TokenDto tokenDto, ResiMyActFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + List myAct = baseDao.selectListActRefused(formDto); + return new Result>().ok(myAct); + } + + @Override + public Result> myActListPassed(TokenDto tokenDto, ResiMyActFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + List myAct = baseDao.selectListActMyHavePassed(formDto); + return new Result>().ok(myAct); + } + + @Override + public Result> myActListCanceld(TokenDto tokenDto, ResiMyActFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + List myAct = baseDao.selectListMyActCanceld(formDto); + return new Result>().ok(myAct); + } + + @Override + public Result> latestAct(ResiLatestActFormDTO formDto) { + List latest = baseDao.selectListLatestAct(formDto); + return new Result>().ok(latest); + } + + @Override + public Result> inProgressAct(TokenDto tokenDto) { + List inProgress = baseDao.selectListInProgress(tokenDto.getUserId()); + return new Result>().ok(inProgress); + } + + @Override + public Result> actLookBack(ResiActBaseFormDTO formDTO) { + List lookBackAct = baseDao.selectListLookBackAct(formDTO); + return new Result>().ok(lookBackAct); + } + + @Override + public Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO) { + // 判断用户是否已报名该活动 + ActInfoDTO actInfoDTO = baseDao.queryActAccordingToActIdAndUserId(formDTO.getActId(),formDTO.getUserId()); + if (null == actInfoDTO){ + throw new RenException(EpmetErrorCode.NO_ACT_TO_CANCEL_SIGN_UP_WERE_FOUND.getCode()); + } + //1、更新用户活动关系表 +// relationService.update(); + //2、插入用户活动关系日志表 + //3、更新act_info的已报名名额 + return null; + } + + @Override + public Result checkSignInAddress(ResiActCaculateDistanceFormDTO formDTO) { + // 根据活动id,查询活动基本信息 + ActInfoEntity entity = baseDao.selectById(formDTO.getActId()); + Double distance = CaculateDistance.getDistance(formDTO.getLongitude(),formDTO.getLatitude(),entity.getActLongitude().doubleValue(),entity.getActLatitude().doubleValue()); +// if (distance <= entity.getSigninRadius()){ +// return new Result(); +// } else { +// throw new RenException(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getCode()); +// } + return new Result(); + } +} 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 5f95eb5ee2..06a22f4c84 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 @@ -49,4 +49,317 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +