This commit is contained in:
曹磊 2024-07-04 23:22:17 +08:00
parent da5f15f949
commit 4e11900438
5 changed files with 1267 additions and 813 deletions

View File

@ -73,6 +73,6 @@ public class UserPackageDetailServiceImpl extends ServiceImpl<UserPackageDetailD
@Override
public UserPackageDetail findMassagePackageDetailsUsed(Long mainId){
return findMassagePackageDetailsUsed(mainId);
return baseMapper.findMassagePackageDetailsUsed(mainId);
}
}

View File

@ -15,6 +15,7 @@ import com.alipay.api.request.AlipayTradeWapPayRequest;
import com.alipay.api.response.AlipayTradeAppPayResponse;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sqx.common.utils.DateUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
@ -196,48 +197,100 @@ public class AliPayController {
}
orders.setPayWay(6);
orders.setPayTime(sdf.format(new Date()));
BigDecimal pingMoney=orders.getPayMoney();
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());
}
orders.setValueStorageDeduction(BigDecimal.ZERO);
Artificer artificer = artificerService.getById(orders.getArtificerId());
BigDecimal taxiMoney = BigDecimal.ZERO;
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
taxiMoney = orders.getTaxiMoney();
}
if(taxiMoney==null){
taxiMoney = BigDecimal.ZERO;
}
BigDecimal artificerPrice = BigDecimal.ZERO;
BigDecimal artificerTaxiPrice = BigDecimal.ZERO;
//查询是否计算出租车扣费
String taxi = commonInfoService.findOne(394).getValue();
//计算技师出租车收益按照技师表收益计算
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
orders.setArtificerTaxiMoney(artificerTaxiPrice);
//赋值出租车扣款
orders.setPingTaxiMoney(pingTaxiMoney);
} else {
//平台不扣费 出租车收益全由技师收取
artificerTaxiPrice = taxiMoney;
orders.setArtificerTaxiMoney(taxiMoney);
//设置出租车扣款为0
orders.setPingTaxiMoney(BigDecimal.ZERO);
}
BigDecimal subtract = BigDecimal.ZERO;
//用户支付减去通行费用
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
subtract = orders.getPayMoney();
}else{
subtract = orders.getPayMoney().subtract(taxiMoney);
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
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){
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
BigDecimal shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
orders.setOneArtificerMoney(oneArtificerMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
if (consortia != null && consortia.getUserId() != null) {
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney = pingMoney.multiply(consortia.getRate());
if (consortiaUser != null) {
orders.setConsortiaId(consortia.getConsortiaId());
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
pingMoney=pingMoney.subtract(orders.getArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders.setShopMoney(shopMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
//用户收益加上通行费用
artificerPrice = artificerPrice.add(artificerTaxiPrice);
}
orders.setArtificerMoney(artificerPrice);
orders.setSumArtificerMoney(artificerPrice);
//平台扣款
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);
orders.setOneArtificerMoney(oneArtificerMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
ordersService.updateById(orders);
@ -298,6 +351,15 @@ public class AliPayController {
}else{
orders1.setAddTime(orders.getAddTime());
}
boolean flag2 = false;
if (StringUtils.isNotBlank(orders1.getEndTime())) {
Calendar calendar2 = Calendar.getInstance();
Date date = DateUtils.stringToDate(orders1.getEndTime(), "yyyy-MM-dd HH:mm:ss");
calendar2.setTime(date);
calendar2.add(Calendar.MINUTE, orders.getAddTime());
orders1.setEndTime(DateUtils.format(calendar2.getTime()));
flag2 = true;
}
if(orders1.getAddMoney()!=null){
orders1.setAddMoney(orders1.getAddMoney().add(orders.getPayMoney()));
orders1.setAddArtificerMoney(orders1.getAddArtificerMoney().add(orders.getArtificerMoney()));
@ -308,33 +370,10 @@ public class AliPayController {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
pingMoney=orders1.getSumMoney();
oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney=pingMoney.multiply(consortia.getRate());
}
}
}
pingMoney=pingMoney.subtract(orders1.getSumArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders1.setShopMoney(shopMoney);
orders1.setOneUserMoney(oneUserMoney);
orders1.setOneArtificerMoney(oneArtificerMoney);
orders1.setPingMoney(pingMoney);
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
if(orders1.getStatus().equals(6)){
ordersMassage = ordersMassageService.getOne(new QueryWrapper<OrdersMassage>().eq("orders_id", orders1.getOrdersId()));
@ -349,8 +388,15 @@ public class AliPayController {
calendar.add(Calendar.MINUTE,duration);
orders1.setEndTime(endTime);
}
orders1.setAddPrice(orders.getPrice());
orders1.setAddMassageTypeId(orders.getMassageTypeId());
orders1.setAddEntryName(orders.getEntryName());
ordersDao.updateById(orders1);
if (flag2) {
ordersDao.update(null, Wrappers.<Orders>lambdaUpdate()
.set(Orders::getWarning, null)
.eq(Orders::getOrdersId, orders1.getOrdersId()));
}
}else{
MessageInfo messageInfo=new MessageInfo();
messageInfo.setState("16");
@ -377,7 +423,6 @@ public class AliPayController {
userMoneyDetails.setBlFlag(2);
userMoneyDetailsService.save(userMoneyDetails);
} else if (payDetails.getType() == 2) {
//缴纳保证金
Double cashDeposit = payDetails.getMoney();
@ -973,51 +1018,103 @@ public class AliPayController {
}
orders.setPayWay(6);
orders.setPayTime(sdf.format(new Date()));
BigDecimal pingMoney=orders.getPayMoney();
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());
}
orders.setValueStorageDeduction(BigDecimal.ZERO);
Artificer artificer = artificerService.getById(orders.getArtificerId());
BigDecimal taxiMoney = BigDecimal.ZERO;
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
taxiMoney = orders.getTaxiMoney();
}
if(taxiMoney==null){
taxiMoney = BigDecimal.ZERO;
}
BigDecimal artificerPrice = BigDecimal.ZERO;
BigDecimal artificerTaxiPrice = BigDecimal.ZERO;
//查询是否计算出租车扣费
String taxi = commonInfoService.findOne(394).getValue();
//计算技师出租车收益按照技师表收益计算
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
orders.setArtificerTaxiMoney(artificerTaxiPrice);
//赋值出租车扣款
orders.setPingTaxiMoney(pingTaxiMoney);
} else {
//平台不扣费 出租车收益全由技师收取
artificerTaxiPrice = taxiMoney;
orders.setArtificerTaxiMoney(taxiMoney);
//设置出租车扣款为0
orders.setPingTaxiMoney(BigDecimal.ZERO);
}
BigDecimal subtract = BigDecimal.ZERO;
//用户支付减去通行费用
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
subtract = orders.getPayMoney();
}else{
subtract = orders.getPayMoney().subtract(taxiMoney);
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
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){
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
BigDecimal shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
orders.setOneArtificerMoney(oneArtificerMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
if (consortia != null && consortia.getUserId() != null) {
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney = pingMoney.multiply(consortia.getRate());
if (consortiaUser != null) {
orders.setConsortiaId(consortia.getConsortiaId());
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
pingMoney=pingMoney.subtract(orders.getArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders.setShopMoney(shopMoney);
orders.setOneUserMoney(oneUserMoney);
orders.setOneArtificerMoney(oneArtificerMoney);
orders.setPingMoney(pingMoney);
ordersService.updateById(orders);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
//用户收益加上通行费用
artificerPrice = artificerPrice.add(artificerTaxiPrice);
}
orders.setArtificerMoney(artificerPrice);
orders.setSumArtificerMoney(artificerPrice);
//平台扣款
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(oneUserMoney);
orders.setPingMoney(pingMoney);
ordersService.updateById(orders);
if(orders.getParentId()!=null && orders.getParentId()!=0){
String value1 = commonInfoService.findOne(395).getValue();
OrdersMassage ordersMassage = ordersMassageService.getOne(new QueryWrapper<OrdersMassage>().eq("orders_id", orders.getOrdersId()));
@ -1025,6 +1122,7 @@ public class AliPayController {
Integer duration=massageType.getDuration();
Calendar calendar=Calendar.getInstance();
if("".equals(value1)){
ArtificerTime artificerTime = artificerTimeService.getOne(new QueryWrapper<ArtificerTime>().eq("orders_id", orders.getParentId()).last(" order by artificer_time_id desc limit 1 "));
String serveTime = artificerTime.getArtificerDate()+" "+artificerTime.getArtificerTime();
String value = commonInfoService.findOne(392).getValue();
@ -1074,6 +1172,15 @@ public class AliPayController {
}else{
orders1.setAddTime(orders.getAddTime());
}
boolean flag2 = false;
if (StringUtils.isNotBlank(orders1.getEndTime())) {
Calendar calendar2 = Calendar.getInstance();
Date date = DateUtils.stringToDate(orders1.getEndTime(), "yyyy-MM-dd HH:mm:ss");
calendar2.setTime(date);
calendar2.add(Calendar.MINUTE, orders.getAddTime());
orders1.setEndTime(DateUtils.format(calendar2.getTime()));
flag2 = true;
}
if(orders1.getAddMoney()!=null){
orders1.setAddMoney(orders1.getAddMoney().add(orders.getPayMoney()));
orders1.setAddArtificerMoney(orders1.getAddArtificerMoney().add(orders.getArtificerMoney()));
@ -1084,33 +1191,10 @@ public class AliPayController {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
pingMoney=orders1.getSumMoney();
oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney=pingMoney.multiply(consortia.getRate());
}
}
}
pingMoney=pingMoney.subtract(orders1.getSumArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders1.setShopMoney(shopMoney);
orders1.setOneUserMoney(oneUserMoney);
orders1.setOneArtificerMoney(oneArtificerMoney);
orders1.setPingMoney(pingMoney);
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
if(orders1.getStatus().equals(6)){
ordersMassage = ordersMassageService.getOne(new QueryWrapper<OrdersMassage>().eq("orders_id", orders1.getOrdersId()));
@ -1125,8 +1209,15 @@ public class AliPayController {
calendar.add(Calendar.MINUTE,duration);
orders1.setEndTime(endTime);
}
orders1.setAddPrice(orders.getPrice());
orders1.setAddMassageTypeId(orders.getMassageTypeId());
orders1.setAddEntryName(orders.getEntryName());
ordersDao.updateById(orders1);
if (flag2) {
ordersDao.update(null, Wrappers.<Orders>lambdaUpdate()
.set(Orders::getWarning, null)
.eq(Orders::getOrdersId, orders1.getOrdersId()));
}
}else{
MessageInfo messageInfo=new MessageInfo();
messageInfo.setState("16");
@ -1153,7 +1244,6 @@ public class AliPayController {
userMoneyDetails.setBlFlag(2);
userMoneyDetailsService.save(userMoneyDetails);
} else if (payDetails.getType() == 2) {
//缴纳保证金
Double cashDeposit = payDetails.getMoney();

View File

@ -652,46 +652,100 @@ public class WxServiceImpl implements WxService {
}
orders.setPayWay(payDetails.getClassify());
orders.setPayTime(sdf.format(new Date()));
BigDecimal pingMoney=orders.getPayMoney();
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());
}
orders.setValueStorageDeduction(BigDecimal.ZERO);
Artificer artificer = artificerService.getById(orders.getArtificerId());
BigDecimal taxiMoney = BigDecimal.ZERO;
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
taxiMoney = orders.getTaxiMoney();
}
if(taxiMoney==null){
taxiMoney = BigDecimal.ZERO;
}
BigDecimal artificerPrice = BigDecimal.ZERO;
BigDecimal artificerTaxiPrice = BigDecimal.ZERO;
//查询是否计算出租车扣费
String taxi = commonInfoService.findOne(394).getValue();
//计算技师出租车收益按照技师表收益计算
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
orders.setArtificerTaxiMoney(artificerTaxiPrice);
//赋值出租车扣款
orders.setPingTaxiMoney(pingTaxiMoney);
} else {
//平台不扣费 出租车收益全由技师收取
artificerTaxiPrice = taxiMoney;
orders.setArtificerTaxiMoney(taxiMoney);
//设置出租车扣款为0
orders.setPingTaxiMoney(BigDecimal.ZERO);
}
BigDecimal subtract = BigDecimal.ZERO;
//用户支付减去通行费用
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
subtract = orders.getPayMoney();
}else{
subtract = orders.getPayMoney().subtract(taxiMoney);
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
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){
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
BigDecimal shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
orders.setOneArtificerMoney(oneArtificerMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
if (consortia != null && consortia.getUserId() != null) {
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney = pingMoney.multiply(consortia.getRate());
if (consortiaUser != null) {
orders.setConsortiaId(consortia.getConsortiaId());
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
pingMoney=pingMoney.subtract(orders.getArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders.setShopMoney(shopMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
//用户收益加上通行费用
artificerPrice = artificerPrice.add(artificerTaxiPrice);
}
orders.setArtificerMoney(artificerPrice);
orders.setSumArtificerMoney(artificerPrice);
//平台扣款
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);
orders.setOneArtificerMoney(oneArtificerMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
ordersService.updateById(orders);
@ -746,6 +800,15 @@ public class WxServiceImpl implements WxService {
}else{
orders1.setAddTime(orders.getAddTime());
}
boolean flag2 = false;
if (StringUtils.isNotBlank(orders1.getEndTime())) {
Calendar calendar2 = Calendar.getInstance();
Date date = DateUtils.stringToDate(orders1.getEndTime(), "yyyy-MM-dd HH:mm:ss");
calendar2.setTime(date);
calendar2.add(Calendar.MINUTE, orders.getAddTime());
orders1.setEndTime(DateUtils.format(calendar2.getTime()));
flag2 = true;
}
if(orders1.getAddMoney()!=null){
orders1.setAddMoney(orders1.getAddMoney().add(orders.getPayMoney()));
orders1.setAddArtificerMoney(orders1.getAddArtificerMoney().add(orders.getArtificerMoney()));
@ -756,33 +819,10 @@ public class WxServiceImpl implements WxService {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
pingMoney=orders1.getSumMoney();
oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney=pingMoney.multiply(consortia.getRate());
}
}
}
pingMoney=pingMoney.subtract(orders1.getSumArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders1.setShopMoney(shopMoney);
orders1.setOneUserMoney(oneUserMoney);
orders1.setOneArtificerMoney(oneArtificerMoney);
orders1.setPingMoney(pingMoney);
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
if(orders1.getStatus().equals(6)){
ordersMassage = ordersMassageService.getOne(new QueryWrapper<OrdersMassage>().eq("orders_id", orders1.getOrdersId()));
@ -797,9 +837,15 @@ public class WxServiceImpl implements WxService {
calendar.add(Calendar.MINUTE,duration);
orders1.setEndTime(endTime);
}
orders1.setAddPrice(orders.getPrice());
orders1.setAddMassageTypeId(orders.getMassageTypeId());
orders1.setAddEntryName(orders.getEntryName());
ordersDao.updateById(orders1);
if (flag2) {
ordersDao.update(null, Wrappers.<Orders>lambdaUpdate()
.set(Orders::getWarning, null)
.eq(Orders::getOrdersId, orders1.getOrdersId()));
}
}else{
MessageInfo messageInfo=new MessageInfo();
messageInfo.setState("16");
@ -1216,46 +1262,100 @@ public class WxServiceImpl implements WxService {
}
orders.setPayWay(payDetails.getClassify());
orders.setPayTime(sdf.format(new Date()));
BigDecimal pingMoney=orders.getPayMoney();
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());
}
orders.setValueStorageDeduction(BigDecimal.ZERO);
Artificer artificer = artificerService.getById(orders.getArtificerId());
BigDecimal taxiMoney = BigDecimal.ZERO;
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
taxiMoney = orders.getTaxiMoney();
}
if(taxiMoney==null){
taxiMoney = BigDecimal.ZERO;
}
BigDecimal artificerPrice = BigDecimal.ZERO;
BigDecimal artificerTaxiPrice = BigDecimal.ZERO;
//查询是否计算出租车扣费
String taxi = commonInfoService.findOne(394).getValue();
//计算技师出租车收益按照技师表收益计算
if ("".equals(taxi)) {
//计算技师应该收取的出租车费用
artificerTaxiPrice = taxiMoney.multiply(artificer.getRate());
artificerTaxiPrice = artificerTaxiPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//计算出租车扣款
BigDecimal pingTaxiMoney = taxiMoney.subtract(artificerTaxiPrice);
//赋值技师出租收款
orders.setArtificerTaxiMoney(artificerTaxiPrice);
//赋值出租车扣款
orders.setPingTaxiMoney(pingTaxiMoney);
} else {
//平台不扣费 出租车收益全由技师收取
artificerTaxiPrice = taxiMoney;
orders.setArtificerTaxiMoney(taxiMoney);
//设置出租车扣款为0
orders.setPingTaxiMoney(BigDecimal.ZERO);
}
BigDecimal subtract = BigDecimal.ZERO;
//用户支付减去通行费用
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
subtract = orders.getPayMoney();
}else{
subtract = orders.getPayMoney().subtract(taxiMoney);
}
//计算用户收益 计算前先减去通行费用再计算技师抽成
artificerPrice = subtract.multiply(artificer.getRate());
artificerPrice = artificerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
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){
BigDecimal oneArtificerMoney = BigDecimal.ZERO;
if (oneArtificerUser != null && oneArtificerUser.getIsAgency() != null && oneArtificerUser.getIsAgency() == 1) {
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = artificerPrice.multiply(oneArtificerUser.getShopRate());
oneArtificerMoney = oneArtificerMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
BigDecimal shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
orders.setOneArtificerMoney(oneArtificerMoney);
BigDecimal shopMoney = BigDecimal.ZERO;
if (artificerUser.getConsortiaId() != null) {
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
if (consortia != null && consortia.getUserId() != null) {
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney = pingMoney.multiply(consortia.getRate());
if (consortiaUser != null) {
orders.setConsortiaId(consortia.getConsortiaId());
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
shopMoney = artificerPrice.multiply(consortia.getRate());
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
}
pingMoney=pingMoney.subtract(orders.getArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders.setShopMoney(shopMoney);
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
artificerPrice = artificerPrice.subtract(shopMoney);
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
//用户收益加上通行费用
artificerPrice = artificerPrice.add(artificerTaxiPrice);
}
orders.setArtificerMoney(artificerPrice);
orders.setSumArtificerMoney(artificerPrice);
//平台扣款
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);
orders.setOneArtificerMoney(oneArtificerMoney);
pingMoney = pingMoney.subtract(oneUserMoney);
orders.setPingMoney(pingMoney);
ordersService.updateById(orders);
@ -1310,6 +1410,15 @@ public class WxServiceImpl implements WxService {
}else{
orders1.setAddTime(orders.getAddTime());
}
boolean flag2 = false;
if (StringUtils.isNotBlank(orders1.getEndTime())) {
Calendar calendar2 = Calendar.getInstance();
Date date = DateUtils.stringToDate(orders1.getEndTime(), "yyyy-MM-dd HH:mm:ss");
calendar2.setTime(date);
calendar2.add(Calendar.MINUTE, orders.getAddTime());
orders1.setEndTime(DateUtils.format(calendar2.getTime()));
flag2 = true;
}
if(orders1.getAddMoney()!=null){
orders1.setAddMoney(orders1.getAddMoney().add(orders.getPayMoney()));
orders1.setAddArtificerMoney(orders1.getAddArtificerMoney().add(orders.getArtificerMoney()));
@ -1320,33 +1429,10 @@ public class WxServiceImpl implements WxService {
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
pingMoney=orders1.getSumMoney();
oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney=pingMoney.multiply(consortia.getRate());
}
}
}
pingMoney=pingMoney.subtract(orders1.getSumArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
pingMoney=pingMoney.subtract(shopMoney);
orders1.setShopMoney(shopMoney);
orders1.setOneUserMoney(oneUserMoney);
orders1.setOneArtificerMoney(oneArtificerMoney);
orders1.setPingMoney(pingMoney);
orders1.setOneArtificerMoney(orders1.getOneArtificerMoney().add(orders.getOneArtificerMoney()));
orders1.setShopMoney(orders1.getShopMoney().add(orders.getShopMoney()));
orders1.setOneUserMoney(orders1.getOneUserMoney().add(orders.getOneUserMoney()));
orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
if(orders1.getStatus().equals(6)){
ordersMassage = ordersMassageService.getOne(new QueryWrapper<OrdersMassage>().eq("orders_id", orders1.getOrdersId()));
@ -1361,9 +1447,15 @@ public class WxServiceImpl implements WxService {
calendar.add(Calendar.MINUTE,duration);
orders1.setEndTime(endTime);
}
orders1.setAddPrice(orders.getPrice());
orders1.setAddMassageTypeId(orders.getMassageTypeId());
orders1.setAddEntryName(orders.getEntryName());
ordersDao.updateById(orders1);
if (flag2) {
ordersDao.update(null, Wrappers.<Orders>lambdaUpdate()
.set(Orders::getWarning, null)
.eq(Orders::getOrdersId, orders1.getOrdersId()));
}
}else{
MessageInfo messageInfo=new MessageInfo();
messageInfo.setState("16");

View File

@ -663,12 +663,12 @@
and o.old_orders_id is not null
and o.status != 11
<if test="type==1">
and date_format(o.serve_time,'%Y-%m-%d %H:%i') >= date_format(DATE_ADD(now(), INTERVAL -8 HOUR),'%Y-%m-%d %H:%i')
and date_format(o.serve_time,'%Y-%m-%d %H:%i') &lt;= date_format(DATE_ADD(now(), INTERVAL 8 HOUR),'%Y-%m-%d %H:%i')
and date_format(o.serve_time,'%Y-%m-%d %H:%i') >= date_format(DATE_ADD(now(), INTERVAL -12 HOUR),'%Y-%m-%d %H:%i')
and date_format(o.serve_time,'%Y-%m-%d %H:%i') &lt;= date_format(DATE_ADD(now(), INTERVAL 24 HOUR),'%Y-%m-%d %H:%i')
and o.status in (2,3,5,6,7,8,9)
</if>
<if test="type==2">
and o.status=2
and o.status in (2,6,7,8,9)
<if test="startTime!=null and startTime!=''">
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
@ -715,10 +715,12 @@
where old_orders_id is not null
)
<if test="type==1">
and date_format(o.serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and o.status in (2,3,5,6,7,8,9)
and date_format(o.serve_time,'%Y-%m-%d %H:%i') >= date_format(DATE_ADD(now(), INTERVAL -12 HOUR),'%Y-%m-%d %H:%i')
and date_format(o.serve_time,'%Y-%m-%d %H:%i') &lt;= date_format(DATE_ADD(now(), INTERVAL 24 HOUR),'%Y-%m-%d %H:%i')
and o.status in (2,3,5,6,7,8,9)
</if>
<if test="type==2">
and o.status=2
and o.status in (2,6,7,8,9)
<if test="startTime!=null and startTime!=''">
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>