推广部分最后修改

This commit is contained in:
liuyingfang
2023-07-27 09:53:50 +08:00
parent 817223d79f
commit 9e5aca8d74
10 changed files with 260 additions and 59 deletions

View File

@@ -88,7 +88,7 @@ public class PromoterMainPageServiceImpl implements MainPageService {
//今日收款笔数
queryMap.put("recordDate", DateUtils.getDayBegin());
queryMap.put("retype", "1");
totalOrderCount = merchantProfitService.queryMerchantProfitPageCount(queryMap);
totalOrderCount = merchantProfitMapper.queryMerchantProfitPageCountV2(userId);
todayProfit = merchantProfitService.queryMerchantProfitSumPrice(queryMap);
//今日收益
BigDecimal todaySum = merchantProfitMapper.getTodaySum(userId);
@@ -102,7 +102,7 @@ public class PromoterMainPageServiceImpl implements MainPageService {
//今日收款
BigDecimal consumeFeeTeamToday = merchantProfitMapper.getConsumeFeeTeamToday(userId);
//总商户数
Integer countChildAll = merchantProfitMapper.getCountChild(Long.valueOf(userId), "MC");
Integer countChildAll = merchantProfitMapper.getCountChildV2(Long.valueOf(userId));
resultMap.put("promoteFee", promoteFee + "");
resultMap.put("totalOrderCount", totalOrderCount + "");

View File

@@ -1,14 +1,15 @@
package cn.pluss.platform.merchantProfit.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.pluss.platform.api.PageInfo;
import cn.pluss.platform.constants.Constant;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.enums.BstLevelCode;
import cn.pluss.platform.enums.UserRoleEnum;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.*;
import cn.pluss.platform.merchant.MerchantRateNewService;
import cn.pluss.platform.mapper.MerchantOrderMapper;
import cn.pluss.platform.mapper.MerchantProfitMapper;
import cn.pluss.platform.mapper.UserAppMapper;
import cn.pluss.platform.mapper.UserPromotionMapper;
import cn.pluss.platform.merchantProfit.MerchantProfitService;
import cn.pluss.platform.notice.NoticeService;
import cn.pluss.platform.user.UserLevelService;
@@ -16,14 +17,11 @@ import cn.pluss.platform.user.impl.GeneralPushUtil;
import cn.pluss.platform.userAssess.UserAssessService;
import cn.pluss.platform.userRewardFlow.UserRewardFlowService;
import cn.pluss.platform.util.DateUtils;
import cn.pluss.platform.util.StringUtil;
import cn.pluss.platform.vo.MerChannelStatusVO;
import cn.pluss.platform.vo.MerchantProfitVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -31,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -110,7 +107,6 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
@Override
public Map<String, Object> teamList(String typeCode, Long userId,Integer page,Integer size,
String name) {
page = page-1;
switch (typeCode){
case "AG":
typeCode = "FB";
@@ -127,53 +123,104 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
throw new MsgException("身份错误");
}
// PageInfo<MerchantProfitVO> teamList= merchantProfitMapper.getTeamList(typeCode, userId, page,size,name);
// PageInfo<MerchantProfitVO> teamList= merchantProfitMapper.getTeamList(typeCode, userId, page,size,name);
Integer countChild = merchantProfitMapper.getCountChild(userId, typeCode);
Integer pagerSize = size;
Integer offset = (page - 1) * size;
//商户列表
if ("MC".equals(typeCode)) {
List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId,name);
List<MerchantProfitVO> teamList = merchantProfitMapper.getMerchantTeamList(typeCode, userId, name, pagerSize, offset);
for (MerchantProfitVO values : teamList) {
List<MerChannelStatusVO> list = new ArrayList<>();
if (values.getMerchantCode() != null) {
String merchantCode = values.getMerchantCode();
List<MerchantChannelStatus> channelStatus = merchantProfitMapper.getChannelStatus(merchantCode);
if (channelStatus != null) {
for (MerchantChannelStatus valuesStatus : channelStatus) {
if ("D1".equals(valuesStatus.getVirChannelFlag())) {
values.setStatusD1(valuesStatus.getStatus());
values.setRemarkD1(valuesStatus.getStatus());
values.setAuthorizationStatus(valuesStatus.getAuthorizationStatus());
}
if ("D0".equals(valuesStatus.getVirChannelFlag())) {
values.setStatusD0(valuesStatus.getStatus());
values.setRemarkD0(valuesStatus.getStatus());
}
}
}
Integer countUser = mapperOrderMapper.getCountUser(Long.valueOf(values.getUserId()));
if (countUser > 0) {
values.setCountNum(countUser);
values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
values.setYestedayConsumeFee(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
DateUtils.getBeginDayOfYesterday(), DateUtils.getEndDayOfYesterDay()));
}
MerChannelStatusVO V0 = new MerChannelStatusVO();
V0.setStatus("1");
V0.setVirChannelFlag("D1");
V0.setAuthorizationStatus("0");
V0.setRemark("");
list.add(V0);
MerChannelStatusVO V1 = new MerChannelStatusVO();
V1.setStatus("1");
V1.setVirChannelFlag("D0");
V1.setAuthorizationStatus("0");
V1.setRemark("");
list.add(V1);
values.setChannelStatus(list);
continue;
}
}
String merchantCode = values.getMerchantCode();
List<MerChannelStatusVO> channelStatus = merchantProfitMapper.getChannelStatus(merchantCode);
//没有
if (ObjectUtil.isEmpty(channelStatus) || channelStatus.size() <= 0) {
MerChannelStatusVO V0 = new MerChannelStatusVO();
V0.setStatus("1");
V0.setVirChannelFlag("D1");
V0.setAuthorizationStatus("0");
V0.setRemark("");
list.add(V0);
MerChannelStatusVO V1 = new MerChannelStatusVO();
V1.setStatus("1");
V1.setVirChannelFlag("D0");
V1.setAuthorizationStatus("0");
V1.setRemark("");
list.add(V1);
values.setChannelStatus(list);
continue;
}
//一个
if (channelStatus.size() == 1) {
MerChannelStatusVO channelStatus1 = channelStatus.get(0);
switch (channelStatus1.getVirChannelFlag()) {
case "D0":
list.add(channelStatus1);
MerChannelStatusVO V1 = new MerChannelStatusVO();
V1.setStatus("1");
V1.setVirChannelFlag("D1");
V1.setAuthorizationStatus("0");
V1.setRemark("");
list.add(V1);
values.setChannelStatus(list);
break;
case "D1":
list.add(channelStatus1);
MerChannelStatusVO V0 = new MerChannelStatusVO();
V0.setStatus("1");
V0.setVirChannelFlag("D0");
V0.setAuthorizationStatus("0");
V0.setRemark("");
list.add(V0);
values.setChannelStatus(list);
break;
teamList = teamList.stream().skip(page * size).limit(size).collect(Collectors.toList());
}
continue;
}
//两个
if (channelStatus.size() == 2) {
values.setChannelStatus(channelStatus);
continue;
}
// Integer countUser = mapperOrderMapper.getCountUser(Long.valueOf(values.getUserId()));
// if (countUser > 0) {
// values.setCountNum(countUser);
// values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
// values.setYestedayConsumeFee(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
// DateUtils.getBeginDayOfYesterday(), DateUtils.getEndDayOfYesterDay()));
// }
}
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("total", countChild);
hashMap.put("teamList", teamList);
return hashMap;
}
//团队管理
List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId,name);
List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId, name, pagerSize, offset);
for (MerchantProfitVO values : teamList) {
values.setCurrentMonth(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
DateUtils.getBeginDayOfMonth(), DateUtils.getEndDayOfMonth()));
values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
}
teamList = teamList.stream().skip(page * size).limit(size).collect(Collectors.toList());
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("total", countChild);
hashMap.put("teamList", teamList);