Browse Source

爱心互助-居民端

dev
zhangyongzhangyong 5 years ago
parent
commit
f66bbc51a0
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 6
      epmet-module/epmet-heart/epmet-heart-client/pom.xml
  3. 46
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java
  4. 38
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java
  5. 56
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java
  6. 140
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java
  7. 18
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java
  8. 99
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java
  9. 55
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java
  10. 60
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java
  11. 32
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  12. 25
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  13. 92
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  14. 40
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  15. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java
  16. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java
  17. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java
  18. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  19. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java
  20. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java
  21. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java
  22. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java
  23. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java
  24. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java
  25. 198
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  26. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  27. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java
  28. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  29. 39
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java
  30. 38
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java
  31. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java
  32. 90
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java
  33. 69
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  34. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml
  35. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml
  36. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml
  37. 28
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -74,6 +74,9 @@ public enum EpmetErrorCode {
IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"),
PROJECT_IS_CLOSED(8601,"项目已结案"),
// 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),

6
epmet-module/epmet-heart/epmet-heart-client/pom.xml

@ -26,6 +26,12 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

46
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java

@ -0,0 +1,46 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动内容(活动详情-已结束-回顾稿) 入参
*
* @Auther: zhangyong
* @Date: 2020-07-21 18:12
*/
@Data
public class ResiActContentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private String actId;
/**
* 页码从1开始
*/
@Min(value = 1, message = "页码必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private Integer pageNo;
/**
* 页容量默认20页
*/
@Min(value = 1, message = "每页条数必须大于必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private Integer pageSize;
}

38
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动详情 入参
*
* @Auther: zhangyong
* @Date: 2020-07-21 18:12
*/
@Data
public class ResiActDetailFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private String actId;
/**
* 用户id
*/
private String userId;
}

56
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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;
import java.util.Date;
/**
* 活动内容
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiActContentResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actContentId;
/**
* 内容
*/
private String content;
/**
* 内容类型 图片img文字text
*/
private String contentType;
/**
* 内容顺序 从1开始
*/
private Integer orderNum;
}

140
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java

@ -0,0 +1,140 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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;
import java.util.List;
/**
* 活动详情
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class ResiActDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actId;
/**
* 标题
*/
private String title;
/**
* 联系人
*/
private String contacts;
/**
* 联系电话
*/
private String tel;
/**
* 报名截止时间yyyy-MM-dd HH:mm
*/
private String signUpEndTime;
/**
* 活动开始时间yyyy-MM-dd HH:mm
*/
private String actStartTime;
/**
* 活动结束时间yyyy-MM-dd HH:mm
*/
private String actEndTime;
/**
* 活动地点
*/
private String actAddress;
/**
* 活动名额类型true:固定名额 false 不限制名额
*/
private Boolean actQuotaCategory;
/**
* 活动名额
*/
private Integer actQuota;
/**
* 已报名人数
*/
private Integer signupNum;
/**
* 积分奖励
*/
private Integer reward;
/**
* 招募要求
*/
private String requirement;
/**
* 活动详情
*/
private List<ResiActContentResultDTO> actContent;
/**
* 用户当前状态sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消
*/
private String currentUserStatus;
/**
* 用户是否是志愿者身份 (truefalse 不是)
*/
private Boolean userVolunteerFlag;
/**
* 是否需要是志愿者true只有志愿者才可以参加活动false: 只要是居民就可以参加活动
*/
private Boolean volunteerLimit;
/**
* 活动实际开始时间yyyy-MM-dd HH:mm
*/
private String actualStartTime;
/**
* 活动实际结束时间yyyy-MM-dd HH:mm
*/
private String actualEndTime;
/**
* 主办方
*/
private String sponsor;
/**
* 是否已签到(true已签到false未签到)
*/
private Boolean isSignUp;
}

18
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java → epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java

@ -22,27 +22,25 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 打卡列表
* 活动详情-已结束-现场实况列表
*
* @author zhangyong
* @since v1.0.0 2020-07-14
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ActClockListResultDTO implements Serializable {
public class ResiActLiveRecResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 活动打卡人次
* 现场实况次数
*/
private Integer clockNum;
private Integer actLiveNum;
/**
* 打卡列表
*/
private List<Object> clocks;
private List<Object> actLives;
}

99
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java

@ -0,0 +1,99 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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 ResiActRefusedDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String actId;
/**
* 标题
*/
private String title;
/**
* 报名截止时间yyyy-MM-dd HH:mm
*/
private String signUpEndTime;
/**
* 活动开始时间yyyy-MM-dd HH:mm
*/
private String actStartTime;
/**
* 活动结束时间yyyy-MM-dd HH:mm
*/
private String actEndTime;
/**
* 活动地点
*/
private String actAddress;
/**
* 活动名额类型true:固定名额 false 不限制名额
*/
private Boolean actQuotaCategory;
/**
* 活动名额
*/
private Integer actQuota;
/**
* 联系人
*/
private String contacts;
/**
* 联系电话
*/
private String tel;
/**
* 积分奖励
*/
private Integer reward;
/**
* 主办方
*/
private String sponsor;
/**
* 未通过原因
*/
private String failureReason;
}

