Browse Source

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

master
yinzuomei 5 years ago
parent
commit
ab2d5e859f
  1. 68
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActBaseFormDTO.java
  2. 57
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiLatestActFormDTO.java
  3. 62
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java
  4. 90
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActInfoResultDTO.java
  5. 44
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiInProgressActResultDTO.java
  6. 85
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLatestActResultDTO.java
  7. 69
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLookBackActResultDTO.java
  8. 85
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiMyActResultDTO.java
  9. 168
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  10. 148
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java
  11. 111
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java
  12. 115
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  13. 315
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

68
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import 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;
}

57
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import 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;
}

62
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import 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;
}

90
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 活动列表(标准) 返回值
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class 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;
}

44
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 即将进行/正在进行中的活动 返回值
*
* @author zhangyong
* @since v1.0.0 2020-07-21
*/
@Data
public class ResiInProgressActResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actId;
/**
* 标题
*/
private String title;
}

85
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 最新活动列表 返回值
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class 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;
}

69
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 活动回顾列表 返回值
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class 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;
}

85
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 我的活动列表 返回值
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class 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;
}

168
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<java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("list")
public Result<List<ResiActInfoResultDTO>> listAct(@LoginUser TokenDto tokenDto, @RequestBody ResiActBaseFormDTO formDto) {
return actInfoService.listAct(tokenDto, formDto);
}
/**
* 我的活动-审核中
*
* @param tokenDto
* @param formDto
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-21
**/
@PostMapping("list/auditing")
public Result<List<ResiMyActResultDTO>> listAuditing(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
return actInfoService.myActListAuditing(tokenDto, formDto);
}
/**
* 我的活动-未通过
*
* @param tokenDto
* @param formDto
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-21
**/
@PostMapping("list/refused")
public Result<List<ResiMyActResultDTO>> listRefused(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
return actInfoService.myActListRefused(tokenDto, formDto);
}
/**
* 我的活动-已通过
*
* @param tokenDto
* @param formDto
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-21
**/
@PostMapping("list/passed")
public Result<List<ResiMyActResultDTO>> listPassed(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
return actInfoService.myActListPassed(tokenDto, formDto);
}
/**
* 我的活动-已结束
*
* @param tokenDto
* @param formDto
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-21
**/
@PostMapping("list/canceld")
public Result<List<ResiMyActResultDTO>> listcanceld(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
return actInfoService.myActListCanceld(tokenDto, formDto);
}
/**
* 最新活动列表
*
* @param formDto
* @return java.util.List<com.epmet.dto.result.resi.ResiLatestActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-21
**/
@PostMapping("list/latestact")
public Result<List<ResiLatestActResultDTO>> latestAct(@RequestBody ResiLatestActFormDTO formDto) {
return actInfoService.latestAct(formDto);
}
/*
* 正在进行中的活动
* 进入活动的快捷入口, 前端只取第一条
*
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiInProgressActResultDTO>>
* @Author zhangyong
* @Date 14:56 2020-07-21
**/
@PostMapping("inprogress")
public Result<List<ResiInProgressActResultDTO>> inProgressAct(@LoginUser TokenDto tokenDto) {
return actInfoService.inProgressAct(tokenDto);
}
/**
* 活动回顾列表(包含状态已结束finished)
* @param formDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLookBackActResultDTO>>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("actlookback")
public Result<List<ResiLookBackActResultDTO>> 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);
}
}

148
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<ActInfoEntity> {
}
/**
* 活动列表 - 报名中(未报满) - signing_up
* 列表排序第一组 无分页
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiActInfoResultDTO> selectListActSigningUp(ResiActBaseFormDTO formDTO);
/**
* 活动列表 - (报名中)已报满 - enough
* 列表排序第二组 无分页
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiActInfoResultDTO> selectListActQuotaIsEnough(ResiActBaseFormDTO formDTO);
/**
* 活动列表 - 截止报名 - end_sign_up
* 列表排序第三组 无分页
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiActInfoResultDTO> selectListActEndSignUp(ResiActBaseFormDTO formDTO);
/**
* 活动列表 - 已开始 - in_progress
* 列表排序第四组 无分页
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiActInfoResultDTO> selectListActInProgress(ResiActBaseFormDTO formDTO);
/**
* 活动列表 - 已结束 - finished
* 列表排序第四无组 分页
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiActInfoResultDTO> selectListActFinished(ResiActBaseFormDTO formDTO);
// 活动列表End
/**
* 我的活动-审核中
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-20
**/
List<ResiMyActResultDTO> selectListMyActAuditing(ResiMyActFormDTO formDTO);
/**
* 我的活动-审核不通过
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-20
**/
List<ResiMyActResultDTO> selectListActRefused(ResiMyActFormDTO formDTO);
/**
* 我的活动-已通过
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-20
**/
List<ResiMyActResultDTO> selectListActMyHavePassed(ResiMyActFormDTO formDTO);
/**
* 我的活动-已结束
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-20
**/
List<ResiMyActResultDTO> selectListMyActCanceld(ResiMyActFormDTO formDTO);
// 我的活动End
/**
* 最新活动列表(未结束的未取消的活动
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiLatestActResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiLatestActResultDTO> selectListLatestAct(ResiLatestActFormDTO formDTO);
/**
* 即将进行/正在进行中的活动
* 进入活动的快捷入口滚动显示 当前用户正在(或将要)进行的一条活动
* 活动开始前1小时此处展示您报名的情暖夕阳爱在锦水的活动还有xx分钟开始
* 活动开始后显示正在进行中的活动情暖夕阳
*
* @param userId
* @return java.util.List<com.epmet.dto.result.resi.ResiInProgressActResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiInProgressActResultDTO> selectListInProgress(@Param("userId") String userId);
/**
* 活动回顾列表
* 已结束的活动并且有实况或有回顾
* 按照时间顺序排序
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.resi.ResiLookBackActResultDTO>
* @Author zhangyong
* @Date 11:00 2020-07-20
**/
List<ResiLookBackActResultDTO> 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);
}

