Commit bbae63d8 by levphon

返回分享用户信息

1 parent b941491f
package cn.com.glsx.app.modules.model.view;
import cn.com.glsx.app.modules.model.CTerminalUserModel;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
......@@ -18,7 +19,7 @@ public class VehicleSharedDTO {
private String sources;
private Integer sharedStatus;
private String permitType;
private List<String> sharedUserIds;
private List<CTerminalUserModel> sharedUsers;
@JsonIgnore
private String receiverIds;
......
......@@ -16,6 +16,8 @@ import com.github.pagehelper.PageInfo;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.core.enums.SysConstants;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -45,10 +47,19 @@ public class VehicleService {
Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize());
List<VehicleSharedDTO> list = vehicleMapper.manageSearch(search);
Map<Long, CTerminalUserModel> finalWechatUserMap = getWechatUserInfos(list);
list.forEach(vdd -> {
//设置被分享人
if (StringUtils.isNotEmpty(vdd.getReceiverIds())) {
vdd.setSharedUserIds(Arrays.asList(vdd.getReceiverIds().split(",")));
List<CTerminalUserModel> sharedUsers = Lists.newArrayList();
Arrays.asList(vdd.getReceiverIds().split(",")).forEach(receiverId -> {
CTerminalUserModel cUserModel = finalWechatUserMap.get(Long.parseLong(receiverId));
if (cUserModel != null) {
sharedUsers.add(cUserModel);
}
});
vdd.setSharedUsers(sharedUsers);
}
//被分享用户设为只读权限
if (UserConstants.RolePermitCastType.wxShared.getCode().equals(ShieldContextHolder.getRolePermissionType())) {
......@@ -62,6 +73,25 @@ public class VehicleService {
return new PageInfo<>(list);
}
public Map<Long, CTerminalUserModel> getWechatUserInfos(List<VehicleSharedDTO> list) {
List<String> receiverIdsList = list.stream().map(VehicleSharedDTO::getReceiverIds).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
String receiverIdsStr = StringUtils.join(receiverIdsList, ',');
if (StringUtils.isNullOrEmpty(receiverIdsStr)) {
return Maps.newHashMap();
}
List<Long> receiverIds = Lists.newArrayList();
Arrays.asList(receiverIdsStr.split(",")).forEach(receiverId -> receiverIds.add(Long.valueOf(receiverId)));
if (CollectionUtils.isNotEmpty(receiverIds)) {
return userService.getWechatUserMap(receiverIds);
}
return Maps.newHashMap();
}
public VehicleSharedDetailVO getSharedDetailInfo(Long shareId) {
UserSharedData sharedData = userSharedDataMapper.selectById(shareId);
if (sharedData != null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!