55
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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 generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiActSummaryResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String summaryId;
/**
* 内容
*/
private String content;
/**
* 内容类型 图片img文字text
*/
private String contentType;
/**
* 内容顺序 从1开始
*/
private Integer orderNum;
}

60
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java

@ -0,0 +1,60 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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 generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiLeaderboardResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 微信昵称
*/
private String nickname;
/**
* 微信头像
*/
private String headImg;
/**
* 是否是志愿者true是志愿者false: 不是志愿者
*/
private Boolean volunteerFlag;
/**
* 爱心时长(单位小时)
*/
private Integer kindnessTime;
/**
* 参加次数
*/
private Integer participationNum;
}

32
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -0,0 +1,32 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 用户模块
*
* @author zhangyong
* @date 2020/7/22 14:51
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
public interface EpmetUserFeignClient {
/**
* @param userIds
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.UserBaseInfoResultDTO>>
* @author zhangyong
* @description 传入用户id集合返回用户的基本信息包含微信基本信息
* @Date 2020/7/22 9:30
**/
@PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo")
Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(@RequestBody List<String> userIds);
}

25
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -0,0 +1,25 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhangyong
* @date 2020/7/22 14:51
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(List<String> userIds) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds);
}
}

92
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java

@ -5,7 +5,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.resi.*;
import com.epmet.dto.result.resi.*;
import com.epmet.service.ActInfoService;
import com.epmet.service.*;
import com.epmet.commons.tools.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 居民端-活动列表相关api
* 居民端-活动相关api
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/19 23:17
@ -25,6 +25,18 @@ public class ResiActListController {
@Autowired
private ActInfoService actInfoService;
@Autowired
private ActUserRelationService actUserRelationService;
@Autowired
private ActSummaryService actSummaryService;
@Autowired
private ActLiveRecService actLiveRecService;
@Autowired
private HeartUserInfoService heartUserInfoService;
/**
* 活动列表(包含状态报名中signing_up已报满enough截止报名: end_sign_up; 已开始 in_progress; 已结束finished)
*
@ -135,6 +147,64 @@ public class ResiActListController {
return actInfoService.actLookBack(formDto);
}
//
/**
* 活动详情
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("detail")
public Result<ResiActDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) {
return actInfoService.actDetail(tokenDto, formDto);
}
/**
* 活动详情-未通过
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("rejectdetail")
public Result<ResiActRefusedDetailResultDTO> rejectDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) {
return actInfoService.rejectDetail(tokenDto, formDto);
}
/**
* 活动详情-已结束-回顾稿
*
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActSummaryResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("summary/list")
public Result<ResiActSummaryResultDTO> summaryList(@RequestBody ResiActContentFormDTO formDto) {
return actSummaryService.summaryList(formDto);
}
/**
* 活动详情-已结束-现场实况列表
*
* @param actId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActLiveRecResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
@PostMapping("livereclist")
public Result<ResiActLiveRecResultDTO> liveRecList(@RequestBody String actId) {
return actLiveRecService.liveRecList(actId);
}
//
/**
* 取消活动报名
*
@ -147,7 +217,7 @@ public class ResiActListController {
@PostMapping("cancelsignup")
public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return actInfoService.cancelSignUp(tokenDto, formDTO);
return actUserRelationService.cancelSignUp(tokenDto, formDTO);
}
/**
@ -165,4 +235,20 @@ public class ResiActListController {
return actInfoService.checkSignInAddress(formDTO);
}
/**
* 爱心榜
* 显示报名参加过活动的用户/志愿者
* 排序规则按照爱心时长一致按照参加次数排序
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLeaderboardResultDTO>>
* @Author zhangyong
* @Date 17:42 2020-07-22
**/
@PostMapping("leaderboard")
public Result<List<ResiLeaderboardResultDTO>> leaderboard(@RequestBody ResiActBaseFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return heartUserInfoService.leaderboard(formDTO);
}
}