111
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<ActInfoEntity> {
* @date 2020-07-19
*/
void delete(String[] ids);
}
/**
* 根据活动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<java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result<List<ResiActInfoResultDTO>> listAct(TokenDto tokenDto, ResiActBaseFormDTO formDto);
/*
* 我的活动-审核中
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>>
* @Author zhangyong
* @Date 14:15 2020-07-21
**/
Result<List<ResiMyActResultDTO>> myActListAuditing(TokenDto tokenDto, ResiMyActFormDTO formDto);
/*
* 我的活动-未通过
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>>
* @Author zhangyong
* @Date 14:15 2020-07-21
**/
Result<List<ResiMyActResultDTO>> myActListRefused(TokenDto tokenDto, ResiMyActFormDTO formDto);
/*
* 我的活动-已通过
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>>
* @Author zhangyong
* @Date 14:15 2020-07-21
**/
Result<List<ResiMyActResultDTO>> myActListPassed(TokenDto tokenDto, ResiMyActFormDTO formDto);
/*
* 我的活动-已结束
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO>>
* @Author zhangyong
* @Date 14:15 2020-07-21
**/
Result<List<ResiMyActResultDTO>> myActListCanceld(TokenDto tokenDto, ResiMyActFormDTO formDto);
/**
* 最新活动列表
*
* @param formDto
* @return java.util.List<com.epmet.dto.result.resi.ResiLatestActResultDTO>
* @Author zhangyong
* @Date 13:53 2020-07-21
**/
Result<List<ResiLatestActResultDTO>> latestAct(ResiLatestActFormDTO formDto);
/**
* 正在进行中的活动
* 进入活动的快捷入口, 前端只取第一条
*
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiInProgressActResultDTO>>
* @Author zhangyong
* @Date 15:00 2020-07-21
**/
Result<List<ResiInProgressActResultDTO>> inProgressAct(TokenDto tokenDto);
/**
* 活动回顾列表(包含状态已结束finished)
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLookBackActResultDTO>>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result<List<ResiLookBackActResultDTO>> 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);
}

115
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<ActInfoDao, ActInfoEntit
@Autowired
private ActInfoRedis actInfoRedis;
@Autowired
private ActUserRelationService relationService;
@Override
public PageData<ActInfoDTO> page(Map<String, Object> params) {
IPage<ActInfoEntity> page = baseDao.selectPage(
@ -101,4 +114,104 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
@Override
public Result<List<ResiActInfoResultDTO>> listAct(TokenDto tokenDto, ResiActBaseFormDTO formDto) {
List<ResiActInfoResultDTO> list = new ArrayList<>();
formDto.setUserId(tokenDto.getUserId());
// 查询活动状态是:报名中 signing_up
List<ResiActInfoResultDTO> signingUp = baseDao.selectListActSigningUp(formDto);
list.addAll(signingUp);
// 查询活动状态是:已报满 enough
List<ResiActInfoResultDTO> enough = baseDao.selectListActQuotaIsEnough(formDto);
list.addAll(enough);
// 查询活动状态是:截止报名 end_sign_up
List<ResiActInfoResultDTO> endSignUp = baseDao.selectListActEndSignUp(formDto);
list.addAll(endSignUp);
// 查询活动状态是:已开始 in_progress
List<ResiActInfoResultDTO> inProgress = baseDao.selectListActInProgress(formDto);
list.addAll(inProgress);
// 查询活动状态是:已结束 finished
int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize();
formDto.setPageNo(pageIndex);
List<ResiActInfoResultDTO> finished = baseDao.selectListActFinished(formDto);
list.addAll(finished);
return new Result<List<ResiActInfoResultDTO>>().ok(list);
}
@Override
public Result<List<ResiMyActResultDTO>> myActListAuditing(TokenDto tokenDto, ResiMyActFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
List<ResiMyActResultDTO> myAct = baseDao.selectListMyActAuditing(formDto);
return new Result<List<ResiMyActResultDTO>>().ok(myAct);
}
@Override
public Result<List<ResiMyActResultDTO>> myActListRefused(TokenDto tokenDto, ResiMyActFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
List<ResiMyActResultDTO> myAct = baseDao.selectListActRefused(formDto);
return new Result<List<ResiMyActResultDTO>>().ok(myAct);
}
@Override
public Result<List<ResiMyActResultDTO>> myActListPassed(TokenDto tokenDto, ResiMyActFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
List<ResiMyActResultDTO> myAct = baseDao.selectListActMyHavePassed(formDto);
return new Result<List<ResiMyActResultDTO>>().ok(myAct);
}
@Override
public Result<List<ResiMyActResultDTO>> myActListCanceld(TokenDto tokenDto, ResiMyActFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
List<ResiMyActResultDTO> myAct = baseDao.selectListMyActCanceld(formDto);
return new Result<List<ResiMyActResultDTO>>().ok(myAct);
}
@Override
public Result<List<ResiLatestActResultDTO>> latestAct(ResiLatestActFormDTO formDto) {
List<ResiLatestActResultDTO> latest = baseDao.selectListLatestAct(formDto);
return new Result<List<ResiLatestActResultDTO>>().ok(latest);
}
@Override
public Result<List<ResiInProgressActResultDTO>> inProgressAct(TokenDto tokenDto) {
List<ResiInProgressActResultDTO> inProgress = baseDao.selectListInProgress(tokenDto.getUserId());
return new Result<List<ResiInProgressActResultDTO>>().ok(inProgress);
}
@Override
public Result<List<ResiLookBackActResultDTO>> actLookBack(ResiActBaseFormDTO formDTO) {
List<ResiLookBackActResultDTO> lookBackAct = baseDao.selectListLookBackAct(formDTO);
return new Result<List<ResiLookBackActResultDTO>>().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();
}
}

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

@ -49,4 +49,317 @@
</resultMap>
</mapper>
<!--活动列表 报名中(未报满) -->
<select id="selectListActSigningUp" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiActInfoResultDTO">
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>
<!--活动列表 - 报名中,已报满-->
<select id="selectListActQuotaIsEnough" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiActInfoResultDTO">
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>
<!--活动列表 - (报名已结束 - 活动未开始),截止报名-->
<select id="selectListActEndSignUp" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiActInfoResultDTO">
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'
-- 活动开始时间 > 当前时间 并且 报名截止时间 &lt; 当前时间 报名已结束,活动未开始 未开始
AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.SIGNUP_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW() )
AND i.ACT_STATUS != 'canceled'
AND i.CUSTOMER_ID = #{customerId}
ORDER BY i.CREATED_TIME DESC
</select>
<!--活动列表 - (活动开始时间 <= 当前时间 并且 活动结束时间 >= 当前时间),进行中-->
<select id="selectListActInProgress" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiActInfoResultDTO">
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'
-- 活动开始时间 &lt;= 当前时间 并且活动结束时间 >= 当前时间 进行中
AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.SIGNUP_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> NOW() )
AND i.ACT_STATUS != 'canceled'
AND i.CUSTOMER_ID = #{customerId}
ORDER BY i.CREATED_TIME DESC
</select>
<!--活动列表 - (活动结束时间 < 当前时间),已结束-->
<select id="selectListActFinished" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiActInfoResultDTO">
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>
<!--我的活动-审核中-->
<select id="selectListMyActAuditing" parameterType="com.epmet.dto.form.resi.ResiMyActFormDTO"
resultType="com.epmet.dto.result.resi.ResiMyActResultDTO">
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>
<!--我的活动-已通过-->
<select id="selectListMyActIHavePassed" parameterType="com.epmet.dto.form.resi.ResiMyActFormDTO"
resultType="com.epmet.dto.result.resi.ResiMyActResultDTO">
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>
<!--我的活动-审核不通过-->
<select id="selectListActRefused" parameterType="com.epmet.dto.form.resi.ResiMyActFormDTO"
resultType="com.epmet.dto.result.resi.ResiMyActResultDTO">
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>
<!--我的活动-已结束-->
<select id="selectListMyActCanceld" parameterType="com.epmet.dto.form.resi.ResiMyActFormDTO"
resultType="com.epmet.dto.result.resi.ResiMyActResultDTO">
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 <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW() -- 活动结束时间 &lt; 当前时间, 活动已结束
ORDER BY i.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>
<!--最新活动列表-->
<select id="selectListLatestAct" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiLatestActResultDTO">
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 <![CDATA[c.signupNum >= ACT_QUOTA ]]> and i.ACT_QUOTA_CATEGORY = 1
then 'enough'
else 'signing_up' end
when <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW()
and <![CDATA[ DATE_FORMAT(i.SIGNUP_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW()
then 'end_sign_up'
when <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> NOW()
and <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> 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>
<!--即将进行/正在进行中的活动-->
<select id="selectListInProgress" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiInProgressActResultDTO">
SELECT
i.ID actId,
CASE
WHEN <![CDATA[DATE_SUB(i.ACT_START_TIME, INTERVAL 1 HOUR) <= ]]> NOW() AND <![CDATA[i.ACT_START_TIME > ]]> 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>
<!--活动回顾列表-->
<select id="selectListLookBackAct" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.result.resi.ResiLookBackActResultDTO">
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>
<select id="queryActAccordingToActIdAndUserId" resultType="com.epmet.dto.ActInfoDTO">
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}
</select>
</mapper>

Loading…
Cancel
Save