This commit is contained in:
yangjun 2024-08-06 19:45:24 +08:00
commit b8a41972fe
18 changed files with 777 additions and 340 deletions

View File

@ -69,8 +69,6 @@ public class AppUserMoneyController {
return userMoneyService.payUserMoneyArtificer(userId, artificerId, money);
}
@GetMapping("/selectMyMoney")
@Login
@ApiOperation("我的钱包余额")
@ -92,6 +90,7 @@ public class AppUserMoneyController {
period.setStartFundData(periodDate.getStartFundData());
// period.setEndFundData(CurrentPeriod);
period.setEndFundData(periodDate.getEndFundData());
period.setFundType(2);//技师
List<UserMoneyDetails> filteredPersons = userMoneyDetailsService.selectIncome(period);
//进账
double incomeLong= filteredPersons.stream()

View File

@ -43,9 +43,9 @@ public class UserMoneyDetails implements Serializable {
@ApiModelProperty("标题")
private String title;
/**
* 1注册 2购买 4提现
* 1注册 2购买 3提现 4充值 5打赏
*/
@ApiModelProperty("1注册 2购买 3提现 7商家 8指定钱包")
@ApiModelProperty("1注册 2购买 3提现 4充值 5打赏")
private Integer classify;
/**
* 类型
@ -88,9 +88,8 @@ public class UserMoneyDetails implements Serializable {
private Long artificerId;
/**
* 所属角色 1用户 2技师
* 所属角色 1用户 2技师 3商家 4经纪人 5分销商 6业务员 7代理
*/
private Integer blRole;
/**

View File

@ -329,12 +329,44 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
fundDetailsResult.setEndFundData(period.getEndFundData());
return Result.success().put("data", fundDetailsResult);
}
@Override
public List<UserMoneyDetails> selectIncome(Period period) {
QueryWrapper<UserMoneyDetails> queryWrapper = new QueryWrapper();
queryWrapper.eq("user_id", period.getArtificerId());
if(period.getFundType()!=null){
switch (period.getDetailsType()){
case 1:
queryWrapper.eq("bl_role", 1);//用户
break;
case 2:
queryWrapper.eq("bl_role", 2);//技师
break;
case 3:
queryWrapper.eq("bl_role", 3);//商家
break;
case 4:
queryWrapper.eq("bl_role", 4);//经纪人
break;
case 5:
queryWrapper.eq("bl_role", 5);//分销员
break;
case 6:
queryWrapper.eq("bl_role", 6);//业务员
break;
case 7:
queryWrapper.eq("bl_role", 7);//代理
break;
}
}
// if(StringUtil.isNotEmpty(period.getStartFundData().toString())){
// queryWrapper.between("create_time", period.getStartFundData(), period.getEndFundData());
// }
if(StringUtil.isNotEmpty(period.getStartFundData().toString())){
queryWrapper.between("create_time", period.getStartFundData(), period.getEndFundData());
queryWrapper.ge("create_time", period.getStartFundData());
}
if(StringUtil.isNotEmpty(period.getEndFundData().toString())){
queryWrapper.le("create_time", period.getEndFundData());
}
if(period.getDetailsType()!= null){
//方便前端判断 传1则查询全部 2查询收入 3查询支出

View File

@ -608,5 +608,18 @@ public class Orders implements Serializable {
@TableField(exist = false)
private String zxsc;
/**
* 经纪人分佣
*/
private BigDecimal jjrMoney;
/**
* 经纪人ID
*/
private Long jjrUserId;
/**
* 经纪人姓名
*/
private String jjrUserName;
public Orders() {}
}

View File

@ -73,14 +73,14 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//当期收益
// String earnings = ordersDao.earnings(artificerId, endDate, startDate);
BigDecimal earnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endDate, startDate);
earnings = earnings.setScale(0,BigDecimal.ROUND_DOWN);
earnings = earnings.setScale(2,BigDecimal.ROUND_HALF_UP);
orders.setEarnings(earnings.toString());
//当日收益
String todayEndIncome = DateUtil.formatDateTime(DateUtil.endOfDay(new Date()));
// String dailyEarnings = ordersDao.earnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
BigDecimal dailyEarnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
dailyEarnings = dailyEarnings.setScale(0,BigDecimal.ROUND_DOWN);
dailyEarnings = dailyEarnings.setScale(2,BigDecimal.ROUND_HALF_UP);
orders.setDailyEarnings(dailyEarnings.toString());
//当月收益
@ -89,7 +89,7 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
String endFundDataformat = DateUtil.formatDateTime(DateUtil.endOfMonth(new Date()));
// String currentMonthsIncome = ordersDao.earnings(artificerId, endFundDataformat, startFundDataformat);
BigDecimal currentMonthsIncome = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endFundDataformat, startFundDataformat);
currentMonthsIncome = currentMonthsIncome.setScale(0,BigDecimal.ROUND_DOWN);
currentMonthsIncome = currentMonthsIncome.setScale(2,BigDecimal.ROUND_HALF_UP);
orders.setCurrentMonthsIncome(currentMonthsIncome.toString());
//当期结束日
@ -130,13 +130,13 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//充值率
BigDecimal divide1 = null;
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
orders.setCurrentPeriodAddBellsSum(clockRate.toString());
//当前周期充值率(本周期内充值订单数/本单数)
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endDate, startDate,1);
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
orders.setCurrentPeriodRechargeSum(divide1.toString());
} else {
clockRate = new BigDecimal("0");
@ -295,7 +295,7 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//当前一周期业绩
BigDecimal currentPerformance = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, date, cycleTime);
currentPerformance = currentPerformance.setScale(0,BigDecimal.ROUND_DOWN);
currentPerformance = currentPerformance.setScale(2,BigDecimal.ROUND_HALF_UP);
//当前一周期储值积分数
String storedValueIntegral = ordersDao.selectOrdersStoredValueIntegral(artificerId, date, cycleTime);
@ -320,11 +320,11 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//充值率
BigDecimal divide1 = null;
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
//当前周期充值率(本周期内充值订单数/本单数)
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, date, cycleTime,1);
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
} else {
clockRate = new BigDecimal("0");
divide1 = new BigDecimal("0");
@ -405,7 +405,7 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//当前一周期业绩
BigDecimal currentPerformance = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, date, cycleTime);
currentPerformance = currentPerformance.setScale(0,BigDecimal.ROUND_DOWN);
currentPerformance = currentPerformance.setScale(2,BigDecimal.ROUND_HALF_UP);
//当前一周期储值积分数
String storedValueIntegral = ordersDao.selectOrdersStoredValueIntegral(artificerId, date, cycleTime);
@ -430,11 +430,11 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//充值率
BigDecimal divide1 = null;
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
//当前周期充值率(本周期内充值订单数/本单数)
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, date, cycleTime,1);
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
} else {
clockRate = new BigDecimal("0");
divide1 = new BigDecimal("0");

View File

@ -714,7 +714,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
// ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
ordersIPage = ordersDao.selectDividedIntoDetails(pages, userId,startTime,endTime,null);
BigDecimal yeji = ordersDao.selectOrdersArtificerIntegralEarnings(userId, endTime, startTime);
yeji = yeji.setScale(0,BigDecimal.ROUND_DOWN);
yeji = yeji.setScale(2,BigDecimal.ROUND_HALF_UP);
earnings = yeji.toString();
}else if(orderType == 2){//2加钟
//查询列表
@ -724,7 +724,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
String jzl = ordersDao.selectOrdersArtificerIntegraladdNum(userId, endTime, startTime);
//加钟数
BigDecimal num = new BigDecimal(jzl);
BigDecimal clockRate = num.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
BigDecimal clockRate = num.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
clockRate = clockRate.multiply(cy100);
earnings = clockRate.intValue()+"%";
System.out.println(currentPeriodOrdersSumBig+"=========="+num+"---"+clockRate);
@ -733,7 +733,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
//当前周期充值率(本周期内充值订单数/本单数)
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(userId, endTime, startTime,1);
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
BigDecimal divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
BigDecimal divide1 = c.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);
divide1 = divide1.multiply(cy100);
earnings = divide1.intValue()+"%";
System.out.println(currentPeriodOrdersSumBig+"=========="+c+"---"+divide1);