40
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -0,0 +1,40 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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.controller;
import com.epmet.dao.VolunteerInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 居民端-志愿者相关api
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@RestController
@RequestMapping("/resi/volunteer")
public class ResiVolunteerController {
@Autowired
private VolunteerInfoDao volunteerInfoDao;
}

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.form.resi.ResiActDetailFormDTO;
import com.epmet.dto.form.resi.ResiLatestActFormDTO;
import com.epmet.dto.form.resi.ResiMyActFormDTO;
import com.epmet.dto.result.resi.*;
@ -184,4 +185,34 @@ public interface ActInfoDao extends BaseDao<ActInfoEntity> {
* @Date 2020/7/22 17:08
**/
ActSignUpStatResultDTO getActSignUpStat(String actId);
/**
* 活动详情
*
* @param formDto
* @return com.epmet.dto.result.resi.ResiActDetailResultDTO
* @Author zhangyong
* @Date 09:20 2020-07-22
**/
ResiActDetailResultDTO selectActInfoDetail(ResiActDetailFormDTO formDto);
/**
* 活动详情-未通过
*
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
ResiActRefusedDetailResultDTO selectActRejectDetail(ResiActDetailFormDTO formDto);
/**
* 从活动内容表查询活动内容
*
* @param actId
* @return java.util.List<com.epmet.dto.result.resi.ResiActContentResultDTO>
* @Author zhangyong
* @Date 09:56 2020-07-22
**/
List<ResiActContentResultDTO> selectListActContent(@Param("actId") String actId);
}

29
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java

@ -18,8 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ActLivePicDTO;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.entity.ActLiveRecEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 活动实况记录
@ -29,5 +35,24 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ActLiveRecDao extends BaseDao<ActLiveRecEntity> {
}
/**
* 根据活动id查询活动下的所有活动实况
*
* @param actId
* @return java.util.List<com.epmet.dto.ActLiveRecDTO>
* @Author zhangyong
* @Date 16:27 2020-07-22
**/
List<ActLiveRecDTO> selectListActLives(@Param("actId") String actId);
/**
* 根据实况id查询每条实况对应的多张图片
*
* @param liveIds
* @return java.util.List<com.epmet.dto.ActLivePicDTO>
* @Author zhangyong
* @Date 17:04 2020-07-22
**/
List<ActLivePicDTO> selectListActLiveImg(@Param("liveId") List liveIds);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java

@ -18,6 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActSummaryResultDTO;
import com.epmet.entity.ActSummaryEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ActSummaryDao extends BaseDao<ActSummaryEntity> {
}
/**
* 活动详情-已结束-回顾稿
*
* @param formDto
* @return com.epmet.dto.result.resi.ResiActSummaryResultDTO
* @Author zhangyong
* @Date 15:11 2020-07-22
**/
ResiActSummaryResultDTO selectListSummary(ResiActContentFormDTO formDto);
}

22
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java

@ -61,4 +61,24 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
* @Date 2020/7/22 18:20
**/
Integer selectCountUser(@Param("actId") String actId, @Param("status")String status);
}
/**
* 根据活动id查询活动已报名的人数
*
* @param actId
* @return Integer
* @Author zhangyong
* @Date 10:51 2020-07-22
**/
Integer selectActSignupNum(@Param("actId") String actId);
/**
* 将用户与活动的状态修改为 已取消
*
* @param userRelationDTO
* @return void
* @Author zhangyong
* @Date 14:39 2020-07-22
**/
void updateUserStatusToCanceld(ActUserRelationDTO userRelationDTO);
}

29
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java

@ -19,8 +19,12 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.entity.HeartUserInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户信息
@ -39,4 +43,27 @@ public interface HeartUserInfoDao extends BaseDao<HeartUserInfoEntity> {
* @Date 2020/7/21 22:48
**/
HeartUserInfoDTO selectByUserId(String userId);
}
/**
* 查询用户是否是志愿者1是志愿者0不是志愿者
*
* @param userId
* @return java.lang.Integer
* @Author zhangyong
* @Date 13:53 2020-07-22
**/
Integer selectUserVolunteerFlag(@Param("userId") String userId);
/**
* 爱心榜
* 显示报名参加过活动的用户/志愿者
* 排序规则按照爱心时长一致按照参加次数排序
*
* @param formDTO
* @return java.util.List<com.epmet.dto.HeartUserInfoDTO>
* @Author zhangyong
* @Date 18:06 2020-07-22
**/
List<HeartUserInfoDTO> selectListLeaderboard(ResiActBaseFormDTO formDTO);
}

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java

