Commit 8f886aa4 by YG8429

绑定关系查询,权益金日志查询修改查询方法,增加vo对象

parent fa208304
...@@ -43,7 +43,7 @@ public class EquityFundLogController extends BaseController ...@@ -43,7 +43,7 @@ public class EquityFundLogController extends BaseController
public TableDataInfo list(EquityFundLog equityFundLog) public TableDataInfo list(EquityFundLog equityFundLog)
{ {
startPage(); startPage();
List<EquityFundLogVo> list = equityFundLogService.selectEquityFundLogList(equityFundLog); List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
return getDataTable(list); return getDataTable(list);
} }
...@@ -55,8 +55,8 @@ public class EquityFundLogController extends BaseController ...@@ -55,8 +55,8 @@ public class EquityFundLogController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, EquityFundLog equityFundLog) public void export(HttpServletResponse response, EquityFundLog equityFundLog)
{ {
List<EquityFundLogVo> list = equityFundLogService.selectEquityFundLogList(equityFundLog); List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
ExcelUtil<EquityFundLogVo> util = new ExcelUtil<EquityFundLogVo>(EquityFundLogVo.class); ExcelUtil<EquityFundLog> util = new ExcelUtil<EquityFundLog>(EquityFundLog.class);
util.exportExcel(response, list, "权益金记录数据"); util.exportExcel(response, list, "权益金记录数据");
} }
......
...@@ -40,10 +40,11 @@ public class SharingActivitiesController extends BaseController { ...@@ -40,10 +40,11 @@ public class SharingActivitiesController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:activities:list')") @PreAuthorize("@ss.hasPermi('system:activities:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SharingActivities sharingActivities) { public TableDataInfo list(SharingActivitiesVo sharingActivities) {
startPage(); startPage();
List<SharingActivitiesVo> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities); List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return getDataTable(list); TableDataInfo dataTable = getDataTable(list);
return sharingActivitiesService.pageList(dataTable,sharingActivities);
} }
/** /**
...@@ -53,8 +54,8 @@ public class SharingActivitiesController extends BaseController { ...@@ -53,8 +54,8 @@ public class SharingActivitiesController extends BaseController {
@Log(title = "分享活动绑定关系", businessType = BusinessType.EXPORT) @Log(title = "分享活动绑定关系", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SharingActivities sharingActivities) { public void export(HttpServletResponse response, SharingActivities sharingActivities) {
List<SharingActivitiesVo> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities); List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
ExcelUtil<SharingActivitiesVo> util = new ExcelUtil<SharingActivitiesVo>(SharingActivitiesVo.class); ExcelUtil<SharingActivities> util = new ExcelUtil<SharingActivities>(SharingActivities.class);
util.exportExcel(response, list, "分享活动绑定关系数据"); util.exportExcel(response, list, "分享活动绑定关系数据");
} }
......
...@@ -11,6 +11,7 @@ import share.common.enums.BusinessType; ...@@ -11,6 +11,7 @@ import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.system.domain.EquityFundLog; import share.system.domain.EquityFundLog;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.SharingActivities;
import share.system.domain.vo.DurationLogVo; import share.system.domain.vo.DurationLogVo;
import share.system.domain.vo.EquityFundLogVo; import share.system.domain.vo.EquityFundLogVo;
import share.system.domain.vo.FrontTokenComponent; import share.system.domain.vo.FrontTokenComponent;
...@@ -35,12 +36,16 @@ public class EquityFundLogController extends BaseController { ...@@ -35,12 +36,16 @@ public class EquityFundLogController extends BaseController {
* 查询本人权益金记录列表 * 查询本人权益金记录列表
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog) { public TableDataInfo list(EquityFundLogVo equityFundLog) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
equityFundLog.setUid(user.getId()); equityFundLog.setUid(user.getId());
List<EquityFundLogVo> list = equityFundLogService.selectEquityFundLogList(equityFundLog); startPage();
return getDataTable(list); List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
TableDataInfo dataTable = getDataTable(list);
return equityFundLogService.pageList(dataTable,equityFundLog);
} }
......
...@@ -36,19 +36,23 @@ public class SharingActivitiesController extends BaseController { ...@@ -36,19 +36,23 @@ public class SharingActivitiesController extends BaseController {
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SharingActivitiesVo sharingActivities) { public TableDataInfo list(SharingActivitiesVo sharingActivities) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setUid(user.getId()); sharingActivities.setNewUid(user.getId());
List<SharingActivitiesVo> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities); startPage();
return getDataTable(list); List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
TableDataInfo dataTable = getDataTable(list);
return sharingActivitiesService.pageList(dataTable,sharingActivities);
} }
@GetMapping("/query") @GetMapping("/query")
public AjaxResult query(SharingActivities sharingActivities) { public TableDataInfo query(SharingActivitiesVo sharingActivities) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setNewUid(user.getId()); sharingActivities.setNewUid(user.getId());
List<SharingActivitiesVo> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities); startPage();
return success(list); List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
TableDataInfo dataTable = getDataTable(list);
return sharingActivitiesService.pageList(dataTable,sharingActivities);
} }
/** /**
...@@ -65,4 +69,6 @@ public class SharingActivitiesController extends BaseController { ...@@ -65,4 +69,6 @@ public class SharingActivitiesController extends BaseController {
} }
...@@ -30,4 +30,9 @@ public class SharingActivitiesVo extends SharingActivities { ...@@ -30,4 +30,9 @@ public class SharingActivitiesVo extends SharingActivities {
private String newPhone; private String newPhone;
private Integer pageNum;
private Integer pageSize;
} }
...@@ -2,8 +2,10 @@ package share.system.service; ...@@ -2,8 +2,10 @@ package share.system.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.system.domain.EquityFundLog; import share.system.domain.EquityFundLog;
import share.system.domain.vo.EquityFundLogVo; import share.system.domain.vo.EquityFundLogVo;
import share.system.domain.vo.SharingActivitiesVo;
/** /**
* 权益金记录Service接口 * 权益金记录Service接口
...@@ -27,7 +29,7 @@ public interface EquityFundLogService extends IService<EquityFundLog> ...@@ -27,7 +29,7 @@ public interface EquityFundLogService extends IService<EquityFundLog>
* @param equityFundLog 权益金记录 * @param equityFundLog 权益金记录
* @return 权益金记录集合 * @return 权益金记录集合
*/ */
public List<EquityFundLogVo> selectEquityFundLogList(EquityFundLog equityFundLog); public List<EquityFundLog> selectEquityFundLogList(EquityFundLog equityFundLog);
/** /**
* 新增权益金记录 * 新增权益金记录
...@@ -64,4 +66,8 @@ public interface EquityFundLogService extends IService<EquityFundLog> ...@@ -64,4 +66,8 @@ public interface EquityFundLogService extends IService<EquityFundLog>
List<EquityFundLog> selectEquityFundLogByUid(Long uid); List<EquityFundLog> selectEquityFundLogByUid(Long uid);
List<EquityFundLog> selectEquityFundLogByNewUid(Long newUid); List<EquityFundLog> selectEquityFundLogByNewUid(Long newUid);
TableDataInfo pageList(TableDataInfo info, EquityFundLogVo sharingActivities);
} }
...@@ -3,6 +3,7 @@ package share.system.service; ...@@ -3,6 +3,7 @@ package share.system.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.system.domain.SharingActivities; import share.system.domain.SharingActivities;
import share.system.domain.vo.SharingActivitiesVo; import share.system.domain.vo.SharingActivitiesVo;
...@@ -28,7 +29,7 @@ public interface SharingActivitiesService extends IService<SharingActivities> ...@@ -28,7 +29,7 @@ public interface SharingActivitiesService extends IService<SharingActivities>
* @param sharingActivities 分享活动绑定关系 * @param sharingActivities 分享活动绑定关系
* @return 分享活动绑定关系集合 * @return 分享活动绑定关系集合
*/ */
public List<SharingActivitiesVo> selectSharingActivitiesList(SharingActivities sharingActivities); public List<SharingActivities> selectSharingActivitiesList(SharingActivities sharingActivities);
/** /**
* 新增分享活动绑定关系 * 新增分享活动绑定关系
...@@ -64,4 +65,6 @@ public interface SharingActivitiesService extends IService<SharingActivities> ...@@ -64,4 +65,6 @@ public interface SharingActivitiesService extends IService<SharingActivities>
int selectSharingActivitiesCount(SharingActivities sharingActivities); int selectSharingActivitiesCount(SharingActivities sharingActivities);
TableDataInfo pageList(TableDataInfo info,SharingActivitiesVo sharingActivities);
} }
...@@ -10,14 +10,13 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -10,14 +10,13 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import share.common.core.page.TableDataInfo;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.common.utils.StringUtils; import share.common.utils.StringUtils;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.SharingActivities;
import share.system.domain.vo.EquityFundLogVo; import share.system.domain.vo.EquityFundLogVo;
import share.system.domain.vo.SharingActivitiesVo;
import share.system.mapper.EquityFundLogMapper; import share.system.mapper.EquityFundLogMapper;
import share.system.domain.EquityFundLog; import share.system.domain.EquityFundLog;
import share.system.service.EquityFundLogService; import share.system.service.EquityFundLogService;
...@@ -57,37 +56,11 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E ...@@ -57,37 +56,11 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
* @return 权益金记录 * @return 权益金记录
*/ */
@Override @Override
public List<EquityFundLogVo> selectEquityFundLogList(EquityFundLog equityFundLog) public List<EquityFundLog> selectEquityFundLogList(EquityFundLog equityFundLog)
{ {
List<EquityFundLog> activities = equityFundLogMapper.selectEquityFundLogList(equityFundLog);
List<EquityFundLogVo> voList = new ArrayList<>();
List<Long> collect = activities.stream().map(EquityFundLog::getNewUid).collect(Collectors.toList());
List<Long> uids = activities.stream().map(EquityFundLog::getUid).collect(Collectors.toList());
Map<Long, SConsumer> newUserMap = sConsumerService.list(new LambdaQueryWrapper<SConsumer>().in(SConsumer::getId, collect))
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
Map<Long,SConsumer> userMap = sConsumerService.list(new LambdaQueryWrapper<SConsumer>().in(SConsumer::getId, uids))
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
activities.stream().forEach(item ->{
EquityFundLogVo vo = new EquityFundLogVo();
BeanUtils.copyProperties(item, vo);
SConsumer newConsumer = newUserMap.get(item.getNewUid());
SConsumer uConsumer = userMap.get(item.getUid());
if(ObjectUtil.isNotEmpty(newConsumer)){
vo.setNewAvatar(StringUtils.isNotEmpty(newConsumer.getAvatar()) ? newConsumer.getAvatar():"");
vo.setNewNickName(StringUtils.isNotEmpty(newConsumer.getNickName()) ? newConsumer.getNickName():"");
vo.setNewPhone(StringUtils.isNotEmpty(newConsumer.getPhone()) ? newConsumer.getPhone():"");
}
if(ObjectUtil.isNotEmpty(uConsumer)){
vo.setAvatar(StringUtils.isNotEmpty(uConsumer.getAvatar()) ? uConsumer.getAvatar():"");
vo.setNickName(StringUtils.isNotEmpty(uConsumer.getNickName()) ? uConsumer.getNickName():"");
vo.setPhone(StringUtils.isNotEmpty(uConsumer.getPhone()) ? uConsumer.getPhone():"");
}
voList.add(vo);
});
return voList; return equityFundLogMapper.selectEquityFundLogList(equityFundLog);
} }
/** /**
...@@ -151,4 +124,54 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E ...@@ -151,4 +124,54 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
return equityFundLogMapper.selectList(new LambdaQueryWrapper<EquityFundLog>().eq(EquityFundLog::getNewUid,newUid)); return equityFundLogMapper.selectList(new LambdaQueryWrapper<EquityFundLog>().eq(EquityFundLog::getNewUid,newUid));
} }
@Override
public TableDataInfo pageList(TableDataInfo info, EquityFundLogVo equityFundLog) {
List<EquityFundLogVo> voList = new ArrayList<>();
List<EquityFundLog> activities =(List<EquityFundLog>) info.getRows();
List<Long> collect = activities.stream().map(EquityFundLog::getNewUid).collect(Collectors.toList());
List<Long> uids = activities.stream().map(EquityFundLog::getUid).collect(Collectors.toList());
LambdaQueryWrapper<SConsumer> newSConsumer = new LambdaQueryWrapper<SConsumer>();
LambdaQueryWrapper<SConsumer> uSConsumer = new LambdaQueryWrapper<SConsumer>();
newSConsumer.in(SConsumer::getId, collect);
uSConsumer.in(SConsumer::getId, uids);
if(StringUtils.isNotEmpty(equityFundLog.getNewNickName())){
newSConsumer.eq(SConsumer::getNickName,equityFundLog.getNewNickName());
}
if(StringUtils.isNotEmpty(equityFundLog.getNewPhone())){
newSConsumer.eq(SConsumer::getPhone,equityFundLog.getNewPhone());
}
if(StringUtils.isNotEmpty(equityFundLog.getNickName())){
uSConsumer.eq(SConsumer::getNickName,equityFundLog.getNickName());
}
if(StringUtils.isNotEmpty(equityFundLog.getPhone())){
uSConsumer.eq(SConsumer::getPhone,equityFundLog.getPhone());
}
Map<Long,SConsumer> newUserMap = sConsumerService.list(newSConsumer)
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
Map<Long,SConsumer> userMap = sConsumerService.list(uSConsumer)
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
activities.stream().forEach(item ->{
EquityFundLogVo vo = new EquityFundLogVo();
BeanUtils.copyProperties(item, vo);
SConsumer newConsumer = newUserMap.get(item.getNewUid());
SConsumer uConsumer = userMap.get(item.getUid());
if(ObjectUtil.isNotEmpty(newConsumer)){
vo.setNewAvatar(StringUtils.isNotEmpty(newConsumer.getAvatar()) ? newConsumer.getAvatar():"");
vo.setNewNickName(StringUtils.isNotEmpty(newConsumer.getNickName()) ? newConsumer.getNickName():"");
vo.setNewPhone(StringUtils.isNotEmpty(newConsumer.getPhone()) ? newConsumer.getPhone():"");
}
if(ObjectUtil.isNotEmpty(uConsumer)){
vo.setAvatar(StringUtils.isNotEmpty(uConsumer.getAvatar()) ? uConsumer.getAvatar():"");
vo.setNickName(StringUtils.isNotEmpty(uConsumer.getNickName()) ? uConsumer.getNickName():"");
vo.setPhone(StringUtils.isNotEmpty(uConsumer.getPhone()) ? uConsumer.getPhone():"");
}
voList.add(vo);
});
info.setRows(voList);
return info;
}
} }
package share.system.service.impl; package share.system.service.impl;
import java.time.YearMonth; import java.time.YearMonth;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -15,6 +12,7 @@ import org.apache.poi.hssf.record.DVALRecord; ...@@ -15,6 +12,7 @@ import org.apache.poi.hssf.record.DVALRecord;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil; import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum; import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum; import share.common.enums.YesNoEnum;
...@@ -29,6 +27,8 @@ import share.system.domain.SharingActivities; ...@@ -29,6 +27,8 @@ import share.system.domain.SharingActivities;
import share.system.service.SConsumerService; import share.system.service.SConsumerService;
import share.system.service.SharingActivitiesService; import share.system.service.SharingActivitiesService;
import javax.annotation.Resource;
/** /**
* 分享活动绑定关系Service业务层处理 * 分享活动绑定关系Service业务层处理
* *
...@@ -38,7 +38,7 @@ import share.system.service.SharingActivitiesService; ...@@ -38,7 +38,7 @@ import share.system.service.SharingActivitiesService;
@Service @Service
public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesMapper, SharingActivities> implements SharingActivitiesService public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesMapper, SharingActivities> implements SharingActivitiesService
{ {
@Autowired @Resource
private SharingActivitiesMapper sharingActivitiesMapper; private SharingActivitiesMapper sharingActivitiesMapper;
@Autowired @Autowired
...@@ -70,35 +70,11 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM ...@@ -70,35 +70,11 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
* @return 分享活动绑定关系 * @return 分享活动绑定关系
*/ */
@Override @Override
public List<SharingActivitiesVo> selectSharingActivitiesList(SharingActivities sharingActivities) public List<SharingActivities> selectSharingActivitiesList(SharingActivities sharingActivities)
{ {
List<SharingActivities> activities = sharingActivitiesMapper.selectSharingActivitiesList(sharingActivities);
List<SharingActivitiesVo> voList = new ArrayList<>();
List<Long> collect = activities.stream().map(SharingActivities::getNewUid).collect(Collectors.toList());
List<Long> uids = activities.stream().map(SharingActivities::getUid).collect(Collectors.toList());
Map<Long,SConsumer> newUserMap = sConsumerService.list(new LambdaQueryWrapper<SConsumer>().in(SConsumer::getId, collect))
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
Map<Long,SConsumer> userMap = sConsumerService.list(new LambdaQueryWrapper<SConsumer>().in(SConsumer::getId, uids))
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
activities.stream().forEach(item ->{
SharingActivitiesVo vo = new SharingActivitiesVo();
BeanUtils.copyProperties(item, vo);
SConsumer newConsumer = newUserMap.get(item.getNewUid());
SConsumer uConsumer = userMap.get(item.getUid());
if(ObjectUtil.isNotEmpty(newConsumer)){
vo.setNewAvatar(StringUtils.isNotEmpty(newConsumer.getAvatar()) ? newConsumer.getAvatar():"");
vo.setNewNickName(StringUtils.isNotEmpty(newConsumer.getNickName()) ? newConsumer.getNickName():"");
vo.setNewPhone(StringUtils.isNotEmpty(newConsumer.getPhone()) ? newConsumer.getPhone():"");
}
if(ObjectUtil.isNotEmpty(uConsumer)){
vo.setAvatar(StringUtils.isNotEmpty(uConsumer.getAvatar()) ? uConsumer.getAvatar():"");
vo.setNickName(StringUtils.isNotEmpty(uConsumer.getNickName()) ? uConsumer.getNickName():"");
vo.setPhone(StringUtils.isNotEmpty(uConsumer.getPhone()) ? uConsumer.getPhone():"");
}
voList.add(vo);
});
return voList;
return sharingActivitiesMapper.selectSharingActivitiesList(sharingActivities);
} }
/** /**
...@@ -164,5 +140,56 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM ...@@ -164,5 +140,56 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
.eq(SharingActivities::getIsDelete,YesNoEnum.no.getIndex())); .eq(SharingActivities::getIsDelete,YesNoEnum.no.getIndex()));
} }
@Override
public TableDataInfo pageList(TableDataInfo info,SharingActivitiesVo sharingActivities) {
List<SharingActivitiesVo> voList = new ArrayList<>();
List<SharingActivities> activities =(List<SharingActivities>) info.getRows();
List<Long> collect = activities.stream().map(SharingActivities::getNewUid).collect(Collectors.toList());
List<Long> uids = activities.stream().map(SharingActivities::getUid).collect(Collectors.toList());
LambdaQueryWrapper<SConsumer> newSConsumer = new LambdaQueryWrapper<SConsumer>();
LambdaQueryWrapper<SConsumer> uSConsumer = new LambdaQueryWrapper<SConsumer>();
newSConsumer.in(SConsumer::getId, collect);
uSConsumer.in(SConsumer::getId, uids);
if(StringUtils.isNotEmpty(sharingActivities.getNewNickName())){
newSConsumer.eq(SConsumer::getNickName,sharingActivities.getNewNickName());
}
if(StringUtils.isNotEmpty(sharingActivities.getNewPhone())){
newSConsumer.eq(SConsumer::getPhone,sharingActivities.getNewPhone());
}
if(StringUtils.isNotEmpty(sharingActivities.getNickName())){
uSConsumer.eq(SConsumer::getNickName,sharingActivities.getNickName());
}
if(StringUtils.isNotEmpty(sharingActivities.getPhone())){
uSConsumer.eq(SConsumer::getPhone,sharingActivities.getPhone());
}
Map<Long,SConsumer> newUserMap = sConsumerService.list(newSConsumer)
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
Map<Long,SConsumer> userMap = sConsumerService.list(uSConsumer)
.stream().collect(Collectors.toMap(SConsumer::getId, Function.identity()));
activities.stream().forEach(item ->{
SharingActivitiesVo vo = new SharingActivitiesVo();
BeanUtils.copyProperties(item, vo);
SConsumer newConsumer = newUserMap.get(item.getNewUid());
SConsumer uConsumer = userMap.get(item.getUid());
if(ObjectUtil.isNotEmpty(newConsumer)){
vo.setNewAvatar(StringUtils.isNotEmpty(newConsumer.getAvatar()) ? newConsumer.getAvatar():"");
vo.setNewNickName(StringUtils.isNotEmpty(newConsumer.getNickName()) ? newConsumer.getNickName():"");
vo.setNewPhone(StringUtils.isNotEmpty(newConsumer.getPhone()) ? newConsumer.getPhone():"");
}
if(ObjectUtil.isNotEmpty(uConsumer)){
vo.setAvatar(StringUtils.isNotEmpty(uConsumer.getAvatar()) ? uConsumer.getAvatar():"");
vo.setNickName(StringUtils.isNotEmpty(uConsumer.getNickName()) ? uConsumer.getNickName():"");
vo.setPhone(StringUtils.isNotEmpty(uConsumer.getPhone()) ? uConsumer.getPhone():"");
}
voList.add(vo);
});
info.setRows(voList);
return info;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment