推广部分大改
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.pluss.platform.app;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -21,4 +22,6 @@ public interface MainPageService {
|
||||
* @return 推广数据
|
||||
*/
|
||||
Map<String, Object> getSpreadData(String userId);
|
||||
|
||||
void modifyFee(Long userId, Integer id, BigDecimal fee);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -93,6 +94,12 @@ public class AgentStaffMainPageServiceImpl implements MainPageService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyFee(Long userId, Integer id, BigDecimal fee) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getHomeData(String userId) {
|
||||
return null;
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package cn.pluss.platform.app.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.pluss.platform.app.MainPageService;
|
||||
import cn.pluss.platform.entity.MerchantOrderStatistics;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.entity.UserPromotion;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.mapper.MerchantProfitMapper;
|
||||
import cn.pluss.platform.mapper.UserPromotionMapper;
|
||||
import cn.pluss.platform.merchantOrder.MerchantOrderStatisticsService;
|
||||
import cn.pluss.platform.merchantProfit.MerchantProfitService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.DateUtils;
|
||||
import cn.pluss.platform.util.N;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.MerchantOrderStatisticsVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -17,11 +22,15 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.baomidou.mybatisplus.core.toolkit.StringPool.N;
|
||||
|
||||
/**
|
||||
* 推广者的主页面信息查询实现类
|
||||
*/
|
||||
@@ -36,6 +45,10 @@ public class PromoterMainPageServiceImpl implements MainPageService {
|
||||
@Autowired
|
||||
@Lazy
|
||||
private MerchantOrderStatisticsService mosService;
|
||||
@Resource
|
||||
private MerchantProfitMapper merchantProfitMapper;
|
||||
@Resource
|
||||
private UserPromotionMapper userPromotionMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSpreadData(String userId) {
|
||||
@@ -63,7 +76,7 @@ public class PromoterMainPageServiceImpl implements MainPageService {
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("userId", userId);
|
||||
queryMap.put("status", 1);
|
||||
// 累计总分润
|
||||
// 累计总收益
|
||||
promoteFee = merchantProfitService.queryMerchantProfitSumPrice(queryMap);
|
||||
if (promoteFee == null) {
|
||||
promoteFee = 0d;
|
||||
@@ -74,6 +87,8 @@ public class PromoterMainPageServiceImpl implements MainPageService {
|
||||
queryMap.put("retype", "1");
|
||||
totalOrderCount = merchantProfitService.queryMerchantProfitPageCount(queryMap);
|
||||
todayProfit = merchantProfitService.queryMerchantProfitSumPrice(queryMap);
|
||||
//今日收益
|
||||
BigDecimal todaySum = merchantProfitMapper.getTodaySum(userId);
|
||||
|
||||
//今日新增商户数
|
||||
QueryWrapper<UserApp> queryWrapper = new QueryWrapper<>();
|
||||
@@ -81,11 +96,26 @@ public class PromoterMainPageServiceImpl implements MainPageService {
|
||||
queryWrapper.in("merchantAuditStatus", 3, 4);
|
||||
queryWrapper.between("createDt", DateUtils.getDayBegin(), DateUtils.getDayEnd());
|
||||
Integer newMerchantCount = userAppService.getUserAppWithChannelStatus(queryWrapper);
|
||||
//直属商户交易
|
||||
BigDecimal consumeFee = merchantProfitMapper.getConsumeFee(userId);
|
||||
//团队商户交易
|
||||
BigDecimal consumeFeeTeam = merchantProfitMapper.getConsumeFeeTeam(userId);
|
||||
//今日收款
|
||||
BigDecimal consumeFeeTeamToday = merchantProfitMapper.getConsumeFeeTeamToday(userId);
|
||||
//总商户数
|
||||
Integer countChildAll = merchantProfitMapper.getCountChild(Long.valueOf(userId), "MC");
|
||||
|
||||
resultMap.put("promoteFee", promoteFee + "");
|
||||
resultMap.put("totalOrderCount", totalOrderCount + "");
|
||||
resultMap.put("newMerchantCount", newMerchantCount + "");
|
||||
resultMap.put("todayProfit", todayProfit == null? "0.00": todayProfit + "");
|
||||
|
||||
resultMap.put("todaySum", todaySum);
|
||||
resultMap.put("consumeFee", consumeFee);
|
||||
resultMap.put("consumeFeeTeam", consumeFeeTeam);
|
||||
resultMap.put("consumeFeeTeamToday", consumeFeeTeamToday);
|
||||
resultMap.put("countChildAll", countChildAll);
|
||||
|
||||
String currentMonth = DateUtil.format(new Date(), "yyyy-MM");
|
||||
|
||||
MerchantOrderStatistics directTotalCurrentMonth = mosService.getDirectTotal(queryUserApp.getUserId() + "", currentMonth);
|
||||
@@ -107,6 +137,69 @@ public class PromoterMainPageServiceImpl implements MainPageService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyFee(Long userId, Integer id, BigDecimal fee) {
|
||||
QueryWrapper<UserPromotion> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",id);
|
||||
UserPromotion promotion = userPromotionMapper.selectOne(queryWrapper);
|
||||
if(ObjectUtil.isEmpty(promotion)){
|
||||
throw new MsgException("费率信息不存在");
|
||||
}
|
||||
UserPromotion userPromotion = userPromotionMapper.selectByPrimaryKey(userId);
|
||||
if(ObjectUtil.isEmpty(userPromotion)){
|
||||
throw new MsgException("父级机构信息异常");
|
||||
}
|
||||
|
||||
Boolean flag=true;
|
||||
switch (userPromotion.getTypeCode()){
|
||||
case "MG":
|
||||
if(promotion.getTypeCode().equals("FO")){
|
||||
flag=false;
|
||||
}
|
||||
break;
|
||||
case "FO":
|
||||
if(promotion.getTypeCode().equals("SO")){
|
||||
flag=false;
|
||||
}
|
||||
break;
|
||||
case "SO" :
|
||||
if(promotion.getTypeCode().equals("AG")){
|
||||
flag=false;
|
||||
}
|
||||
break;
|
||||
case "AG":
|
||||
if(promotion.getTypeCode().equals("FB")){
|
||||
flag=false;
|
||||
}
|
||||
break;
|
||||
case "FB":
|
||||
if(promotion.getTypeCode().equals("SB")){
|
||||
flag=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(flag){
|
||||
throw new MsgException("当前用户权限不足");
|
||||
}
|
||||
|
||||
if(cn.pluss.platform.util.N.gt(new BigDecimal(userPromotion.getCurrentFee()),fee)){
|
||||
throw new MsgException("修改费率不允许小于上级费率");
|
||||
}
|
||||
|
||||
BigDecimal lowFee=userPromotionMapper.selectMaxFeeByUserId(id.toString());
|
||||
if(ObjectUtil.isNotEmpty(lowFee)&&cn.pluss.platform.util.N.gt(fee,lowFee)){
|
||||
throw new MsgException("修改费率不允许小于下级最大费率");
|
||||
}
|
||||
|
||||
promotion.setCurrentFee(String.valueOf(fee));
|
||||
promotion.setUpdateTime(new Date());
|
||||
int i = userPromotionMapper.updateByPrimaryKey(promotion);
|
||||
if (i < 1){
|
||||
throw new MsgException("修改失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getHomeData(String userId) {
|
||||
return null;
|
||||
|
||||
@@ -1178,7 +1178,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
UserApp ua = uaService.getOne(new LambdaQueryWrapper<UserApp>().eq(UserApp::getUserId, bankCardDTO.getUserId()));
|
||||
|
||||
MerchantChannelStatus mcs = mcsService.getByMerchantCodeAndChannelType(ua.getMerchantCode(), bankCardDTO.getChannelType());
|
||||
MerchantChannelStatus mcs = mcsService.getByMerchantCodeAndChannelTypeNew(ua.getMerchantCode(), bankCardDTO.getChannelType());
|
||||
|
||||
MsgException.checkNull(mcs, "商户还未进件");
|
||||
|
||||
|
||||
@@ -38,6 +38,14 @@ public interface MerchantChannelStatusService extends IService<MerchantChannelSt
|
||||
|
||||
return getOne(qWrapper);
|
||||
}
|
||||
default MerchantChannelStatus getByMerchantCodeAndChannelTypeNew(String merchantCode, String channelType) {
|
||||
LambdaQueryWrapper<MerchantChannelStatus> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.eq(MerchantChannelStatus::getVirChannelFlag, channelType);
|
||||
qWrapper.eq(MerchantChannelStatus::getMerchantCode, merchantCode);
|
||||
qWrapper.eq(MerchantChannelStatus::getStatus,3);
|
||||
|
||||
return getOne(qWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进件请求前参数校验
|
||||
|
||||
@@ -565,6 +565,26 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
|
||||
// 手续费
|
||||
BigDecimal totalCommission = getTotalCommission(totalConsumeFee, totalRefundConsumeFee, totalEnterFee);
|
||||
|
||||
|
||||
//日账单
|
||||
HashMap<String, Object> mapToday = new HashMap<>();
|
||||
mapToday.put("startTime", DateUtils.getDayBegin());
|
||||
mapToday.put("endTime", DateUtils.getDayEnd());
|
||||
mapToday.put("merchantCode", merchantOrder.getMerchantCode());
|
||||
BigDecimal today = merchantOrderMapper.queryMerchantOrderMoneyByTime(mapToday);
|
||||
//周账单
|
||||
HashMap<String, Object> mapWeek = new HashMap<>();
|
||||
mapWeek.put("startTime", DateUtils.getBeginDayOfWeek());
|
||||
mapWeek.put("endTime", DateUtils.getEndDayOfWeek());
|
||||
mapWeek.put("merchantCode", merchantOrder.getMerchantCode());
|
||||
BigDecimal week = merchantOrderMapper.queryMerchantOrderMoneyByTime(mapWeek);
|
||||
//月账单
|
||||
HashMap<String, Object> mapMonth = new HashMap<>();
|
||||
mapMonth.put("startTime", DateUtils.getBeginDayOfMonth());
|
||||
mapMonth.put("endTime", DateUtils.getEndDayOfMonth());
|
||||
mapMonth.put("merchantCode", merchantOrder.getMerchantCode());
|
||||
BigDecimal month = merchantOrderMapper.queryMerchantOrderMoneyByTime(mapMonth);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("orderNum", consumeCount == null ? 0 : consumeCount);
|
||||
resultMap.put("returnOrderNum", refundCount == null ? 0 : refundCount);
|
||||
@@ -573,6 +593,9 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
|
||||
resultMap.put("totalReceiveFee", totalConsumeFee);
|
||||
resultMap.put("commission", totalCommission);
|
||||
resultMap.put("returnMoney", totalRefundConsumeFee);
|
||||
resultMap.put("today", today);
|
||||
resultMap.put("week", week);
|
||||
resultMap.put("month",month);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ import cn.pluss.platform.entity.MerchantOrder;
|
||||
import cn.pluss.platform.entity.MerchantProfit;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.mapper.MerchantProfitMapper;
|
||||
import cn.pluss.platform.vo.MerchantProfitVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
@@ -89,5 +91,9 @@ public interface MerchantProfitService extends IService<MerchantProfit> {
|
||||
* @param orderNumber
|
||||
*/
|
||||
void sendProfitMessage(UserApp userApp, BigDecimal profitMoney, String orderNumber);
|
||||
|
||||
Map<String, Object> teamList(String typeCode, Long userId, Integer page,Integer size,String name);
|
||||
|
||||
Map<String, Object> merchantListData(Long userId);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.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;
|
||||
@@ -52,6 +53,10 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
|
||||
@Autowired
|
||||
private UserAssessService userAssessService;
|
||||
@Resource
|
||||
private MerchantProfitMapper merchantProfitMapper;
|
||||
@Resource
|
||||
private MerchantOrderMapper mapperOrderMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = RuntimeException.class, propagation = Propagation.NESTED)
|
||||
@@ -100,6 +105,80 @@ 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";
|
||||
break;
|
||||
case "FB":
|
||||
typeCode = "SB";
|
||||
break;
|
||||
case "SB":
|
||||
typeCode = "";
|
||||
break;
|
||||
case "MC":
|
||||
break;
|
||||
default:
|
||||
throw new MsgException("身份错误");
|
||||
}
|
||||
List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId, page,size,name);
|
||||
|
||||
|
||||
Integer countChild = merchantProfitMapper.getCountChild(userId, typeCode);
|
||||
//商户列表
|
||||
if ("MC".equals(typeCode)) {
|
||||
for (MerchantProfitVO values : teamList) {
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("total", countChild);
|
||||
hashMap.put("teamList", teamList);
|
||||
return hashMap;
|
||||
}
|
||||
//团队管理
|
||||
for (MerchantProfitVO values : teamList) {
|
||||
values.setYestedayConsumeFee(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
|
||||
DateUtils.getBeginDayOfMonth(), DateUtils.getEndDayOfMonth()));
|
||||
values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
|
||||
}
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("total", countChild);
|
||||
hashMap.put("teamList", teamList);
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> merchantListData(Long userId) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分润创建2.0模式
|
||||
*
|
||||
|
||||
@@ -242,7 +242,7 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
|
||||
long pageSize = ((Integer) map.get("pageSize")).longValue();
|
||||
Page<UserInfoVO> pageResult = new Page<>(page, pageSize);
|
||||
pageResult.setRecords(result);
|
||||
Long count = baseMapper.queryUserAppPageCount(map).longValue();
|
||||
Long count = baseMapper.queryUserPageCount(map).longValue();
|
||||
pageResult.setTotal(count);
|
||||
|
||||
if (result.isEmpty()) {
|
||||
|
||||
@@ -352,21 +352,10 @@ public abstract class BaseUserInfoService extends ServiceImpl<UserInfoMapper, Us
|
||||
|
||||
MsgException.checkNull(checkUserInfo, "无此用户!");
|
||||
|
||||
QueryWrapper<UserPromotion> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", checkUserInfo.getId());
|
||||
UserPromotion promotion= userPromotionMapper.selectOne(queryWrapper);
|
||||
if(ObjectUtil.isEmpty(promotion)){
|
||||
MsgException.checkNull(null,"用户状态错误");
|
||||
}
|
||||
|
||||
if("MG".equals(promotion.getTypeCode())||"FO".equals(promotion.getTypeCode())||"SO".equals(promotion.getTypeCode())){
|
||||
MsgException.checkNull(null,"此用户不允许登录");
|
||||
}
|
||||
// 原则上不能以原密码进行对比,这里只是给后台登录页面一个方便
|
||||
if (password.equalsIgnoreCase(checkUserInfo.getPassword())) {
|
||||
UserApp queryUserApp;
|
||||
queryUserApp = userAppMapper.selectUserApp(new QueryWrapper<>().eq("ua.userId", checkUserInfo.getId()));
|
||||
log.error("=====================queryUserApp=====================" + JSON.toJSONString(queryUserApp));
|
||||
String genRandomNum = StringUtil.genRandomNum(6) + StringUtil.getBillno() + StringUtil.genRandomNum(6);
|
||||
UserApp uApp = new UserApp();
|
||||
uApp.setToken(genRandomNum);
|
||||
@@ -396,6 +385,19 @@ public abstract class BaseUserInfoService extends ServiceImpl<UserInfoMapper, Us
|
||||
UserApp queryUserApp = new UserApp().setUserId(checkUserInfo.getId());
|
||||
queryUserApp = userAppMapper.selectOne(new QueryWrapper<>(queryUserApp));
|
||||
|
||||
if ("promoter".equals(queryUserApp.getUserType())){
|
||||
QueryWrapper<UserPromotion> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", checkUserInfo.getId());
|
||||
UserPromotion promotion= userPromotionMapper.selectOne(queryWrapper);
|
||||
if(ObjectUtil.isEmpty(promotion)){
|
||||
MsgException.checkNull(null,"用户状态错误");
|
||||
}
|
||||
|
||||
if("MG".equals(promotion.getTypeCode())||"FO".equals(promotion.getTypeCode())||"SO".equals(promotion.getTypeCode())){
|
||||
MsgException.checkNull(null,"此用户不允许登录");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 去掉该用户只能登录一个设备
|
||||
//String genRandomNum = StringUtil.genRandomNum(6) + StringUtil.getBillno() + StringUtil.genRandomNum(6);
|
||||
String genRandomNum = loginName;
|
||||
|
||||
Reference in New Issue
Block a user