@ -192,13 +192,24 @@ public interface ActInfoService extends BaseService<ActInfoEntity> {
Result<List<ResiLookBackActResultDTO>> actLookBack(ResiActBaseFormDTO formDTO);
/**
* 取消活动报名
* 活动详情
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActDetailResultDTO>
* @Author zhangyong
* @Date 09:29 2020-07-20
* @Date 13:39 2020-07-21
**/
Result<ResiActDetailResultDTO> actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto);
/**
* 活动详情-未通过
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO);
Result<ResiActRefusedDetailResultDTO> rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLiveRecEntity;
import java.util.List;
@ -92,4 +95,14 @@ public interface ActLiveRecService extends BaseService<ActLiveRecEntity> {
* @date 2020-07-19
*/
void delete(String[] ids);
}
/**
* 活动详情-已结束-现场实况列表
*
* @param actId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActLiveRecResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result<ResiActLiveRecResultDTO> liveRecList(String actId);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActSummaryDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActSummaryResultDTO;
import com.epmet.entity.ActSummaryEntity;
import java.util.List;
@ -92,4 +95,14 @@ public interface ActSummaryService extends BaseService<ActSummaryEntity> {
* @date 2020-07-19
*/
void delete(String[] ids);
}
/**
* 活动详情-已结束-回顾稿
*
* @param formDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActSummaryResultDTO>
* @Author zhangyong
* @Date 13:39 2020-07-21
**/
Result<ResiActSummaryResultDTO> summaryList(ResiActContentFormDTO formDto);
}

17
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.entity.ActUserRelationEntity;
import org.apache.ibatis.annotations.Param;
@ -123,4 +126,16 @@ public interface ActUserRelationService extends BaseService<ActUserRelationEntit
* @Date 2020/7/22 18:17
**/
Integer selectCountUser(@Param("actId") String actId, @Param("status") String status);
}
/**
* 取消活动报名
*
* @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);
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java

@ -19,7 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.result.resi.ResiLeaderboardResultDTO;
import com.epmet.entity.HeartUserInfoEntity;
import java.util.List;
@ -101,4 +104,17 @@ public interface HeartUserInfoService extends BaseService<HeartUserInfoEntity> {
* @Date 2020/7/21 22:48
**/
HeartUserInfoDTO getByUserId(String userId);
}
/**
* 爱心榜
* 显示报名参加过活动的用户/志愿者
* 排序规则按照爱心时长一致按照参加次数排序
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLeaderboardResultDTO>>
* @Author zhangyong
* @Date 17:42 2020-07-22
**/
Result<List<ResiLeaderboardResultDTO>> leaderboard(ResiActBaseFormDTO formDTO);
}

198
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

