|
|
@ -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); |
|
|
|
} |
|
|
|