Browse Source

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

dev
yinzuomei 5 years ago
parent
commit
a0276e69dc
  1. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java
  3. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java
  4. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java
  5. 28
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  7. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  8. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java
  9. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java
  10. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  11. 61
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  12. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  13. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml
  14. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java

@ -28,18 +28,18 @@ public class ResiActCaculateDistanceFormDTO implements Serializable {
/**
* 经度
*/
@NotBlank(message = "经度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
@NotBlank(message = "经度不能为空", groups = { AddUserInternalGroup.class })
private Double longitude;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
@NotBlank(message = "纬度不能为空", groups = { AddUserInternalGroup.class })
private Double latitude;
/**
* 用户id
*/
@NotBlank(message = "活动ID不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
@NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class })
private String actId;
}

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

@ -29,13 +29,13 @@ public class ResiActContentFormDTO implements Serializable {
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
@NotBlank(message = "活动Id不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 页码从1开始
*/
@Min(value = 1, message = "页码必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
@Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class })
private Integer pageNo;
/**

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

@ -28,7 +28,7 @@ public class ResiActDetailFormDTO implements Serializable {
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
@NotBlank(message = "活动Id不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**

1
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java

@ -20,7 +20,6 @@ package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**

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

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 居民端-活动相关api
@ -51,6 +52,7 @@ public class ResiActListController {
**/
@PostMapping("list")
public Result<List<ResiActInfoResultDTO>> listAct(@LoginUser TokenDto tokenDto, @RequestBody ResiActBaseFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiActBaseFormDTO.AddUserInternalGroup.class);
return actInfoService.listAct(tokenDto, formDto);
}
@ -66,6 +68,7 @@ public class ResiActListController {
**/
@PostMapping("list/auditing")
public Result<List<ResiMyActResultDTO>> listAuditing(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class);
return actInfoService.myActListAuditing(tokenDto, formDto);
}
@ -80,6 +83,7 @@ public class ResiActListController {
**/
@PostMapping("list/refused")
public Result<List<ResiMyActResultDTO>> listRefused(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class);
return actInfoService.myActListRefused(tokenDto, formDto);
}
@ -94,6 +98,7 @@ public class ResiActListController {
**/
@PostMapping("list/passed")
public Result<List<ResiMyActResultDTO>> listPassed(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class);
return actInfoService.myActListPassed(tokenDto, formDto);
}
@ -108,6 +113,7 @@ public class ResiActListController {
**/
@PostMapping("list/canceld")
public Result<List<ResiMyActResultDTO>> listcanceld(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class);
return actInfoService.myActListCanceld(tokenDto, formDto);
}
@ -121,6 +127,7 @@ public class ResiActListController {
**/
@PostMapping("list/latestact")
public Result<List<ResiLatestActResultDTO>> latestAct(@RequestBody ResiLatestActFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiLatestActFormDTO.AddUserInternalGroup.class);
return actInfoService.latestAct(formDto);
}
@ -147,6 +154,7 @@ public class ResiActListController {
**/
@PostMapping("actlookback")
public Result<List<ResiLookBackActResultDTO>> actLookBack(@RequestBody ResiActBaseFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiActBaseFormDTO.AddUserInternalGroup.class);
return actInfoService.actLookBack(formDto);
}
@ -163,6 +171,7 @@ public class ResiActListController {
**/
@PostMapping("detail")
public Result<ResiActDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiActDetailFormDTO.AddUserInternalGroup.class);
return actInfoService.actDetail(tokenDto, formDto);
}
@ -177,6 +186,7 @@ public class ResiActListController {
**/
@PostMapping("rejectdetail")
public Result<ResiActRefusedDetailResultDTO> rejectDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiActDetailFormDTO.AddUserInternalGroup.class);
return actInfoService.rejectDetail(tokenDto, formDto);
}
@ -190,20 +200,21 @@ public class ResiActListController {
**/
@PostMapping("summary/list")
public Result<ResiActSummaryResultDTO> summaryList(@RequestBody ResiActContentFormDTO formDto) {
ValidatorUtils.validateEntity(formDto, ResiActContentFormDTO.AddUserInternalGroup.class);
return actSummaryService.summaryList(formDto);
}
/**
* 活动详情-已结束-现场实况列表
*
* @param actId
* @param map{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);
public Result<ResiActLiveRecResultDTO> liveRecList(@RequestBody Map<String, String> map) {
return actLiveRecService.liveRecList(map);
}
//
@ -219,7 +230,7 @@ public class ResiActListController {
**/
@PostMapping("cancelsignup")
public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, ResiActUserCancelSignUpFormDTO.AddUserInternalGroup.class, ResiActUserCancelSignUpFormDTO.AddUserShowGroup.class);
return actUserRelationService.cancelSignUp(tokenDto, formDTO);
}
@ -234,7 +245,7 @@ public class ResiActListController {
**/
@PostMapping("checksigninaddress")
public Result cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, ResiActCaculateDistanceFormDTO.AddUserInternalGroup.class);
return actInfoService.checkSignInAddress(formDTO);
}
@ -250,7 +261,7 @@ public class ResiActListController {
**/
@PostMapping("leaderboard")
public Result<List<ResiLeaderboardResultDTO>> leaderboard(@RequestBody ResiActBaseFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, ResiActBaseFormDTO.AddUserInternalGroup.class);
return heartUserInfoService.leaderboard(formDTO);
}
@ -264,7 +275,7 @@ public class ResiActListController {
**/
@PostMapping("insertlive")
public Result insertLive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, ResiActInsertLiveFormDTO.AddUserInternalGroup.class, ResiActInsertLiveFormDTO.AddUserShowGroup.class);
Result<String> result = actLiveRecService.insertLive(tokenDto, formDTO);
return new Result();
}
@ -279,7 +290,7 @@ public class ResiActListController {
**/
@PostMapping("signin")
public Result actSignIn(@LoginUser TokenDto tokenDto, @RequestBody ResiActSignInFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, ResiActSignInFormDTO.AddUserInternalGroup.class, ResiActSignInFormDTO.AddUserShowGroup.class);
return actSignInRecService.actSignIn(tokenDto, formDTO);
}
@ -294,6 +305,7 @@ public class ResiActListController {
**/
@PostMapping("registration")
public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class);
return actUserRelationService.registration(tokenDto, formDTO);
}

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