@ -29,23 +29,26 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActInfoDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.form.resi.*;
import com.epmet.dto.result.resi.*;
import com.epmet.entity.ActInfoEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.redis.ActInfoRedis;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ActUserRelationStatusConstant;
import com.epmet.utils.ActUserStatusConstant;
import com.epmet.utils.CaculateDistance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 活动信息
@ -62,6 +65,12 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
@Autowired
private ActUserRelationService relationService;
@Autowired
private ActUserRelationDao actUserRelationDao;
@Autowired
private HeartUserInfoDao heartUserInfoDao;
@Override
public PageData<ActInfoDTO> page(Map<String, Object> params) {
IPage<ActInfoEntity> page = baseDao.selectPage(
@ -189,17 +198,165 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
}
@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;
public Result<ResiActDetailResultDTO> actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
// 从活动表查询活动信息
ResiActDetailResultDTO detailResultDTO = baseDao.selectActInfoDetail(formDto);
// 获取活动内容
detailResultDTO.setActContent(baseDao.selectListActContent(formDto.getActId()));
// 查询用户是否是志愿者
Integer volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId());
detailResultDTO.setUserVolunteerFlag(volunteerFlag == 1);
// 获取用户报名状态
String currentUserStatus = getCurrentUserStatus(formDto.getActId(), formDto.getUserId());
detailResultDTO.setCurrentUserStatus(currentUserStatus);
return new Result<ResiActDetailResultDTO>().ok(detailResultDTO);
}
/**
* 返回当前活动下用户状态
* sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消
*
* @param actId 活动id
* @param userId 用户id
* @return java.lang.String
* @Author zhangyong
* @Date 2020/7/22 10:54
**/
private String getCurrentUserStatus(String actId, String userId) {
Date currentTime = new Date();
ActInfoEntity actInfoEntity =baseDao.selectById(actId);
// 活动已取消
if (ActUserStatusConstant.CANCELED.equals(actInfoEntity.getActStatus())) {
return ActUserStatusConstant.CANCELED;
}
// 活动已经结束
if (ActUserStatusConstant.FINISHED.equals(actInfoEntity.getActStatus())) {
return ActUserStatusConstant.FINISHED;
}
// 查询用户是否报名该活动
QueryWrapper<ActUserRelationEntity> actUserRelationWrapper = new QueryWrapper<>();
actUserRelationWrapper.eq("ACT_ID", actId)
.eq("USER_ID", userId)
.orderByDesc("CREATED_TIME").last("limit 1");
ActUserRelationEntity actUserRelationEntity = actUserRelationDao.selectOne(actUserRelationWrapper);
// 查询活动已报名的人数
Integer signUpNum = actUserRelationDao.selectActSignupNum(actId);
if (null == actUserRelationEntity) {
return getCurrentUserStatusNotSignUp(actInfoEntity, signUpNum, currentTime);
} else {
return getCurrentUserStatusHasSignUp(actInfoEntity, actUserRelationEntity, signUpNum, currentTime);
}
}
/**
* 用户未报名活动时判断用户活动状态
*
* @param actInfoEntity 当前活动
* @param signUpNum 活动报名人数
* @param currentTime 当前时间
* @return java.lang.String
* @author zhangyong
* @date 2020/7/22 10:54
*/
private String getCurrentUserStatusNotSignUp(ActInfoEntity actInfoEntity, Integer signUpNum, Date currentTime) {
if (currentTime.before(actInfoEntity.getSignUpEndTime())) {
/*报名结束前*/
if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) || actInfoEntity.getActQuota() > signUpNum) {
// 我要报名(不限名额或者未报满的)
return ActUserStatusConstant.SIGN_UP;
} else {
// 已报满(限制名额且已经报满的)
return ActUserStatusConstant.ENOUGH;
}
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/*报名结束,活动未开始:显示:截止报名*/
return ActUserStatusConstant.END_SIGN_UP;
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
// 活动打卡时间段内: 显示:已开始
return ActUserStatusConstant.IN_PROGRESS;
} else {
return ActUserStatusConstant.FINISHED;
}
}
/**
* 用户已报名活动时判断用户活动状态
*
* @param actInfoEntity 当前活动
* @param actUserRelationEntity 用户活动关系
* @param signUpNum 活动报名人数
* @param currentTime 当前时间
* @return java.lang.String
* @author zhangyong
* @date 2020/7/22 17:11
*/
private String getCurrentUserStatusHasSignUp(ActInfoEntity actInfoEntity, ActUserRelationEntity actUserRelationEntity, Integer signUpNum, Date currentTime) {
String actUserStatus = actUserRelationEntity.getStatus();
// 已确认过积分,直接返回
if (ActUserRelationStatusConstant.AGREE.equals(actUserRelationEntity.getRewardFlag())
|| ActUserRelationStatusConstant.DENY.equals(actUserRelationEntity.getRewardFlag())) {
return ActUserStatusConstant.POINTS_CONFIRM;
}
if (currentTime.after(actInfoEntity.getActEndTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/*活动结束;打卡未截止*/
// (未审核的、审核未通过、取消报名的)- 已结束
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)
|| ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)
|| ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.FINISHED;
}
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/* 活动打卡时间段内 */
// (未审核的、审核未通过、取消报名的)- 已开始
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)
|| ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)
|| ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.IN_PROGRESS;
}
} else if (currentTime.before(actInfoEntity.getSignUpEndTime())) {
/* 报名截至时间前 */
//(未审核、审核通过的)底部显示按钮 取消报名
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus) || ActUserRelationStatusConstant.PASSED.equals(actUserStatus)) {
return ActUserStatusConstant.CANCELD;
}
// 活动限制名额,且报名人数已满 已报满
if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) && signUpNum >= actInfoEntity.getActQuota()) {
return ActUserStatusConstant.ENOUGH;
}
// (报名审核未通过或者已经取消报名的)可再次报名-我要报名
if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.SIGN_UP;
}
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/* 报名截止但 活动未开始 */
// 已经取消报名的-报名截止
if (ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.END_SIGN_UP;
}
// 已报名审核不通过 -报名截止
if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)) {
return ActUserStatusConstant.END_SIGN_UP;
}
// 已报名且审核通过、未审核 -取消报名
if (ActUserRelationStatusConstant.PASSED.equals(actUserStatus) || ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)) {
return ActUserStatusConstant.CANCELD;
}
}
return ActUserStatusConstant.FINISHED;
}
@Override
public Result<ResiActRefusedDetailResultDTO> rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) {
formDto.setUserId(tokenDto.getUserId());
ResiActRefusedDetailResultDTO detail = baseDao.selectActRejectDetail(formDto);
return new Result<ResiActRefusedDetailResultDTO>().ok(detail);
}
@Override
@ -207,11 +364,10 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
// 根据活动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();
if (distance <= entity.getSignInRadius()){
return new Result();
} else {
throw new RenException(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getCode());
}
}
}

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java

