Browse Source

爱心互助-居民端

dev_shibei_match
zhangyongzhangyong 5 years ago
parent
commit
7a75dd5afe
  1. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java
  3. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java
  4. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  5. 57
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml

7
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
@ -196,14 +197,14 @@ public class ResiActListController {
/**
* 活动详情-已结束-现场实况列表
*
* @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);
}
//

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);
/**
* 活动-添加实况

6
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());

57
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,47 @@ 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) {
// 数据汇总
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);
}

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