From 88711d3b6cf164a755abb63115f43a2469fa440e Mon Sep 17 00:00:00 2001
From: zhangyongzhangyong <2012005003@qq.coom>
Date: Tue, 21 Jul 2020 16:40:41 +0800
Subject: [PATCH] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-=E6=B4=BB?=
=?UTF-8?q?=E5=8A=A8=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dto/form/resi/ResiActBaseFormDTO.java | 68 ++++
.../dto/form/resi/ResiLatestActFormDTO.java | 57 ++++
.../epmet/dto/form/resi/ResiMyActFormDTO.java | 62 ++++
.../dto/result/resi/ResiActInfoResultDTO.java | 90 +++++
.../resi/ResiInProgressActResultDTO.java | 44 +++
.../result/resi/ResiLatestActResultDTO.java | 85 +++++
.../result/resi/ResiLookBackActResultDTO.java | 69 ++++
.../dto/result/resi/ResiMyActResultDTO.java | 85 +++++
.../controller/ResiActListController.java | 168 ++++++++++
.../main/java/com/epmet/dao/ActInfoDao.java | 148 +++++++-
.../com/epmet/service/ActInfoService.java | 111 +++++-
.../service/impl/ActInfoServiceImpl.java | 115 ++++++-
.../src/main/resources/mapper/ActInfoDao.xml | 315 +++++++++++++++++-
13 files changed, 1412 insertions(+), 5 deletions(-)
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActBaseFormDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiLatestActFormDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActInfoResultDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiInProgressActResultDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLatestActResultDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLookBackActResultDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiMyActResultDTO.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
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
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'signing_up' AS actCurrentState, -- 活动状态:报名中,未报满
+ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag
+ FROM act_info i
+ LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND i.ACT_STATUS = 'published'
+ AND (i.ACT_QUOTA_CATEGORY = 0 OR i.ACT_QUOTA > IFNULL(c.signupNum, 0)) -- 不限名额或者报名人数未报满
+ AND i.CUSTOMER_ID = #{customerId}
+ ORDER BY i.ACT_QUOTA_CATEGORY DESC,i.CREATED_TIME DESC
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'enough' AS actCurrentState, -- 活动状态:报名中,已报满
+ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag
+ FROM act_info i
+ LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND i.ACT_STATUS = 'published'
+ AND i.ACT_QUOTA_CATEGORY = 1 -- 固定名额
+ AND i.ACT_QUOTA = IFNULL(c.signupNum, 0) -- 名额已满
+ AND i.CUSTOMER_ID = #{customerId}
+ ORDER BY i.CREATED_TIME DESC
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'end_sign_up' AS actCurrentState, -- 活动状态:未开始
+ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag
+ FROM act_info i
+ LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ -- 活动开始时间 > 当前时间 并且 报名截止时间 < 当前时间 报名已结束,活动未开始 未开始
+ AND ( ]]> NOW() AND NOW() )
+ AND i.ACT_STATUS != 'canceled'
+ AND i.CUSTOMER_ID = #{customerId}
+ ORDER BY i.CREATED_TIME DESC
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'in_progress' AS actCurrentState, -- 活动状态:进行中
+ IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名)
+ FROM act_info i
+ LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ -- 活动开始时间 <= 当前时间 并且活动结束时间 >= 当前时间 进行中
+ AND ( NOW() AND = ]]> NOW() )
+ AND i.ACT_STATUS != 'canceled'
+ AND i.CUSTOMER_ID = #{customerId}
+ ORDER BY i.CREATED_TIME DESC
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'finished' AS actCurrentState, -- 活动状态:已结束
+ IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名)
+ FROM act_info i
+ LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND i.ACT_STATUS = 'finished'
+ AND i.CUSTOMER_ID = #{customerId}
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT #{pageNo}, #{pageSize}
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'auditing' AS actCurrentState -- 活动状态
+ FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND u.USER_ID = #{userId}
+ AND u.`STATUS` = 'auditing'
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT #{pageNo}, #{pageSize}
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'passed' AS actCurrentState -- 活动状态
+ FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND u.USER_ID = #{userId}
+ AND u.`STATUS` = 'passed'
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT #{pageNo}, #{pageSize}
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'refused' AS actCurrentState -- 活动状态
+ FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND u.USER_ID = #{userId}
+ AND u.`STATUS` = 'refused'
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT #{pageNo}, #{pageSize}
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory, -- 活动名额类型(true:固定名额(1) false: 不限制名额(0))
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ 'canceld' AS actCurrentState -- 活动状态
+ FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0'
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND u.USER_ID = #{userId}
+ AND NOW() -- 活动结束时间 < 当前时间, 活动已结束
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT #{pageNo}, #{pageSize}
+
+
+
+
+ SELECT
+ i.ID actId,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ IF(i.ACT_QUOTA_CATEGORY = 1, true , false ) as actQuotaCategory,
+ i.ACT_QUOTA actQuota,
+ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数
+ case
+ when i.ACT_STATUS = 'published'
+ then
+ case
+ when = ACT_QUOTA ]]> and i.ACT_QUOTA_CATEGORY = 1
+ then 'enough'
+ else 'signing_up' end
+ when ]]> NOW()
+ and NOW()
+ then 'end_sign_up'
+ when NOW()
+ and = ]]> NOW()
+ then 'in_progress'
+ end as actCurrentState
+ FROM act_info i
+ LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
+ WHERE i.DEL_FLAG = '0'
+ AND i.CUSTOMER_ID = #{customerId}
+ AND i.ACT_STATUS != 'finished' AND i.ACT_STATUS != 'canceled'
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT 0, #{num}
+
+
+
+
+ SELECT
+ i.ID actId,
+ CASE
+ WHEN NOW() AND ]]> NOW() THEN
+ CONCAT('您报名的 "',i.TITLE,'" 活动还有',TIMESTAMPDIFF(MINUTE, NOW(), i.ACT_START_TIME),'分钟开始。')
+ ELSE
+ CONCAT('正在进行中的活动:"',i.TITLE,'"。。。')
+ END title
+ FROM act_info i LEFT JOIN act_user_relation r ON i.ID = r.ACT_ID
+ WHERE i.DEL_FLAG = '0'
+ AND r.DEL_FLAG = '0'
+ AND r.USER_ID = #{userId}
+ AND NOW() BETWEEN DATE_SUB(i.ACT_START_TIME, INTERVAL 1 HOUR) AND i.ACT_END_TIME
+
+
+
+
+ SELECT
+ i.ID id,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_ADDRESS actAddress,
+ 'finished' actCurrentState
+ FROM act_info i
+ WHERE i.DEL_FLAG = '0'
+ AND i.SUMMARY_FLAG = 1 OR (SELECT r.ACT_ID FROM act_live_rec r WHERE r.DEL_FLAG = '0' AND r.ACT_ID = i.ID GROUP BY r.ACT_ID)
+ AND i.CUSTOMER_ID = #{customerId}
+ AND i.ACT_STATUS = 'finished'
+ ORDER BY i.CREATED_TIME DESC
+ LIMIT #{pageNo}, #{pageSize}
+
+
+
+ SELECT
+ i.ID id,
+ i.TITLE title,
+ i.COVER_PIC coverPic,
+ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i') actStartTime,
+ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i') actEndTime,
+ i.ACT_QUOTA actQuota,
+ i.ACT_STATUS actStatus,
+ i.VOLUNTEER_LIMIT volunteerLimit,
+ i.AUDIT_SWITCH auditSwitch,
+ i.ACT_ADDRESS actAddress
+ FROM act_info i
+ LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID
+ WHERE i.DEL_FLAG = '0'
+ AND u.DEL_FLAG = '0'
+ AND i.ID = #{actId}
+ AND u.USER_ID = #{userId}
+
+