@ -23,9 +23,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActLiveRecDao;
import com.epmet.dto.ActLivePicDTO;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLiveRecEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.ActLiveRecRedis;
import com.epmet.service.ActLiveRecService;
import org.apache.commons.lang3.StringUtils;
@ -33,9 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 活动实况记录
@ -49,6 +53,9 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
@Autowired
private ActLiveRecRedis actLiveRecRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<ActLiveRecDTO> page(Map<String, Object> params) {
IPage<ActLiveRecEntity> page = baseDao.selectPage(
@ -101,4 +108,40 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
@Override
public Result<ResiActLiveRecResultDTO> liveRecList(String actId) {
// 查询实况记录
List<ActLiveRecDTO> actLives = baseDao.selectListActLives(actId);
List<String> userIds = new ArrayList<>();
List<String> liveIds = new ArrayList<>();
for (ActLiveRecDTO actLive : actLives){
userIds.add(actLive.getUserId());
liveIds.add(actLive.getId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds);
// 根据活动实况id,查询对应实况的图片集合
List<ActLivePicDTO> actLiveImg = baseDao.selectListActLiveImg(liveIds);
// 数据汇总
ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO();
List<Object> dataContainer = new ArrayList<>();
for (int k = 0; k < actLives.size(); k++) {
Map<String, Object> map = new HashMap<>();
map.put("nickname", userWxInfos.getData().get(k).getNickname());
map.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl());
map.put("desc", actLives.get(k).getDesc());
map.put("createdTime", actLives.get(k).getCreatedTime());
// 查询打卡对应图片
List<String> imgUrlList = new ArrayList<>();
for (ActLivePicDTO urlDto : actLiveImg) {
if (actLives.get(k).getId().equals(urlDto.getLiveId())) {
imgUrlList.add(urlDto.getPicUrl());
}
}
map.put("images", imgUrlList);
dataContainer.add(map);
}
return new Result<ResiActLiveRecResultDTO>().ok(resultDto);
}
}

13
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java

@ -20,11 +20,15 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActSummaryDao;
import com.epmet.dto.ActSummaryDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.result.resi.ResiActSummaryResultDTO;
import com.epmet.entity.ActSummaryEntity;
import com.epmet.redis.ActSummaryRedis;
import com.epmet.service.ActSummaryService;
@ -101,4 +105,11 @@ public class ActSummaryServiceImpl extends BaseServiceImpl<ActSummaryDao, ActSum
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
@Override
public Result<ResiActSummaryResultDTO> summaryList(ResiActContentFormDTO formDto) {
int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize();
formDto.setPageNo(pageIndex);
return new Result<ResiActSummaryResultDTO>().ok(baseDao.selectListSummary(formDto));
}
}

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java

@ -21,13 +21,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActUserLogDTO;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.redis.ActUserRelationRedis;
import com.epmet.service.ActUserLogService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ActUserRelationStatusConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -48,6 +54,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Autowired
private ActUserRelationRedis actUserRelationRedis;
@Autowired
private ActUserLogService actUserLogService;
@Override
public PageData<ActUserRelationDTO> page(Map<String, Object> params) {
@ -140,5 +148,24 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
return baseDao.selectCountUser(actId, status);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO) {
//1、更新用户活动关系表 的用户状态
ActUserRelationDTO userRelationDTO = new ActUserRelationDTO();
userRelationDTO.setId(formDTO.getActId());
userRelationDTO.setUserId(tokenDto.getUserId());
userRelationDTO.setCancelReason(formDTO.getFailureReason());
userRelationDTO.setStatus(ActUserRelationStatusConstant.CANCELD);
baseDao.updateUserStatusToCanceld(userRelationDTO);
//2、插入用户活动关系日志表
ActUserLogDTO userLogDTO = new ActUserLogDTO();
userLogDTO.setActId(formDTO.getActId());
userLogDTO.setUserId(tokenDto.getUserId());
userLogDTO.setOperationType(ActUserRelationStatusConstant.CANCELD);
userLogDTO.setReason(formDTO.getFailureReason());
actUserLogService.save(userLogDTO);
return new Result();
}
}

39
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java

@ -23,9 +23,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiLeaderboardResultDTO;
import com.epmet.entity.HeartUserInfoEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.HeartUserInfoRedis;
import com.epmet.service.HeartUserInfoService;
import org.apache.commons.lang3.StringUtils;
@ -33,6 +39,7 @@ 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;
@ -48,6 +55,8 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl<HeartUserInfoDao,
@Autowired
private HeartUserInfoRedis heartUserInfoRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<HeartUserInfoDTO> page(Map<String, Object> params) {
@ -113,4 +122,32 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl<HeartUserInfoDao,
return baseDao.selectByUserId(userId);
}
}
@Override
public Result<List<ResiLeaderboardResultDTO>> leaderboard(ResiActBaseFormDTO formDTO) {
// 获取排好序的 排行榜
List<HeartUserInfoDTO> leaderboardList = baseDao.selectListLeaderboard(formDTO);
// 根据用户ID获取微信昵称、头像
List<String> userIds = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
userIds.add(list.getUserId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds);
List<ResiLeaderboardResultDTO> resultDTOS = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO();
dto.setKindnessTime(list.getKindnessTime());
dto.setVolunteerFlag(list.getVolunteerFlag());
dto.setParticipationNum(list.getParticipationNum());
List<UserBaseInfoResultDTO> wxInfo = userWxInfos.getData();
for (UserBaseInfoResultDTO wx : wxInfo){
if (list.getUserId().equals(wx.getUserId())){
dto.setHeadImg(wx.getHeadImgUrl());
dto.setNickname(wx.getNickname());
}
}
}
return new Result<List<ResiLeaderboardResultDTO>>().ok(resultDTOS);
}
}

38
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java

@ -0,0 +1,38 @@
package com.epmet.utils;
/**
* @Description 用户活动关系表当前状态
* @Auther: zhangyong
* @Date: 2020-07-21 17:36
*/
public interface ActUserRelationStatusConstant {
/**
* 已报名/待审核
*/
String AUDITING="auditing";
/**
* 审核通过
*/
String PASSED="passed";
/**
* 审核不通过
*/
String REFUSED = "refused";
/**
* 取消报名
*/
String CANCELD = "canceld";
/**
* 给积分
*/
String AGREE = "agree";
/**
* 不给积分
*/
String DENY = "deny";
}

49
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java

@ -0,0 +1,49 @@
package com.epmet.utils;
/**
* 用户当前状态sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消points_confirm-已确认积分
* @Auther: zhangyong
* @Date: 2020-07-21 17:36
*/
public interface ActUserStatusConstant {
/**
* 我要报名
*/
String SIGN_UP = "sign_up";
/**
* 取消报名
*/
String CANCELD = "canceld";
/**
* 已报满
*/
String ENOUGH = "enough";
/**
* 截止报名
*/
String END_SIGN_UP = "end_sign_up";
/**
* 已开始
*/
String IN_PROGRESS = "in_progress";
/**
* 已结束
*/
String FINISHED = "finished";
/**
* 已取消
*/
String CANCELED = "canceled";
/**
* 已确认积分
*/
String POINTS_CONFIRM = "points_confirm";
}

90
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java

