Commit ebc067dc by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 4ee8e41f 32238d09
......@@ -17,6 +17,7 @@ import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.EquityFundLog;
import share.system.domain.vo.EquityFundLogVo;
import share.system.service.EquityFundLogService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
......@@ -39,11 +40,12 @@ public class EquityFundLogController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:equityFundLog:list')")
@GetMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog)
public TableDataInfo list(EquityFundLogVo equityFundLog)
{
startPage();
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
return getDataTable(list);
TableDataInfo dataTable = getDataTable(list);
return equityFundLogService.pageList(dataTable,equityFundLog);
}
/**
......
......@@ -18,6 +18,7 @@ import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.SharingActivities;
import share.system.domain.vo.SharingActivitiesVo;
import share.system.service.SharingActivitiesService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
......@@ -39,10 +40,11 @@ public class SharingActivitiesController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:activities:list')")
@GetMapping("/list")
public TableDataInfo list(SharingActivities sharingActivities) {
public TableDataInfo list(SharingActivitiesVo sharingActivities) {
startPage();
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return getDataTable(list);
TableDataInfo dataTable = getDataTable(list);
return sharingActivitiesService.pageList(dataTable,sharingActivities);
}
/**
......
......@@ -11,7 +11,9 @@ import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.EquityFundLog;
import share.system.domain.SConsumer;
import share.system.domain.SharingActivities;
import share.system.domain.vo.DurationLogVo;
import share.system.domain.vo.EquityFundLogVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.EquityFundLogService;
......@@ -34,12 +36,13 @@ public class EquityFundLogController extends BaseController {
* 查询本人权益金记录列表
*/
@GetMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog) {
startPage();
public TableDataInfo list(EquityFundLogVo equityFundLog) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
equityFundLog.setUid(user.getId());
startPage();
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
return getDataTable(list);
TableDataInfo dataTable = getDataTable(list);
return equityFundLogService.pageList(dataTable,equityFundLog);
}
......
......@@ -13,6 +13,7 @@ import share.system.domain.EquityFundLog;
import share.system.domain.SConsumer;
import share.system.domain.SharingActivities;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SharingActivitiesVo;
import share.system.service.SharingActivitiesService;
import javax.servlet.http.HttpServletResponse;
......@@ -34,20 +35,24 @@ public class SharingActivitiesController extends BaseController {
* 查询分享活动绑定关系列表
*/
@GetMapping("/list")
public TableDataInfo list(SharingActivities sharingActivities) {
startPage();
public TableDataInfo list(SharingActivitiesVo sharingActivities) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setUid(user.getId());
sharingActivities.setNewUid(user.getId());
startPage();
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return getDataTable(list);
TableDataInfo dataTable = getDataTable(list);
return sharingActivitiesService.pageList(dataTable,sharingActivities);
}
@GetMapping("/query")
public AjaxResult query(SharingActivities sharingActivities) {
public TableDataInfo query(SharingActivitiesVo sharingActivities) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setNewUid(user.getId());
startPage();
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return success(list);
TableDataInfo dataTable = getDataTable(list);
return sharingActivitiesService.pageList(dataTable,sharingActivities);
}
/**
......@@ -64,4 +69,6 @@ public class SharingActivitiesController extends BaseController {
}
......@@ -428,10 +428,6 @@ public class RedisTask {
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
//添加权益金日志记录
//下级用户
SConsumer newConsumer = consumerService.getById(sOrder.getConsumerId());
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType(EquityFundTypeEnum.ORDER.getCode());
......@@ -439,14 +435,6 @@ public class RedisTask {
equityFundLog.setTerminalTrace(sOrder.getOutTradeNo());
equityFundLog.setUid(sharingActivities.getUid());
equityFundLog.setNewUid(sharingActivities.getNewUid());
equityFundLog.setPhone(consumer.getPhone());
equityFundLog.setAccount(consumer.getAccount());
equityFundLog.setNickName(consumer.getNickName());
equityFundLog.setAvatar(consumer.getAvatar());
equityFundLog.setNewAvatar(newConsumer.getAvatar());
equityFundLog.setNewPhone(newConsumer.getPhone());
equityFundLog.setNewAccount(newConsumer.getAccount());
equityFundLog.setNewNickName(newConsumer.getNickName());
equityFundLogService.insertEquityFundLog(equityFundLog);
}
}
......
......@@ -54,37 +54,7 @@ public class EquityFundLog extends BaseEntity
@TableField(select = false)
private Long isDelete;
/** 上级电话 */
@Excel(name = "上级电话")
private String phone;
/** 上级账号 */
@Excel(name = "上级账号")
private String account;
/** 上级用户昵称 */
@Excel(name = "上级用户昵称")
private String nickName;
/** 下级电话 */
@Excel(name = "下级电话")
private String newPhone;
/** 下级账号 */
@Excel(name = "下级账号")
private String newAccount;
/** 下级用户昵称 */
@Excel(name = "下级用户昵称")
private String newNickName;
/** 上级用户头像 */
@Excel(name = "上级用户头像")
private String avatar;
/** 下级用户头像 */
@Excel(name = "下级用户头像")
private String newAvatar;
@Override
......@@ -103,14 +73,6 @@ public class EquityFundLog extends BaseEntity
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("phone", getPhone())
.append("account", getAccount())
.append("nickName", getNickName())
.append("newPhone", getNewPhone())
.append("newAccount", getNewAccount())
.append("newNickName", getNewNickName())
.append("avatar", getAvatar())
.append("newAvatar", getNewAvatar())
.toString();
}
}
......@@ -40,29 +40,7 @@ public class SharingActivities extends BaseEntity
@TableField(select = false)
private Long isDelete;
/** 上级用户头像 */
@Excel(name = "上级用户头像")
private String avatar;
/** 下级用户头像 */
@Excel(name = "下级用户头像")
private String newAvatar;
/** 上级用户昵称 */
@Excel(name = "上级用户昵称")
private String nickName;
/** 下级用户昵称 */
@Excel(name = "下级用户昵称")
private String newNickName;
/** 上级电话 */
@Excel(name = "上级电话")
private String phone;
/** 下级电话 */
@Excel(name = "下级电话")
private String newPhone;
@Override
......@@ -78,12 +56,6 @@ public class SharingActivities extends BaseEntity
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("avatar", getAvatar())
.append("newAvatar", getNewAvatar())
.append("nickName", getNickName())
.append("newNickName", getNewNickName())
.append("phone", getPhone())
.append("newPhone", getNewPhone())
.toString();
}
}
package share.system.domain.vo;
import lombok.Data;
import share.common.annotation.Excel;
import share.system.domain.EquityFundLog;
@Data
public class EquityFundLogVo extends EquityFundLog {
/** 上级电话 */
private String phone;
/** 上级账号 */
private String account;
/** 上级用户昵称 */
private String nickName;
/** 下级电话 */
private String newPhone;
/** 下级账号 */
private String newAccount;
/** 下级用户昵称 */
private String newNickName;
/** 上级用户头像 */
private String avatar;
/** 下级用户头像 */
private String newAvatar;
}
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.SharingActivities;
@Data
public class SharingActivitiesVo extends SharingActivities {
/** 上级用户头像 */
private String avatar;
/** 下级用户头像 */
private String newAvatar;
/** 上级用户昵称 */
private String nickName;
/** 下级用户昵称 */
private String newNickName;
/** 上级电话 */
private String phone;
/** 下级电话 */
private String newPhone;
private Integer pageNum;
private Integer pageSize;
}
......@@ -2,7 +2,10 @@ package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.system.domain.EquityFundLog;
import share.system.domain.vo.EquityFundLogVo;
import share.system.domain.vo.SharingActivitiesVo;
/**
* 权益金记录Service接口
......@@ -63,4 +66,8 @@ public interface EquityFundLogService extends IService<EquityFundLog>
List<EquityFundLog> selectEquityFundLogByUid(Long uid);
List<EquityFundLog> selectEquityFundLogByNewUid(Long newUid);
TableDataInfo pageList(TableDataInfo info, EquityFundLogVo sharingActivities);
}
......@@ -3,7 +3,9 @@ package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.system.domain.SharingActivities;
import share.system.domain.vo.SharingActivitiesVo;
/**
* 分享活动绑定关系Service接口
......@@ -63,4 +65,6 @@ public interface SharingActivitiesService extends IService<SharingActivities>
int selectSharingActivitiesCount(SharingActivities sharingActivities);
TableDataInfo pageList(TableDataInfo info,SharingActivitiesVo sharingActivities);
}
......@@ -809,10 +809,6 @@ public class CallbackServiceImpl implements CallbackService {
consumerWalletService.insertConsumerWallet(newConsumerWallet);
}
//添加权益金日志记录
//下级用户
SConsumer newConsumer = consumerService.getById(consumerId);
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType(type);
......@@ -820,92 +816,11 @@ public class CallbackServiceImpl implements CallbackService {
equityFundLog.setTerminalTrace(terminalTrace);
equityFundLog.setUid(sharingActivities.getUid());
equityFundLog.setNewUid(sharingActivities.getNewUid());
equityFundLog.setPhone(consumer.getPhone());
equityFundLog.setAccount(consumer.getAccount());
equityFundLog.setNickName(consumer.getNickName());
equityFundLog.setAvatar(consumer.getAvatar());
equityFundLog.setNewAvatar(newConsumer.getAvatar());
equityFundLog.setNewPhone(newConsumer.getPhone());
equityFundLog.setNewAccount(newConsumer.getAccount());
equityFundLog.setNewNickName(newConsumer.getNickName());
equityFundLogService.insertEquityFundLog(equityFundLog);
}
}
}
}
// /**
// * 新增权益金日志
// * @param consumerId 用户ID
// * @param payPrice 消费金额
// * @param equityOrderNo 订单编号
// * @param terminalTrace 终端流水号
// * @param type 权益类型
// */
// private void addEquityFundLogRights(Long consumerId, BigDecimal payPrice, String equityOrderNo, String terminalTrace, String type) {
// //查询是否有上级
// SharingActivities sharingActivities = sharingActivitiesService.getOne(new LambdaQueryWrapper<SharingActivities>()
// .eq(SharingActivities::getNewUid, consumerId)
// .eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex()));
// if (ObjectUtil.isNotEmpty(sharingActivities)) {
// //查询会员用户类型
// LambdaQueryWrapper<ConsumerMember> consumerMemberWrapper = new LambdaQueryWrapper<>();
// consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
// ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
// LambdaQueryWrapper<ConsumerMember> newConsumerMemberWrapper = new LambdaQueryWrapper<>();
// newConsumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
// ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberWrapper);
// //判断是否为权益会员和会员是否有效
// if ("2".equals(consumerMember.getMemberType()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
// && "2".equals(newConsumerMember.getMemberType()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
// Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
// Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().toString());
// if (aBoolean && newAboolean) {
// String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
// //查询上级用户是否有钱包
// ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
// .eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
// if (ObjectUtil.isNotEmpty(consumerWallet)) {
// consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund))));
// consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
// add(payPrice.multiply(new BigDecimal(equityFund))));
// consumerWallet.setUpdateTime(DateUtils.getNowDate());
// consumerWalletService.updateConsumerWallet(consumerWallet);
// } else {
// //新增钱包
// ConsumerWallet newConsumerWallet = new ConsumerWallet();
// BigDecimal defaultVlue = new BigDecimal(0.0);
// newConsumerWallet.setConsumerId(sharingActivities.getUid());
// newConsumerWallet.setBalance(defaultVlue);
// newConsumerWallet.setRemainingIntegral(defaultVlue);
// newConsumerWallet.setRemainingDuration(defaultVlue);
// newConsumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
// newConsumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund()
// .add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
// consumerWalletService.insertConsumerWallet(newConsumerWallet);
// }
// //添加权益金日志记录
// //下级用户
// SConsumer newConsumer = consumerService.getById(consumerId);
// //上级用户
// SConsumer consumer = consumerService.getById(sharingActivities.getUid());
// EquityFundLog equityFundLog = new EquityFundLog();
// equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
// equityFundLog.setEquityFundType(type);
// equityFundLog.setOutTradeNo(equityOrderNo);
// equityFundLog.setTerminalTrace(terminalTrace);
// equityFundLog.setUid(sharingActivities.getUid());
// equityFundLog.setNewUid(sharingActivities.getNewUid());
// equityFundLog.setPhone(consumer.getPhone());
// equityFundLog.setAccount(consumer.getAccount());
// equityFundLog.setNickName(consumer.getNickName());
// equityFundLog.setNewPhone(newConsumer.getPhone());
// equityFundLog.setNewAccount(newConsumer.getAccount());
// equityFundLog.setNewNickName(newConsumer.getNickName());
// equityFundLogService.insertEquityFundLog(equityFundLog);
// }
// }
// }
// }
......
package share.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import share.common.core.page.TableDataInfo;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.StringUtils;
import share.system.domain.SConsumer;
import share.system.domain.vo.EquityFundLogVo;
import share.system.mapper.EquityFundLogMapper;
import share.system.domain.EquityFundLog;
import share.system.service.EquityFundLogService;
import share.system.service.SConsumerService;
/**
* 权益金记录Service业务层处理
......@@ -23,6 +36,9 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
@Autowired
private EquityFundLogMapper equityFundLogMapper;
@Autowired
private SConsumerService sConsumerService;
/**
* 查询权益金记录
*
......@@ -44,6 +60,8 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
@Override
public List<EquityFundLog> selectEquityFundLogList(EquityFundLog equityFundLog)
{
return equityFundLogMapper.selectEquityFundLogList(equityFundLog);
}
......@@ -108,4 +126,59 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
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();
if (CollectionUtils.isEmpty(activities)) return info;
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.like(SConsumer::getNickName,equityFundLog.getNewNickName());
}
if(StringUtils.isNotEmpty(equityFundLog.getNewPhone())){
newSConsumer.like(SConsumer::getPhone,equityFundLog.getNewPhone());
}
if(StringUtils.isNotEmpty(equityFundLog.getNickName())){
uSConsumer.like(SConsumer::getNickName,equityFundLog.getNickName());
}
if(StringUtils.isNotEmpty(equityFundLog.getPhone())){
uSConsumer.like(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);
Set<Long> longs = userMap.keySet();
Set<Long> longs1 = newUserMap.keySet();
if (!(longs.contains(item.getUid()) && longs1.contains(item.getNewUid()))){
return;
}
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;
}
}
......@@ -316,12 +316,12 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
SConsumer newConsumer = sConsumerService.selectSConsumerById(id);
SharingActivities sharingActivities = new SharingActivities();
sharingActivities.setUid(uid);
sharingActivities.setPhone(consumer.getPhone());
sharingActivities.setAvatar(consumer.getAvatar());
sharingActivities.setNickName(consumer.getNickName());
sharingActivities.setNewPhone(newConsumer.getPhone());
sharingActivities.setNewAvatar(newConsumer.getAvatar());
sharingActivities.setNewNickName(newConsumer.getNickName());
// sharingActivities.setPhone(consumer.getPhone());
// sharingActivities.setAvatar(consumer.getAvatar());
// sharingActivities.setNickName(consumer.getNickName());
// sharingActivities.setNewPhone(newConsumer.getPhone());
// sharingActivities.setNewAvatar(newConsumer.getAvatar());
// sharingActivities.setNewNickName(newConsumer.getNickName());
sharingActivities.setNewUid(id);
sharingActivities.setCreateTime(DateUtils.getNowDate());
sharingActivitiesService.insertSharingActivities(sharingActivities);
......
package share.system.service.impl;
import java.time.YearMonth;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.hssf.record.DVALRecord;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.StringUtils;
import share.system.domain.SConsumer;
import share.system.domain.vo.SharingActivitiesVo;
import share.system.mapper.SharingActivitiesMapper;
import share.system.domain.SharingActivities;
import share.system.service.SConsumerService;
import share.system.service.SharingActivitiesService;
import javax.annotation.Resource;
/**
* 分享活动绑定关系Service业务层处理
*
......@@ -30,7 +39,7 @@ import share.system.service.SharingActivitiesService;
@Service
public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesMapper, SharingActivities> implements SharingActivitiesService
{
@Autowired
@Resource
private SharingActivitiesMapper sharingActivitiesMapper;
@Autowired
......@@ -39,6 +48,10 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private SConsumerService sConsumerService;
/**
* 查询分享活动绑定关系
*
......@@ -61,6 +74,7 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
public List<SharingActivities> selectSharingActivitiesList(SharingActivities sharingActivities)
{
return sharingActivitiesMapper.selectSharingActivitiesList(sharingActivities);
}
......@@ -89,9 +103,9 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
{
SConsumer consumer = consumerService.selectSConsumerById(sharingActivities.getUid());
sharingActivities.setUpdateTime(DateUtils.getNowDate());
sharingActivities.setAvatar(consumer.getAvatar());
sharingActivities.setPhone(consumer.getPhone());
sharingActivities.setNickName(consumer.getNickName());
// sharingActivities.setAvatar(consumer.getAvatar());
// sharingActivities.setPhone(consumer.getPhone());
// sharingActivities.setNickName(consumer.getNickName());
return sharingActivitiesMapper.updateSharingActivities(sharingActivities);
}
......@@ -127,5 +141,62 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
.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();
if (CollectionUtils.isEmpty(activities)){
return info;
}
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.like(SConsumer::getNickName,sharingActivities.getNewNickName());
}
if(StringUtils.isNotEmpty(sharingActivities.getNewPhone())){
newSConsumer.like(SConsumer::getPhone,sharingActivities.getNewPhone());
}
if(StringUtils.isNotEmpty(sharingActivities.getNickName())){
uSConsumer.like(SConsumer::getNickName,sharingActivities.getNickName());
}
if(StringUtils.isNotEmpty(sharingActivities.getPhone())){
uSConsumer.like(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);
Set<Long> longs = userMap.keySet();
Set<Long> longs1 = newUserMap.keySet();
if (!(longs.contains(item.getUid()) && longs1.contains(item.getNewUid()))){
return;
}
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;
}
}
......@@ -18,23 +18,15 @@
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="phone" column="phone" />
<result property="account" column="account" />
<result property="nickName" column="nick_name" />
<result property="newPhone" column="new_phone" />
<result property="newAccount" column="new_account" />
<result property="newNickName" column="new_nick_name" />
<result property="avatar" column="avatar" />
<result property="newAvatar" column="new_avatar" />
</resultMap>
<sql id="selectEquityFundLogVo">
select id, equity_fund_type, equity_fund, uid, new_uid, terminal_trace, out_trade_no, is_delete, create_by, create_time, update_by, update_time, remark, phone, account, nick_name, new_phone, new_account, new_nick_name, avatar, new_avatar from s_equity_fund_log
select id, equity_fund_type, equity_fund, uid, new_uid, terminal_trace, out_trade_no, is_delete, create_by, create_time, update_by, update_time, remark from s_equity_fund_log
</sql>
<select id="selectEquityFundLogList" parameterType="EquityFundLog" resultMap="EquityFundLogResult">
<include refid="selectEquityFundLogVo"/>
<where>
where 1=1
<if test="equityFundType != null and equityFundType != ''"> and equity_fund_type = #{equityFundType}</if>
<if test="equityFund != null "> and equity_fund = #{equityFund}</if>
<if test="uid != null "> and uid = #{uid}</if>
......@@ -42,15 +34,6 @@
<if test="terminalTrace != null and terminalTrace != ''"> and terminal_trace = #{terminalTrace}</if>
<if test="outTradeNo != null and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="account != null and account != ''"> and account = #{account}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="newPhone != null and newPhone != ''"> and new_phone = #{newPhone}</if>
<if test="newAccount != null and newAccount != ''"> and new_account = #{newAccount}</if>
<if test="newNickName != null and newNickName != ''"> and new_nick_name like concat('%', #{newNickName}, '%')</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="newAvatar != null and newAvatar != ''"> and new_avatar = #{newAvatar}</if>
</where>
order by create_time desc
</select>
......@@ -74,14 +57,6 @@
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="phone != null">phone,</if>
<if test="account != null">account,</if>
<if test="nickName != null">nick_name,</if>
<if test="newPhone != null">new_phone,</if>
<if test="newAccount != null">new_account,</if>
<if test="newNickName != null">new_nick_name,</if>
<if test="avatar != null">avatar,</if>
<if test="newAvatar != null">new_avatar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equityFundType != null and equityFundType != ''">#{equityFundType},</if>
......@@ -96,14 +71,6 @@
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="phone != null">#{phone},</if>
<if test="account != null">#{account},</if>
<if test="nickName != null">#{nickName},</if>
<if test="newPhone != null">#{newPhone},</if>
<if test="newAccount != null">#{newAccount},</if>
<if test="newNickName != null">#{newNickName},</if>
<if test="avatar != null">#{avatar},</if>
<if test="newAvatar != null">#{newAvatar},</if>
</trim>
</insert>
......@@ -122,14 +89,6 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="account != null">account = #{account},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="newPhone != null">new_phone = #{newPhone},</if>
<if test="newAccount != null">new_account = #{newAccount},</if>
<if test="newNickName != null">new_nick_name = #{newNickName},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="newAvatar != null">new_avatar = #{newAvatar},</if>
</trim>
where id = #{id}
</update>
......
......@@ -15,16 +15,11 @@
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="avatar" column="avatar" />
<result property="newAvatar" column="new_avatar" />
<result property="nickName" column="nick_name" />
<result property="newNickName" column="new_nick_name" />
<result property="phone" column="phone" />
<result property="newPhone" column="new_phone" />
</resultMap>
<sql id="selectSharingActivitiesVo">
select id, activity_type, uid, new_uid, is_delete, create_by, create_time, update_by, update_time, remark, avatar, new_avatar, nick_name, new_nick_name, phone, new_phone from s_sharing_activities
select id, activity_type, uid, new_uid, is_delete, create_by, create_time, update_by, update_time, remark
from s_sharing_activities
</sql>
<select id="selectSharingActivitiesList" parameterType="SharingActivities" resultMap="SharingActivitiesResult">
......@@ -34,12 +29,6 @@
<if test="uid != null "> and uid = #{uid}</if>
<if test="newUid != null "> and new_uid = #{newUid}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="newAvatar != null and newAvatar != ''"> and new_avatar = #{newAvatar}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="newNickName != null and newNickName != ''"> and new_nick_name like concat('%', #{newNickName}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="newPhone != null and newPhone != ''"> and new_phone = #{newPhone}</if>
</where>
order by create_time desc
</select>
......@@ -61,12 +50,6 @@
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="avatar != null">avatar,</if>
<if test="newAvatar != null">new_avatar,</if>
<if test="nickName != null">nick_name,</if>
<if test="newNickName != null">new_nick_name,</if>
<if test="phone != null">phone,</if>
<if test="newPhone != null">new_phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="activityType != null and activityType != ''">#{activityType},</if>
......@@ -78,12 +61,6 @@
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="avatar != null">#{avatar},</if>
<if test="newAvatar != null">#{newAvatar},</if>
<if test="nickName != null">#{nickName},</if>
<if test="newNickName != null">#{newNickName},</if>
<if test="phone != null">#{phone},</if>
<if test="newPhone != null">#{newPhone},</if>
</trim>
</insert>
......@@ -98,13 +75,6 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="newAvatar != null">new_avatar = #{newAvatar},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="newNickName != null">new_nick_name = #{newNickName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="newPhone != null">new_phone = #{newPhone},</if>
</trim>
where id = #{id}
</update>
......
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