@ -46,7 +46,7 @@ public class ResiVolunteerController {
@PostMapping("authenticate")
public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class);
return volunteerInfoService.authenticate(tokenDto, formDTO);
}
}

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

@ -178,14 +178,14 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
/**
* 取消报名
* 根据用户id和活动id修改 用户活动关系表
* 根据用户id和活动id删除 用户活动关系表中用户的报名记录
*
* @param entity
* @return void
* @Author zhangyong
* @Date 14:39 2020-07-22
**/
void cancelSignUp(ActUserRelationEntity entity);
void delSignUpRecord(ActUserRelationEntity entity);
/**
* 当前用户是否曾报名参加过该活动

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

@ -49,11 +49,11 @@ public interface HeartUserInfoDao extends BaseDao<HeartUserInfoEntity> {
* 查询用户是否是志愿者1是志愿者0不是志愿者
*
* @param userId
* @return java.lang.Integer
* @return java.lang.Boolean
* @Author zhangyong
* @Date 13:53 2020-07-22
**/
Integer selectUserVolunteerFlag(@Param("userId") String userId);
Boolean selectUserVolunteerFlag(@Param("userId") String userId);
/**
* 爱心榜

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

@ -24,6 +24,8 @@ import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLiveRecEntity;
import java.util.Map;
/**
* 活动实况记录
*
@ -35,12 +37,12 @@ public interface ActLiveRecService extends BaseService<ActLiveRecEntity> {
/**
* 活动详情-已结束-现场实况列表
*
* @param actId
* @param map
* @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);
Result<ResiActLiveRecResultDTO> liveRecList(Map<String, String> map);
/**
* 活动-添加实况

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

@ -199,6 +199,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
@Override
public Result<List<ResiLookBackActResultDTO>> actLookBack(ResiActBaseFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(pageIndex);
List<ResiLookBackActResultDTO> lookBackAct = baseDao.selectListLookBackAct(formDTO);
return new Result<List<ResiLookBackActResultDTO>>().ok(lookBackAct);
}
@ -211,8 +213,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
// 获取活动内容
detailResultDTO.setActContent(baseDao.selectListActContent(formDto.getActId()));
// 查询用户是否是志愿者
Integer volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId());
detailResultDTO.setUserVolunteerFlag(volunteerFlag == 1);
Boolean volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId());
detailResultDTO.setUserVolunteerFlag(volunteerFlag);
// 获取用户报名状态
String currentUserStatus = getCurrentUserStatus(formDto.getActId(), formDto.getUserId());
@ -281,10 +283,11 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/*报名结束,活动未开始:显示:截止报名*/
return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP;
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
// 活动打卡时间段内: 显示:已开始
} else if (currentTime.after(actInfoEntity.getActStartTime()) && currentTime.before(actInfoEntity.getActEndTime())) {
// 活动开始-结束的时间段内: 显示:已开始
return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS;
} else {
// 最后,显示:已结束
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
}
@ -309,23 +312,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
return ActConstant.CURRENT_STATUS_USER_POINTS_CONFIRM;
}
if (currentTime.after(actInfoEntity.getActEndTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/*活动结束;打卡未截止*/
// (未审核的、审核未通过、取消报名的)- 已结束
if (ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/* 活动打卡时间段内 */
// (未审核的、审核未通过、取消报名的)- 已开始
if (ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS;
}
if (currentTime.after(actInfoEntity.getActStartTime()) && currentTime.before(actInfoEntity.getActEndTime())) {
/* 活动开始-结束的时间段内 */
return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS;
} else if (currentTime.before(actInfoEntity.getSignUpEndTime())) {
/* 报名截至时间前 */
//(未审核、审核通过的)底部显示按钮 取消报名

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

@ -24,6 +24,8 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
@ -48,6 +50,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 活动实况记录
@ -69,37 +72,51 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
private ActLivePicDao actLivePicDao;
@Override
public Result<ResiActLiveRecResultDTO> liveRecList(String actId) {
public Result<ResiActLiveRecResultDTO> liveRecList(Map<String, String> map) {
if (map.get("actId") == null){
logger.error("传参中没有活动ID");
throw new RenException("传参中没有活动ID");
}
// 数据汇总
ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO();
// 查询实况记录
List<ActLiveRecDTO> actLives = baseDao.selectListActLives(actId);
List<ActLiveRecDTO> actLives = baseDao.selectListActLives(map.get("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 = epmetUserOpenFeignClient.queryUserBaseInfo(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());
if (actLives.size() > NumConstant.ZERO){
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
if (userWxInfos.getData().size() > NumConstant.ZERO){
// 根据活动实况id,查询对应实况的图片集合
List<ActLivePicDTO> actLiveImg = baseDao.selectListActLiveImg(liveIds);
List<Object> dataContainer = new ArrayList<>();
for (int k = 0; k < actLives.size(); k++) {
Map<String, Object> base = new HashMap<>();
base.put("nickname", userWxInfos.getData().get(k).getNickname());
base.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl());
base.put("desc", actLives.get(k).getDesc());
base.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());
}
}
base.put("images", imgUrlList);
dataContainer.add(base);
}
resultDto.setActLives(dataContainer);
resultDto.setActLiveNum(dataContainer.size());
} else {
logger.error("未查到用户基础信息");
throw new RenException("未查到用户基础信息");
}
map.put("images", imgUrlList);
dataContainer.add(map);
}
return new Result<ResiActLiveRecResultDTO>().ok(resultDto);
}

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

@ -55,6 +55,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -262,18 +263,19 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
entity.setActId(formDTO.getActId());
entity.setUserId(formDTO.getUserId());
entity.setStatus(ActConstant.ACT_USER_STATUS_AUDITING);
Integer operationCount = baseDao.selectCountByActIdAndUserId(entity.getActId(), entity.getUserId());
if (operationCount == NumConstant.ZERO){
// 用户第一次参加 这次的活动
// 5.插入用户活动关系表
baseDao.insert(entity);
// 审核开关:1报名人员需要人工审核(true) 0不需要(false)
if (actInfoDTO.getAuditSwitch()){
entity.setPassedType(ActConstant.PASSEDTYPE_MANUAL);
} else {
// 取消报名后,重新报名参加活动。修改状态
// 5.修改用户活动关系表
entity.setCancelReason("");
entity.setCancelTime(null);
baseDao.cancelSignUp(entity);
entity.setPassedType(ActConstant.PASSEDTYPE_AUTO);
entity.setAuditTime(new Date());
}
Integer operationCount = baseDao.selectCountByActIdAndUserId(formDTO.getActId(), formDTO.getUserId());
if (operationCount > NumConstant.ZERO){
// 用户如果不是第一次参加 这次的活动,先删除关系表中的数据,在插入
baseDao.delSignUpRecord(entity);
}
baseDao.insert(entity);
}
/**

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

@ -253,16 +253,10 @@
AND aur.ACT_ID = #{actId}
</select>
<update id="cancelSignUp" parameterType="com.epmet.entity.ActUserRelationEntity">
<update id="delSignUpRecord" parameterType="com.epmet.entity.ActUserRelationEntity">
UPDATE act_user_relation
SET
<if test="status != null and status.trim() != ''">
STATUS = #{status},
</if>
<if test="cancelReason != null">
CANCEL_TIME = #{cancelTime},
CANCEL_REASON = #{cancelReason},
</if>
DEL_FLAG = '1',
<if test="userId != null and userId != ''">
UPDATED_BY = #{userId},
</if>

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

@ -32,7 +32,7 @@
<!-- 查询用户志愿者标识 -->
<select id="selectUserVolunteerFlag" parameterType="java.lang.String"
resultType="java.lang.Integer">
resultType="java.lang.Boolean">
SELECT
VOLUNTEER_FLAG
FROM heart_user_info u

Loading…
Cancel
Save