@ -0,0 +1,90 @@
package com.epmet.utils;
import com.alibaba.nacos.client.utils.StringUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import org.springframework.beans.factory.annotation.Value;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.UUID;
/**
* 文字图片合法性校验
*
* @author zhangyong
* @date 2020-07-15 14:26
*/
@Slf4j
public class ValidityVerification {
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
/**
* 文本校验
* @param context 被校验的文本不能超过10000
* @param businessEnum 业务枚举定义校验失败后输出的日志信息
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void textScanVerification(String context, String businessEnum){
if (StringUtils.isNotBlank(context)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(context);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
// 业务枚举:例如:评论话题失败,评论内容为:%s"
log.error(String.format(businessEnum, context));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
}
}
/**
* 图片列表校验
* @param imgList 被校验的图片列表
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void imgScanVerification(List<String> imgList){
if (NumConstant.ZERO != imgList.size()){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
}
}
}

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

@ -375,4 +375,73 @@
ai.DEL_FLAG = '0'
AND ai.id =#{actId}
</select>
<!-- 活动详情 -->
<select id="selectActInfoDetail" parameterType="com.epmet.dto.form.resi.ResiActDetailFormDTO"
resultType="com.epmet.dto.result.resi.ResiActDetailResultDTO">
SELECT
i.ID actId,
i.TITLE title,
i.SPONSOR_CONTACTS contacts,
i.SPONSOR_TEL tel,
DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i') signUpEndTime,
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, -- 已报名人数
i.REWARD reward,
i.REQUIREMENT requirement,
IF(i.VOLUNTEER_LIMIT = 1, true , false ) as volunteerLimit, -- 是否是志愿者(true:只有志愿者才可以参加活动1,false: 只要是居民就可以参加活动0)
i.SPONSOR_NAME sponsor,
DATE_FORMAT(i.ACTUAL_START_TIME,'%Y-%m-%d %H:%i') actualStartTime,
DATE_FORMAT(i.ACTUAL_END_TIME,'%Y-%m-%d %H:%i') actualEndTime,
IF(aur.SIGN_IN_FLAG = 'signed_in', true , false ) as isSignUp-- 是否已签到(true已签到,false未签到)
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
LEFT JOIN act_user_relation aur ON aur.ACT_ID = i.ID AND aur.DEL_FLAG = '0' AND aur.USER_ID = #{userId}
WHERE
i.DEL_FLAG = '0'
AND i.id = #{actId}
</select>
<!--活动详情-未通过-->
<select id="selectActRejectDetail" parameterType="com.epmet.dto.form.resi.ResiActDetailFormDTO"
resultType="com.epmet.dto.result.resi.ResiActRefusedDetailResultDTO">
SELECT
i.ID actId,
i.TITLE title,
DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i') signUpEndTime,
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,
i.SPONSOR_CONTACTS contacts,
i.SPONSOR_TEL tel,
i.REWARD reward,
i.SPONSOR_NAME sponsor,
u.FAILURE_REASON failureReason
FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0'
WHERE i.DEL_FLAG = '0'
AND i.ID = #{actId}
AND u.USER_ID = #{userId}
</select>
<!-- 活动内容 -->
<select id="selectListActContent" parameterType="java.lang.String"
resultType="com.epmet.dto.result.resi.ResiActContentResultDTO">
SELECT
c.CONTENT content,
c.CONTENT_TYPE contentType,
c.ORDER_NUM orderNum,
c.ID actContentId
FROM act_content c
WHERE c.DEL_FLAG = '0'
AND c.ACT_ID = #{actId}
ORDER BY c.ORDER_NUM ASC
</select>
</mapper>

30
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml

@ -19,5 +19,33 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--查询活动下的所有活动实况-->
<select id="selectListActLives" parameterType="java.lang.String"
resultType="com.epmet.dto.ActLiveRecDTO">
SELECT
ID id,
ACT_ID actId,
USER_ID userId,
ADDRESS address,
`DESC` `desc`,
CREATED_TIME createdTime
FROM act_live_rec r
WHERE r.DEL_FLAG = '0'
AND r.ACT_ID = #{actId}
</select>
</mapper>
<!--根据实况id,查询每条实况对应的多张图片-->
<select id="selectListActLiveImg" resultType="com.epmet.dto.ActLivePicDTO">
select
LIVE_ID liveId,
PIC_URL picUrl,
SORT sort
from act_live_pic
where DEL_FLAG = '0'
and LIVE_ID IN
<foreach collection="liveId" item="liveId" index="index" open="(" close=")" separator=",">
#{liveId}
</foreach>
order by SORT asc
</select>
</mapper>

17
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml

@ -17,5 +17,18 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
<!-- 活动详情-已结束-回顾稿 -->
<select id="selectListSummary" parameterType="com.epmet.dto.form.resi.ResiActContentFormDTO"
resultType="com.epmet.dto.result.resi.ResiActSummaryResultDTO">
SELECT
s.CONTENT content,
s.CONTENT_TYPE contentType,
s.ORDER_NUM orderNum,
s.ID summaryId
FROM act_summary s
WHERE s.DEL_FLAG = '0'
AND s.ACT_ID = #{actId}
ORDER BY s.ORDER_NUM ASC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

24
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

@ -61,4 +61,26 @@
AND aur.`STATUS` =#{status}
AND aur.ACT_ID = #{actId}
</select>
</mapper>
<!-- 根据活动id,查询活动已报名的人数 -->
<select id="selectActSignupNum" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
count(1) signupNum
FROM act_user_relation re
WHERE re.DEL_FLAG = '0'
AND re.ACT_ID = #{actId}
GROUP BY re.ACT_ID
</select>
<update id="updateUserStatusToCanceld" parameterType="com.epmet.dto.ActUserRelationDTO">
UPDATE act_user_relation
SET
STATUS = #{status},
CANCEL_TIME = NOW(),
CANCEL_REASON = #{cancelReason}
WHERE
DEL_FLAG = '0'
AND ACT_ID = #{actId}
AND USER_ID = #{userId}
</update>
</mapper>

28
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml

@ -29,4 +29,30 @@
hui.DEL_FLAG = '0'
AND hui.USER_ID =#{userId}
</select>
</mapper>
<!-- 查询用户志愿者标识 -->
<select id="selectUserVolunteerFlag" parameterType="java.lang.String"
resultType="java.lang.Integer">
SELECT
VOLUNTEER_FLAG
FROM heart_user_info u
WHERE u.DEL_FLAG = '0'
AND u.USER_ID = #{userId}
</select>
<!-- 爱心榜 -->
<select id="selectListLeaderboard" parameterType="com.epmet.dto.form.resi.ResiActBaseFormDTO"
resultType="com.epmet.dto.HeartUserInfoDTO">
SELECT
ui.USER_ID userId,
volunteerFlag,
IF(ui.VOLUNTEER_FLAG = 1, true , false )
ui.KINDNESS_TIME kindnessTime,
ui.PARTICIPATION_NUM participationNum
FROM heart_user_info ui
WHERE ui.DEL_FLAG = '0'
AND ui.CUSTOMER_ID = #{customerId}
ORDER BY ui.KINDNESS_TIME DESC, ui.PARTICIPATION_NUM DESC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

Loading…
Cancel
Save