View File

@ -1,14 +1,19 @@
package com.sqx.modules.bl.commission.jjr.controller.app;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.bl.commission.jjr.entity.JjrApply;
import com.sqx.modules.bl.commission.jjr.entity.JjrConfig;
import com.sqx.modules.bl.commission.jjr.entity.JjrData;
import com.sqx.modules.bl.commission.jjr.service.JjrApplyService;
import com.sqx.modules.bl.commission.jjr.service.JjrConfigService;
import com.sqx.modules.bl.commission.jjr.service.JjrDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -23,13 +28,78 @@ public class AppJjrController {
@Autowired
private JjrApplyService applyService;
@Autowired
private JjrDataService dataService;
@Autowired
private JjrConfigService configService;
@Login
@GetMapping("/apply")
@ApiOperation("申请经纪人")
public Result apply(JjrApply jjrApply){
public Result apply(@RequestAttribute Long userId, String name, String phone, String remarks){
JjrApply jjrApply = new JjrApply();
jjrApply.setUserId(userId);
jjrApply.setName(name);
jjrApply.setPhone(phone);
jjrApply.setRemarks(remarks);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
jjrApply.setCreateTime(sdf.format(new Date()));
applyService.add(jjrApply);
return Result.success();
}
/**
* 可提现累计佣金已提现未入账今日成交订单累计成交订单今日新增技师累计入驻技师
*/
@Login
@GetMapping("/myJjr")
@ApiOperation("我是经纪人")
public Result myJjr(@RequestAttribute Long userId){
return dataService.myJjr(userId);
}
/**
* 我的收益-收益明细
*/
@Login
@GetMapping("/incomeDetail")
@ApiOperation("我的收益")
public Result incomeDetail(@RequestAttribute Long userId, Integer page, Integer limit){
return dataService.incomeDetail(userId,page,limit);
}
/**
* 提现记录-提现明细
*/
@Login
@GetMapping("/withdrawalDetail")
@ApiOperation("我的提现")
public Result withdrawalDetail(@RequestAttribute Long userId, Integer page, Integer limit){
return dataService.withdrawalDetail(userId,page,limit);
}
/**
* 我的邀请-邀请技师明细
*/
@Login
@GetMapping("/artificerDetail")
@ApiOperation("我邀请的技师")
public Result artificerDetail(@RequestAttribute Long userId, Integer page, Integer limit){
JjrData jjrData = dataService.getByUserId(userId);
jjrData.setPage(page);
jjrData.setLimit(limit);
return dataService.invitationArtificerPage(jjrData);
}
/**
* 邀请海报
*/
@GetMapping("/poster")
@ApiOperation("经纪人邀请海报")
public Result poster(){
JjrConfig entity = configService.getOne(new QueryWrapper<JjrConfig>());
return Result.success().put("data",entity);
}
}

View File

@ -19,4 +19,7 @@ public interface JjrDataDao extends BaseMapper<JjrData> {
void cancelInvitation(JjrData jjrData);
JjrData getByCode(String invitationCode);
void modifyJjr(JjrData jjrData);
JjrData findJjr(JjrData jjrData);
JjrData getByUserId(Long userId);
}

View File

@ -76,6 +76,11 @@ public class JjrData implements Serializable {
*/
@TableField(exist = false)
private Integer status;
/**
*创建时间
*/
@TableField(exist = false)
private String createTime;
/**
*累计邀请技师
*/
@ -86,6 +91,16 @@ public class JjrData implements Serializable {
*/
@TableField(exist = false)
private Integer ordersCount;
/**
*累计邀请技师
*/
@TableField(exist = false)
private Integer curArtificerCount;
/**
*累计成交订单数量
*/
@TableField(exist = false)
private Integer curOrdersCount;
/**
*累计获得佣金
*/

View File

@ -12,4 +12,9 @@ public interface JjrDataService extends IService<JjrData> {
void cancelInvitation(JjrData jjrData);
JjrData getByCode(String invitationCode);
void modifyJjr(JjrData jjrData);
Result myJjr(Long userId);
Result incomeDetail(Long userId,Integer page, Integer limit);
Result withdrawalDetail(Long userId,Integer page, Integer limit);
JjrData getByUserId(Long userId);
}

View File

@ -5,22 +5,33 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.app.service.UserMoneyDetailsService;
import com.sqx.modules.artificer.entity.Orders;
import com.sqx.modules.artificer.entity.Period;
import com.sqx.modules.bl.commission.jjr.dao.JjrDataDao;
import com.sqx.modules.bl.commission.jjr.entity.JjrApply;
import com.sqx.modules.bl.commission.jjr.entity.JjrConfig;
import com.sqx.modules.bl.commission.jjr.entity.JjrData;
import com.sqx.modules.bl.commission.jjr.service.JjrConfigService;
import com.sqx.modules.bl.commission.jjr.service.JjrDataService;
import com.sqx.modules.utils.PeriodUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class JjrDataServiceImpl extends ServiceImpl<JjrDataDao, JjrData> implements JjrDataService {
@Autowired
private JjrConfigService configService;
@Autowired
private UserMoneyDetailsService userMoneyDetailsService;
@Override
public Result findPage(JjrData jjrData){
@ -64,4 +75,106 @@ public class JjrDataServiceImpl extends ServiceImpl<JjrDataDao, JjrData> impleme
jjrData.setRate(rate);
baseMapper.modifyJjr(jjrData);
}
@Override
public Result myJjr(Long userId){
Map<String,Object> result=new HashMap<>();
//可提现
Date CurrentPeriod = new Date();//获取当前时间
//获取当前时间周期的上一个周期
Period periodDate= PeriodUtil.previousIssue(CurrentPeriod);
Period period = new Period();
period.setArtificerId(String.valueOf(userId));
period.setDetailsType(1);
period.setEndFundData(periodDate.getEndFundData());
period.setFundType(4);//经纪人
List<UserMoneyDetails> filteredPersons = userMoneyDetailsService.selectIncome(period);
//进账
double incomeLong= filteredPersons.stream()
.filter(UserMoneyDetails -> UserMoneyDetails.getType() == 1)
.filter(UserMoneyDetails -> UserMoneyDetails.getState() == 2)
.mapToDouble(UserMoneyDetails -> UserMoneyDetails.getMoney().doubleValue())
.sum();
//出账
double outgoingLong= filteredPersons.stream()
.filter(UserMoneyDetails -> UserMoneyDetails.getType() == 2)
.filter(UserMoneyDetails -> UserMoneyDetails.getState() == 2)
.filter(UserMoneyDetails -> !UserMoneyDetails.getContent().contains("管理端减少"))
.mapToDouble(UserMoneyDetails -> UserMoneyDetails.getMoney().doubleValue())
.sum();
BigDecimal incomeMoney= BigDecimal.valueOf(incomeLong).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal outgoingMoney = BigDecimal.valueOf(outgoingLong).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal withdrawableAmount = incomeMoney.subtract(outgoingMoney).setScale(2,BigDecimal.ROUND_HALF_UP);
result.put("withdrawableAmount",withdrawableAmount);//可提现金额
//累计佣金
Period period2 = new Period();
period2.setArtificerId(String.valueOf(userId));
period2.setDetailsType(1);
period2.setFundType(4);//经纪人
List<UserMoneyDetails> filteredPersons2 = userMoneyDetailsService.selectIncome(period2);
double income= filteredPersons2.stream()
.filter(UserMoneyDetails -> UserMoneyDetails.getType() == 1)
.filter(UserMoneyDetails -> UserMoneyDetails.getState() == 2)
.mapToDouble(UserMoneyDetails -> UserMoneyDetails.getMoney().doubleValue())
.sum();
result.put("income",income);//累计佣金
//已提现金额
double withdrawal= filteredPersons2.stream()
.filter(UserMoneyDetails -> UserMoneyDetails.getType() == 2)
.filter(UserMoneyDetails -> UserMoneyDetails.getState() == 2)
.filter(UserMoneyDetails -> UserMoneyDetails.getClassify() == 3)
.mapToDouble(UserMoneyDetails -> UserMoneyDetails.getMoney().doubleValue())
.sum();
result.put("withdrawal",withdrawal);//已提现金额
double notCredited = filteredPersons2.stream()
.filter(UserMoneyDetails -> UserMoneyDetails.getType() == 1)
.filter(UserMoneyDetails -> UserMoneyDetails.getState() == 1)
.mapToDouble(UserMoneyDetails -> UserMoneyDetails.getMoney().doubleValue())
.sum();
result.put("notCredited",notCredited);//未入账
JjrData jjrData = new JjrData();
jjrData.setUserId(userId);
jjrData = baseMapper.findJjr(jjrData);
result.put("curOrdersCount",jjrData.getCurOrdersCount());//今日成交订单
result.put("ordersCount",jjrData.getOrdersCount());//累计成交订单
result.put("curArtificerCount",jjrData.getCurArtificerCount());//今日新增技师
result.put("artificerCount",jjrData.getArtificerCount());//累计入驻技师
return Result.success().put("data",result);
}
@Override
public Result incomeDetail(Long userId,Integer page, Integer limit){
QueryWrapper<UserMoneyDetails> queryWrapper = new QueryWrapper();
queryWrapper.eq("user_id", userId);
queryWrapper.eq("bl_role", 4);//经纪人
queryWrapper.eq("type", 1);
queryWrapper.eq("state", 2);
queryWrapper.eq("manipulate_type", 2);
queryWrapper.orderByDesc("create_time");
Page<UserMoneyDetails> pages = new Page<>(page, limit);
PageUtils pageUtils = new PageUtils(userMoneyDetailsService.page(pages,queryWrapper));
return Result.success().put("data", pageUtils);
}
@Override
public Result withdrawalDetail(Long userId,Integer page, Integer limit){
QueryWrapper<UserMoneyDetails> queryWrapper = new QueryWrapper();
queryWrapper.eq("user_id", userId);
queryWrapper.eq("classify", 3);
queryWrapper.eq("type", 2);
queryWrapper.eq("state", 2);
queryWrapper.eq("bl_role", 4);//经纪人
queryWrapper.eq("manipulate_type", 2);
queryWrapper.orderByDesc("create_time");
Page<UserMoneyDetails> pages = new Page<>(page, limit);
PageUtils pageUtils = new PageUtils(userMoneyDetailsService.page(pages,queryWrapper));
return Result.success().put("data", pageUtils);
}
@Override
public JjrData getByUserId(Long userId){
return baseMapper.getByUserId(userId);
}
}

View File

@ -590,7 +590,7 @@ public class AliPayController {
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(0, BigDecimal.ROUND_UP);
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
@ -613,15 +613,15 @@ public class AliPayController {
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//储值扣费
valueStorageDeduction = artificerPrice.multiply(storageRate);//技师提成中扣除金额
valueStorageDeduction = valueStorageDeduction.setScale(0, BigDecimal.ROUND_UP);
valueStorageDeduction = valueStorageDeduction.setScale(2, BigDecimal.ROUND_HALF_UP);
orders.setValueStorageDeduction(valueStorageDeduction);
//用户收益不含交通费
artificerPrice = artificerPrice.multiply(rate);
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
// BigDecimal projectBenefits = orders.getProjectBenefits().multiply(rate);
// projectBenefits = projectBenefits.setScale(2, BigDecimal.ROUND_HALF_UP);
@ -629,15 +629,24 @@ public class AliPayController {
orders.setProjectBenefits(artificerPrice);
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// BigDecimal oneArtificerMoney = BigDecimal.ZERO;
// if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
// oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// }
// orders.setOneArtificerMoney(oneArtificerMoney);
UserEntity jjrUser = userService.queryByInvitationCode(artificerUser.getBlJjrCode());
BigDecimal jjrMoney = BigDecimal.ZERO;
if (jjrUser != null) {
orders.setJjrUserId(jjrUser.getUserId());
orders.setJjrUserName(jjrUser.getUserName());
jjrMoney = jjrMoney.multiply(jjrUser.getBlJjrRate());
jjrMoney = jjrMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setJjrMoney(jjrMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
@ -648,7 +657,7 @@ public class AliPayController {
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
@ -660,10 +669,11 @@ public class AliPayController {
orders.setOneUserId(oneUser.getUserId());
orders.setOneUserName(oneUser.getUserName());
oneUserMoney = artificerPrice.multiply(oneUser.getUserRate());
oneUserMoney = oneUserMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
oneUserMoney = oneUserMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(jjrMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
artificerPrice = artificerPrice.subtract(oneUserMoney);
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
@ -678,7 +688,8 @@ public class AliPayController {
BigDecimal pingMoney = orders.getPayMoney();
pingMoney = pingMoney.subtract(artificerPrice);
pingMoney = pingMoney.subtract(shopMoney);
pingMoney = pingMoney.subtract(oneArtificerMoney);
// pingMoney = pingMoney.subtract(oneArtificerMoney);
pingMoney = pingMoney.subtract(jjrMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
@ -760,7 +771,8 @@ public class AliPayController {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
// orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setJjrMoney(orders1.getJjrMoney().add(orders.getJjrMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
@ -916,7 +928,7 @@ public class AliPayController {
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
String[] couponIds = couponIssue.getCouponIds().split(",");
UserMoneyDetails userMoneyDetails=new UserMoneyDetails();
userMoneyDetails.setClassify(1);
userMoneyDetails.setClassify(2);
userMoneyDetails.setType(2);
userMoneyDetails.setState(2);
userMoneyDetails.setManipulateType(1);
@ -1032,7 +1044,7 @@ public class AliPayController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//用户流水
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
userMoneyDetails.setClassify(8);
userMoneyDetails.setClassify(5);
userMoneyDetails.setManipulateType(1);
userMoneyDetails.setUserId(payDetails.getUserId());
userMoneyDetails.setTitle("支付宝给技师打赏");
@ -1054,7 +1066,7 @@ public class AliPayController {
//插入余额
userMoneyDetails2.setBalance(userNowMoney.getMoney());
userMoneyDetails2.setManipulateType(2);
userMoneyDetails2.setClassify(8);
userMoneyDetails2.setClassify(5);
userMoneyDetails2.setUserId(userEntity.getUserId());
userMoneyDetails2.setTitle("用户支付宝打赏");
userMoneyDetails2.setContent("来自用户“"+userEntity.getUserName()+"”支付宝打赏:"+money);
@ -1536,15 +1548,24 @@ public class AliPayController {
orders.setProjectBenefits(artificerPrice);
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// BigDecimal oneArtificerMoney = BigDecimal.ZERO;
// if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
// oneArtificerMoney = oneArtificerMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
// }
// orders.setOneArtificerMoney(oneArtificerMoney);
UserEntity jjrUser = userService.queryByInvitationCode(artificerUser.getBlJjrCode());
BigDecimal jjrMoney = BigDecimal.ZERO;
if (jjrUser != null) {
orders.setJjrUserId(jjrUser.getUserId());
orders.setJjrUserName(jjrUser.getUserName());
jjrMoney = jjrMoney.multiply(jjrUser.getBlJjrRate());
jjrMoney = jjrMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setJjrMoney(jjrMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
@ -1560,8 +1581,20 @@ public class AliPayController {
}
}
orders.setShopMoney(shopMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
UserEntity user = userService.selectUserById(orders.getUserId());
UserEntity oneUser = userService.queryByInvitationCode(user.getInviterCode());
BigDecimal oneUserMoney = BigDecimal.ZERO;
if (oneUser != null && oneUser.getIsAgency() != null && oneUser.getIsAgency() == 1) {
orders.setOneUserId(oneUser.getUserId());
orders.setOneUserName(oneUser.getUserName());
oneUserMoney = artificerPrice.multiply(oneUser.getUserRate());
oneUserMoney = oneUserMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(jjrMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
artificerPrice = artificerPrice.subtract(oneUserMoney);
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
}else{
//用户收益加上通行费用
@ -1574,18 +1607,8 @@ public class AliPayController {
BigDecimal pingMoney = orders.getPayMoney();
pingMoney = pingMoney.subtract(artificerPrice);
pingMoney = pingMoney.subtract(shopMoney);
pingMoney = pingMoney.subtract(oneArtificerMoney);
UserEntity user = userService.selectUserById(orders.getUserId());
UserEntity oneUser = userService.queryByInvitationCode(user.getInviterCode());
BigDecimal oneUserMoney = BigDecimal.ZERO;
if (oneUser != null && oneUser.getIsAgency() != null && oneUser.getIsAgency() == 1) {
orders.setOneUserId(oneUser.getUserId());
orders.setOneUserName(oneUser.getUserName());
oneUserMoney = pingMoney.multiply(oneUser.getUserRate());
oneUserMoney = oneUserMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
// pingMoney = pingMoney.subtract(oneArtificerMoney);
pingMoney = pingMoney.subtract(jjrMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
@ -1625,7 +1648,8 @@ public class AliPayController {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
// orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setJjrMoney(orders1.getJjrMoney().add(orders.getJjrMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
@ -1920,7 +1944,7 @@ public class AliPayController {
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(0, BigDecimal.ROUND_UP);
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
@ -1943,15 +1967,15 @@ public class AliPayController {
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//储值扣费
valueStorageDeduction = artificerPrice.multiply(storageRate);//技师提成中扣除金额
valueStorageDeduction = valueStorageDeduction.setScale(0, BigDecimal.ROUND_UP);
valueStorageDeduction = valueStorageDeduction.setScale(2, BigDecimal.ROUND_HALF_UP);
orders.setValueStorageDeduction(valueStorageDeduction);
//用户收益不含交通费
artificerPrice = artificerPrice.multiply(rate);
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
// BigDecimal projectBenefits = orders.getProjectBenefits().multiply(rate);
// projectBenefits = projectBenefits.setScale(2, BigDecimal.ROUND_HALF_UP);
@ -1959,15 +1983,24 @@ public class AliPayController {
orders.setProjectBenefits(artificerPrice);
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// BigDecimal oneArtificerMoney = BigDecimal.ZERO;
// if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
// oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// }
// orders.setOneArtificerMoney(oneArtificerMoney);
UserEntity jjrUser = userService.queryByInvitationCode(artificerUser.getBlJjrCode());
BigDecimal jjrMoney = BigDecimal.ZERO;
if (jjrUser != null) {
orders.setJjrUserId(jjrUser.getUserId());
orders.setJjrUserName(jjrUser.getUserName());
jjrMoney = jjrMoney.multiply(jjrUser.getBlJjrRate());
jjrMoney = jjrMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setJjrMoney(jjrMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
@ -1978,7 +2011,7 @@ public class AliPayController {
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
@ -1990,10 +2023,11 @@ public class AliPayController {
orders.setOneUserId(oneUser.getUserId());
orders.setOneUserName(oneUser.getUserName());
oneUserMoney = artificerPrice.multiply(oneUser.getUserRate());
oneUserMoney = oneUserMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
oneUserMoney = oneUserMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(jjrMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
artificerPrice = artificerPrice.subtract(oneUserMoney);
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
@ -2008,7 +2042,8 @@ public class AliPayController {
BigDecimal pingMoney = orders.getPayMoney();
pingMoney = pingMoney.subtract(artificerPrice);
pingMoney = pingMoney.subtract(shopMoney);
pingMoney = pingMoney.subtract(oneArtificerMoney);
// pingMoney = pingMoney.subtract(oneArtificerMoney);
pingMoney = pingMoney.subtract(jjrMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
@ -2090,7 +2125,8 @@ public class AliPayController {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
// orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setJjrMoney(orders1.getJjrMoney().add(orders.getJjrMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
@ -2248,7 +2284,7 @@ public class AliPayController {
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
String[] couponIds = couponIssue.getCouponIds().split(",");
UserMoneyDetails userMoneyDetails=new UserMoneyDetails();
userMoneyDetails.setClassify(1);
userMoneyDetails.setClassify(2);
userMoneyDetails.setType(2);
userMoneyDetails.setState(2);
userMoneyDetails.setManipulateType(1);
@ -2364,7 +2400,7 @@ public class AliPayController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//用户流水
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
userMoneyDetails.setClassify(8);
userMoneyDetails.setClassify(5);
userMoneyDetails.setManipulateType(1);
userMoneyDetails.setUserId(payDetails.getUserId());
userMoneyDetails.setTitle("支付宝给技师打赏");
@ -2386,7 +2422,7 @@ public class AliPayController {
//插入余额
userMoneyDetails2.setBalance(userNowMoney.getMoney());
userMoneyDetails2.setManipulateType(2);
userMoneyDetails2.setClassify(8);
userMoneyDetails2.setClassify(5);
userMoneyDetails2.setUserId(userEntity.getUserId());
userMoneyDetails2.setTitle("用户支付宝打赏");
userMoneyDetails2.setContent("来自用户“"+userEntity.getUserName()+"”支付宝打赏:"+money);

View File

@ -56,6 +56,11 @@ public class PayClassify implements Serializable {
*/
private String createTime;
private Integer dayNum;
private Integer dayMoney;
/**
* 子表列表
*/

View File

@ -798,7 +798,7 @@ public class WxServiceImpl implements WxService {
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(0, BigDecimal.ROUND_UP);
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
@ -821,28 +821,37 @@ public class WxServiceImpl implements WxService {
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//储值扣费
valueStorageDeduction = artificerPrice.multiply(storageRate);//技师提成中扣除金额
valueStorageDeduction = valueStorageDeduction.setScale(0, BigDecimal.ROUND_UP);
valueStorageDeduction = valueStorageDeduction.setScale(2, BigDecimal.ROUND_HALF_UP);
orders.setValueStorageDeduction(valueStorageDeduction);
//用户收益不含交通费
artificerPrice = artificerPrice.multiply(rate);
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
orders.setProjectBenefits(artificerPrice);
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// BigDecimal oneArtificerMoney = BigDecimal.ZERO;
// if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
// oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// }
// orders.setOneArtificerMoney(oneArtificerMoney);
UserEntity jjrUser = userService.queryByInvitationCode(artificerUser.getBlJjrCode());
BigDecimal jjrMoney = BigDecimal.ZERO;
if (jjrUser != null) {
orders.setJjrUserId(jjrUser.getUserId());
orders.setJjrUserName(jjrUser.getUserName());
jjrMoney = jjrMoney.multiply(jjrUser.getBlJjrRate());
jjrMoney = jjrMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setJjrMoney(jjrMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
@ -853,7 +862,7 @@ public class WxServiceImpl implements WxService {
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
@ -868,7 +877,8 @@ public class WxServiceImpl implements WxService {
oneUserMoney = oneUserMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(jjrMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
artificerPrice = artificerPrice.subtract(oneUserMoney);
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
@ -883,7 +893,8 @@ public class WxServiceImpl implements WxService {
BigDecimal pingMoney = orders.getPayMoney();
pingMoney = pingMoney.subtract(artificerPrice);
pingMoney = pingMoney.subtract(shopMoney);
pingMoney = pingMoney.subtract(oneArtificerMoney);
// pingMoney = pingMoney.subtract(oneArtificerMoney);
pingMoney = pingMoney.subtract(jjrMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
@ -923,7 +934,8 @@ public class WxServiceImpl implements WxService {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
// orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setJjrMoney(orders1.getJjrMoney().add(orders.getJjrMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
@ -1392,7 +1404,7 @@ public class WxServiceImpl implements WxService {
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(0, BigDecimal.ROUND_UP);
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
@ -1415,15 +1427,15 @@ public class WxServiceImpl implements WxService {
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//储值扣费
valueStorageDeduction = artificerPrice.multiply(storageRate);//技师提成中扣除金额
valueStorageDeduction = valueStorageDeduction.setScale(0, BigDecimal.ROUND_UP);
valueStorageDeduction = valueStorageDeduction.setScale(2, BigDecimal.ROUND_HALF_UP);
orders.setValueStorageDeduction(valueStorageDeduction);
//用户收益不含交通费
artificerPrice = artificerPrice.multiply(rate);
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
// BigDecimal projectBenefits = orders.getProjectBenefits().multiply(rate);
// projectBenefits = projectBenefits.setScale(2, BigDecimal.ROUND_HALF_UP);
@ -1431,15 +1443,24 @@ public class WxServiceImpl implements WxService {
orders.setProjectBenefits(artificerPrice);
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// BigDecimal oneArtificerMoney = BigDecimal.ZERO;
// if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
// oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// }
// orders.setOneArtificerMoney(oneArtificerMoney);
UserEntity jjrUser = userService.queryByInvitationCode(artificerUser.getBlJjrCode());
BigDecimal jjrMoney = BigDecimal.ZERO;
if (jjrUser != null) {
orders.setJjrUserId(jjrUser.getUserId());
orders.setJjrUserName(jjrUser.getUserName());
jjrMoney = jjrMoney.multiply(jjrUser.getBlJjrRate());
jjrMoney = jjrMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setJjrMoney(jjrMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
@ -1465,7 +1486,8 @@ public class WxServiceImpl implements WxService {
oneUserMoney = oneUserMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(jjrMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
artificerPrice = artificerPrice.subtract(oneUserMoney);
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
@ -1480,7 +1502,8 @@ public class WxServiceImpl implements WxService {
BigDecimal pingMoney = orders.getPayMoney();
pingMoney = pingMoney.subtract(artificerPrice);
pingMoney = pingMoney.subtract(shopMoney);
pingMoney = pingMoney.subtract(oneArtificerMoney);
// pingMoney = pingMoney.subtract(oneArtificerMoney);
pingMoney = pingMoney.subtract(jjrMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
@ -1556,7 +1579,8 @@ public class WxServiceImpl implements WxService {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
// orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setJjrMoney(orders1.getJjrMoney().add(orders.getJjrMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
@ -1713,7 +1737,7 @@ public class WxServiceImpl implements WxService {
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
String[] couponIds = couponIssue.getCouponIds().split(",");
UserMoneyDetails userMoneyDetails=new UserMoneyDetails();
userMoneyDetails.setClassify(1);
userMoneyDetails.setClassify(2);
userMoneyDetails.setType(2);
userMoneyDetails.setState(2);
userMoneyDetails.setManipulateType(1);
@ -1829,7 +1853,7 @@ public class WxServiceImpl implements WxService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//用户流水
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
userMoneyDetails.setClassify(8);
userMoneyDetails.setClassify(5);
userMoneyDetails.setManipulateType(1);
userMoneyDetails.setUserId(payDetails.getUserId());
userMoneyDetails.setTitle("微信给技师打赏");
@ -1851,7 +1875,7 @@ public class WxServiceImpl implements WxService {
//插入余额
userMoneyDetails2.setBalance(userNowMoney.getMoney());
userMoneyDetails2.setManipulateType(2);
userMoneyDetails2.setClassify(8);
userMoneyDetails2.setClassify(5);
userMoneyDetails2.setUserId(userEntity.getUserId());
userMoneyDetails2.setTitle("用户微信打赏");
userMoneyDetails2.setContent("来自用户“"+userEntity.getUserName()+"”微信打赏:"+money);
@ -2148,7 +2172,7 @@ public class WxServiceImpl implements WxService {
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(0, BigDecimal.ROUND_UP);
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
@ -2171,15 +2195,15 @@ public class WxServiceImpl implements WxService {
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//储值扣费
valueStorageDeduction = artificerPrice.multiply(storageRate);//技师提成中扣除金额
valueStorageDeduction = valueStorageDeduction.setScale(0, BigDecimal.ROUND_UP);
valueStorageDeduction = valueStorageDeduction.setScale(2, BigDecimal.ROUND_HALF_UP);
orders.setValueStorageDeduction(valueStorageDeduction);
//用户收益不含交通费
artificerPrice = artificerPrice.multiply(rate);
artificerPrice = artificerPrice.setScale(0, BigDecimal.ROUND_UP);
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
// BigDecimal projectBenefits = orders.getProjectBenefits().multiply(rate);
// projectBenefits = projectBenefits.setScale(2, BigDecimal.ROUND_HALF_UP);
@ -2187,15 +2211,24 @@ public class WxServiceImpl implements WxService {
orders.setProjectBenefits(artificerPrice);
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// BigDecimal oneArtificerMoney = BigDecimal.ZERO;
// if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
// oneArtificerMoney = oneArtificerMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
// }
// orders.setOneArtificerMoney(oneArtificerMoney);
UserEntity jjrUser = userService.queryByInvitationCode(artificerUser.getBlJjrCode());
BigDecimal jjrMoney = BigDecimal.ZERO;
if (jjrUser != null) {
orders.setJjrUserId(jjrUser.getUserId());
orders.setJjrUserName(jjrUser.getUserName());
jjrMoney = jjrMoney.multiply(jjrUser.getBlJjrRate());
jjrMoney = jjrMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setJjrMoney(jjrMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
@ -2221,7 +2254,8 @@ public class WxServiceImpl implements WxService {
oneUserMoney = oneUserMoney.setScale(0, BigDecimal.ROUND_HALF_UP);
}
orders.setOneUserMoney(oneUserMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(jjrMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
artificerPrice = artificerPrice.subtract(oneUserMoney);
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
@ -2236,7 +2270,8 @@ public class WxServiceImpl implements WxService {
BigDecimal pingMoney = orders.getPayMoney();
pingMoney = pingMoney.subtract(artificerPrice);
pingMoney = pingMoney.subtract(shopMoney);
pingMoney = pingMoney.subtract(oneArtificerMoney);
// pingMoney = pingMoney.subtract(oneArtificerMoney);
pingMoney = pingMoney.subtract(jjrMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
@ -2312,7 +2347,8 @@ public class WxServiceImpl implements WxService {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
// orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setJjrMoney(orders1.getJjrMoney().add(orders.getJjrMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
@ -2469,7 +2505,7 @@ public class WxServiceImpl implements WxService {
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
String[] couponIds = couponIssue.getCouponIds().split(",");
UserMoneyDetails userMoneyDetails=new UserMoneyDetails();
userMoneyDetails.setClassify(1);
userMoneyDetails.setClassify(2);
userMoneyDetails.setType(2);
userMoneyDetails.setState(2);
userMoneyDetails.setManipulateType(1);
@ -2585,7 +2621,7 @@ public class WxServiceImpl implements WxService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//用户流水
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
userMoneyDetails.setClassify(8);
userMoneyDetails.setClassify(5);
userMoneyDetails.setManipulateType(1);
userMoneyDetails.setUserId(payDetails.getUserId());
userMoneyDetails.setTitle("微信给技师打赏");
@ -2607,7 +2643,7 @@ public class WxServiceImpl implements WxService {
//插入余额
userMoneyDetails2.setBalance(userNowMoney.getMoney());
userMoneyDetails2.setManipulateType(2);
userMoneyDetails2.setClassify(8);
userMoneyDetails2.setClassify(5);
userMoneyDetails2.setUserId(userEntity.getUserId());
userMoneyDetails2.setTitle("用户微信打赏");
userMoneyDetails2.setContent("来自用户“"+userEntity.getUserName()+"”微信打赏:"+money);

View File

@ -277,25 +277,25 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
//固定的
//正常出行
usualTravelMoney = conf.getFixedPrice();
usualTravelMoney = usualTravelMoney.setScale(0,BigDecimal.ROUND_UP);
usualTravelMoney = usualTravelMoney.setScale(2,BigDecimal.ROUND_HALF_UP);
vo.setUsualTravelMoney(usualTravelMoney);
//夜间出行
if(TravelEnum.TimeIntervalType.NIGHT.getValue().equals(timeIntervalType)) {
//夜间
nightTravelMoney = conf.getNightTravelExpenses();
}
nightTravelMoney = nightTravelMoney.setScale(0,BigDecimal.ROUND_UP);
nightTravelMoney = nightTravelMoney.setScale(2,BigDecimal.ROUND_HALF_UP);
vo.setNightTravelMoney(nightTravelMoney);
//最终价格
BigDecimal fixedPrice = usualTravelMoney.add(nightTravelMoney);
fixedPrice = fixedPrice.setScale(0,BigDecimal.ROUND_UP);
fixedPrice = fixedPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
vo.setTravelPrice(fixedPrice.toString());
}else if(TravelEnum.PricingType.TRENDS.getValue().equals(pricingType)){
//动态的
if(TravelEnum.TimeIntervalType.NIGHT.getValue().equals(timeIntervalType)) {
//夜间
nightTravelMoney = conf.getNightTravelExpenses();
nightTravelMoney = nightTravelMoney.setScale(0,BigDecimal.ROUND_UP);
nightTravelMoney = nightTravelMoney.setScale(2,BigDecimal.ROUND_HALF_UP);
}
//起步公里数
BigDecimal startKilometers = conf.getFreeKilometers();
@ -313,22 +313,22 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
vo.setUsualTravelMoney(BigDecimal.ZERO);
vo.setNightTravelMoney(nightTravelMoney);
travelPrice = nightTravelMoney;
travelPrice = travelPrice.setScale(0,BigDecimal.ROUND_UP);
travelPrice = travelPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
vo.setTravelPrice(travelPrice.toString());
}else{
BigDecimal kilometers = kilometerNum.subtract(freeKilometers);
//公里数>免费公里数公里数-免费公里数<起步公里数时车费=夜间出行费+起步价
if(kilometers.compareTo(startKilometers)<0){
startingPrice = startingPrice.setScale(0,BigDecimal.ROUND_UP);
startingPrice = startingPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
}else{
//公里数>免费公里数公里数-免费公里数>起步公里数时车费=夜间出行费+起步价+(公里数-免费公里数-起步公里数)*每公里价格
startingPrice = startingPrice.add(kilometers.subtract(startKilometers).multiply(pricePerKilometer));
startingPrice = startingPrice.setScale(0,BigDecimal.ROUND_UP);
startingPrice = startingPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
}
vo.setUsualTravelMoney(startingPrice);
vo.setNightTravelMoney(nightTravelMoney);
travelPrice = nightTravelMoney.add(startingPrice);
travelPrice = travelPrice.setScale(0,BigDecimal.ROUND_UP);
travelPrice = travelPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
vo.setTravelPrice(travelPrice.toString());
}
}

View File

@ -3,10 +3,10 @@
<mapper namespace="com.sqx.modules.app.dao.UserMoneyDetailsDao">
<select id="monthIncome" resultType="Double">
select sum(money) from user_money_details where user_id=#{userId} and classify=4 and type=2 and state=2 and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
select sum(money) from user_money_details where user_id=#{userId} and ifnull(classify,5)=5 and type=1 and state=2 and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
</select>
<select id="selectMyProfit" resultType="Double">
select sum(money) from user_money_details where user_id=#{userId} and classify!=3
select sum(money) from user_money_details where user_id=#{userId} and ifnull(classify,5)=5 and state=2
</select>
<select id="selectSumRefund" resultType="java.math.BigDecimal">
@ -127,7 +127,7 @@
</select>
<select id="selectArtificerQianbao" resultType="com.sqx.modules.app.entity.UserMoneyDetails">
select type,IFNULL(sum(money),0) as money from user_money_details where user_id = #{userId} and bl_role = 2 and bl_flag = 1 and state = 2 and classify = 8 and type = 1
select type,IFNULL(sum(money),0) as money from user_money_details where user_id = #{userId} and bl_role = 2 and bl_flag = 1 and state = 2 and classify = 4 and type = 1
<if test="startTime!=null and startTime!=''">
and date_format(create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>

View File

@ -6,9 +6,9 @@
<select id="findPage" resultType="com.sqx.modules.bl.commission.jjr.entity.JjrData">
select
x.id,x.user_id,y.avatar,y.user_name,x.name,x.phone,x.remarks,x.create_time,x.status,x.opinion,y.invitation_code,x.approve_time,
(select count(*) from tb_user ac where ac.bl_jjr_code = y.invitation_code) as artificerCount,
ifnull(select count(*) from tb_user ac inner join artificer aa on a.user_id = aa.user_id where ac.bl_jjr_code = y.invitation_code,0) as artificerCount,
ifnull(t1.ordersCount,0) as ordersCount,
ifnull(t2.money,0) as money
ifnull(t3.money,0) as money
from bl_jjr_apply x
inner join tb_user y on x.user_id = y.user_id
left join (
@ -47,7 +47,7 @@
where state = 2
and type = 1
group by user_id
) t2 on t2.user_id = x.user_id
) t3 on t3.user_id = x.user_id
where x.status= 1
<if test="params.name!=null and params.name!=''">
and x.name like concat('%',#{params.name},'%')
@ -131,4 +131,94 @@
where user_id=#{artificerUserId}
</update>
<select id="findJjr" resultType="com.sqx.modules.bl.commission.jjr.entity.JjrData">
select
x.id,x.user_id,y.avatar,y.user_name,x.name,x.phone,x.remarks,x.create_time,x.status,x.opinion,y.invitation_code,x.approve_time,
ifnull(select count(*) from tb_user ac inner join artificer aa on a.user_id = aa.user_id where ac.bl_jjr_code = y.invitation_code,0) as artificerCount,
ifnull(select count(*) from tb_user ac inner join artificer aa on a.user_id = aa.user_id
where ac.bl_jjr_code = y.invitation_code and date_format(aa.create_time, '%Y-%m-%d') = date_format(now(),'%Y-%m-%d'),0) as curArtificerCount,
ifnull(t1.ordersCount,0) as ordersCount,
ifnull(t2.ordersCount,0) as curOrdersCount,
ifnull(t3.money,0) as money
from bl_jjr_apply x
inner join tb_user y on x.user_id = y.user_id
left join (
select count(*) as ordersCount, aa.user_id, bb.bl_jjr_code
from (
select o1.orders_id,a.user_id
from orders o1
left join orders o2 on o1.old_orders_id = o2.orders_id and o2.status != 4
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
left join artificer a on a.artificer_id=o1.artificer_id
where o1.old_orders_id is not null
and o1.status in (3,5)
union all
select o1.orders_id,a.user_id
from orders o1
left join artificer a on a.artificer_id=o1.artificer_id
where o1.parent_id = 0
and o1.old_orders_id is null
and o1.orders_id not in (
select orders_id from orders
where old_orders_id is not null
and status != 4
)
and o1.orders_id not in (
select old_orders_id from orders
where old_orders_id is not null
and status != 4
)
and o1.status in (3,5)
) aa inner join tb_user bb on aa.user_id = bb.user_id
group by aa.user_id, bb.bl_jjr_code
) t1 on t1.bl_jjr_code = y.invitation_code
left join (
select count(*) as ordersCount, aa.user_id, bb.bl_jjr_code
from (
select o1.orders_id,a.user_id
from orders o1
left join orders o2 on o1.old_orders_id = o2.orders_id and o2.status != 4
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
left join artificer a on a.artificer_id=o1.artificer_id
where o1.old_orders_id is not null
and o1.status in (3,5)
and date_format(o1.serve_time, '%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
union all
select o1.orders_id,a.user_id
from orders o1
left join artificer a on a.artificer_id=o1.artificer_id
where o1.parent_id = 0
and o1.old_orders_id is null
and o1.orders_id not in (
select orders_id from orders
where old_orders_id is not null
and status != 4
)
and o1.orders_id not in (
select old_orders_id from orders
where old_orders_id is not null
and status != 4
)
and o1.status in (3,5)
and date_format(o1.serve_time, '%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
) aa inner join tb_user bb on aa.user_id = bb.user_id
group by aa.user_id, bb.bl_jjr_code
) t2 on t2.bl_jjr_code = y.invitation_code
left join (
select sum(money) money,user_id
from user_money_details
where state = 2
and type = 1
group by user_id
) t3 on t3.user_id = x.user_id
where x.status= 1
and x.user_id = #{userId}
</select>
<select id="getByUserId" resultType="com.sqx.modules.bl.commission.jjr.entity.JjrData">
select user_id,avatar,user_name,phone,create_time,status,invitation_code
from tb_user
where user_id = #{userId}
</select>
</mapper>