|
@@ -5,8 +5,6 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ruoyi.app.service.WalletService;
|
|
import com.ruoyi.app.service.WalletService;
|
|
|
-import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
|
-import com.ruoyi.common.utils.DictUtils;
|
|
|
|
|
import com.ruoyi.common.utils.MessageUtils;
|
|
import com.ruoyi.common.utils.MessageUtils;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.system.domain.*;
|
|
import com.ruoyi.system.domain.*;
|
|
@@ -20,10 +18,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 订单账单生成服务(商家分成、骑手分成)
|
|
|
|
|
|
|
+ * 订单账单生成服务(商家商品收入、骑手配送收入,不扣平台抽成)
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
public class OrderService {
|
|
public class OrderService {
|
|
@@ -40,7 +37,7 @@ public class OrderService {
|
|
|
private IVipUserQuanyiService userQuanyiService;
|
|
private IVipUserQuanyiService userQuanyiService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 执行商户分成
|
|
|
|
|
|
|
+ * 商家商品收入全额入账,沿用原有优惠及配送费划分
|
|
|
*/
|
|
*/
|
|
|
public void setSanghuBilling(PosOrder posOrder) {
|
|
public void setSanghuBilling(PosOrder posOrder) {
|
|
|
long count = userBillingService.count(new LambdaQueryWrapper<UserBilling>()
|
|
long count = userBillingService.count(new LambdaQueryWrapper<UserBilling>()
|
|
@@ -61,13 +58,6 @@ public class OrderService {
|
|
|
PosStore store = posStoreService.getById(posOrder.getMdId());
|
|
PosStore store = posStoreService.getById(posOrder.getMdId());
|
|
|
boolean isStall = store != null && store.getIsStall() != null && store.getIsStall() == 1 && store.getNightMarketId() != null;
|
|
boolean isStall = store != null && store.getIsStall() != null && store.getIsStall() == 1 && store.getNightMarketId() != null;
|
|
|
|
|
|
|
|
- InfoUser user;
|
|
|
|
|
- if (isStall) {
|
|
|
|
|
- user = infoUserService.getById(store.getNightMarketId());
|
|
|
|
|
- } else {
|
|
|
|
|
- user = infoUserService.getById(posOrder.getShId());
|
|
|
|
|
- }
|
|
|
|
|
- Double fcbili = user.getCommission() == null ? 0.00 : user.getCommission();
|
|
|
|
|
int fenc;
|
|
int fenc;
|
|
|
String remark;
|
|
String remark;
|
|
|
if (Integer.valueOf(2).equals(posOrder.getPromotionPricingVersion())) {
|
|
if (Integer.valueOf(2).equals(posOrder.getPromotionPricingVersion())) {
|
|
@@ -113,17 +103,16 @@ public class OrderService {
|
|
|
remark = legacyRemark.toString();
|
|
remark = legacyRemark.toString();
|
|
|
}
|
|
}
|
|
|
billing.setIllustrate(remark);
|
|
billing.setIllustrate(remark);
|
|
|
- Double chouc = fenc * fcbili;
|
|
|
|
|
- Double shfc = fenc - chouc;
|
|
|
|
|
|
|
+ // 2026-11-04:平台不再抽成,历史配置不参与新账单;优惠后的商品收入全额入账。
|
|
|
billing.setUserId(posOrder.getShId());
|
|
billing.setUserId(posOrder.getShId());
|
|
|
billing.setDdId(String.valueOf(posOrder.getDdId()));
|
|
billing.setDdId(String.valueOf(posOrder.getDdId()));
|
|
|
billing.setType("0");
|
|
billing.setType("0");
|
|
|
- billing.setAmount(Double.valueOf(df.format(shfc)));
|
|
|
|
|
- billing.setDivvy(Double.valueOf(df.format(chouc)));
|
|
|
|
|
|
|
+ billing.setAmount(Double.valueOf(df.format(fenc)));
|
|
|
|
|
+ billing.setDivvy(0.00);
|
|
|
billing.setState("0");
|
|
billing.setState("0");
|
|
|
billing.setMdId(posOrder.getMdId());
|
|
billing.setMdId(posOrder.getMdId());
|
|
|
billing.setUserType("1");
|
|
billing.setUserType("1");
|
|
|
- billing.setDivvyRate(fcbili);
|
|
|
|
|
|
|
+ billing.setDivvyRate(0.00);
|
|
|
if (isStall) {
|
|
if (isStall) {
|
|
|
billing.setStoreId(Long.valueOf(store.getId()));
|
|
billing.setStoreId(Long.valueOf(store.getId()));
|
|
|
walletService.addStallBalance(Long.valueOf(store.getId()), BigDecimal.valueOf(billing.getAmount()), billing);
|
|
walletService.addStallBalance(Long.valueOf(store.getId()), BigDecimal.valueOf(billing.getAmount()), billing);
|
|
@@ -134,7 +123,7 @@ public class OrderService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 执行骑手分成
|
|
|
|
|
|
|
+ * 骑手配送费全额入账,不扣平台抽成和骑手运费税费
|
|
|
*/
|
|
*/
|
|
|
public void setQishouBilling(PosOrder posOrder) {
|
|
public void setQishouBilling(PosOrder posOrder) {
|
|
|
long count = userBillingService.count(new LambdaQueryWrapper<UserBilling>()
|
|
long count = userBillingService.count(new LambdaQueryWrapper<UserBilling>()
|
|
@@ -148,26 +137,20 @@ public class OrderService {
|
|
|
if (user == null) {
|
|
if (user == null) {
|
|
|
System.out.println("订单无骑手");
|
|
System.out.println("订单无骑手");
|
|
|
} else {
|
|
} else {
|
|
|
- Double fcbili = user.getCommission() == null ? 0.00 : user.getCommission();
|
|
|
|
|
|
|
+ // 2026-11-04:运费全额归骑手,旧commission和sys_qs_freight_bl均不再参与扣款。
|
|
|
|
|
+ // 显式记录零值,保留账单字段及历史账单,不改变到付代收和防重复结算逻辑。
|
|
|
Double fenc = posOrder.getFreight();
|
|
Double fenc = posOrder.getFreight();
|
|
|
- Double chouc = fenc * fcbili;
|
|
|
|
|
- Double shfc = fenc - chouc;
|
|
|
|
|
- List<SysDictData> taxBl = DictUtils.getDictCache("sys_qs_freight_bl");
|
|
|
|
|
- if (taxBl != null && taxBl.get(0) != null) {
|
|
|
|
|
- Double tax = shfc * Double.parseDouble(taxBl.get(0).getDictValue());
|
|
|
|
|
- billing.setTax(BigDecimal.valueOf(tax));
|
|
|
|
|
- billing.setTaxRate(taxBl.get(0).getDictValue());
|
|
|
|
|
- shfc = shfc - tax;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ billing.setTax(BigDecimal.ZERO);
|
|
|
|
|
+ billing.setTaxRate("0");
|
|
|
billing.setUserId(posOrder.getQsId());
|
|
billing.setUserId(posOrder.getQsId());
|
|
|
billing.setDdId(String.valueOf(posOrder.getDdId()));
|
|
billing.setDdId(String.valueOf(posOrder.getDdId()));
|
|
|
billing.setType("0");
|
|
billing.setType("0");
|
|
|
- billing.setAmount(Double.valueOf(df.format(shfc)));
|
|
|
|
|
- billing.setDivvy(Double.valueOf(df.format(chouc)));
|
|
|
|
|
|
|
+ billing.setAmount(Double.valueOf(df.format(fenc)));
|
|
|
|
|
+ billing.setDivvy(0.00);
|
|
|
billing.setState("0");
|
|
billing.setState("0");
|
|
|
billing.setMdId(posOrder.getMdId());
|
|
billing.setMdId(posOrder.getMdId());
|
|
|
billing.setUserType("2");
|
|
billing.setUserType("2");
|
|
|
- billing.setDivvyRate(user.getCommission());
|
|
|
|
|
|
|
+ billing.setDivvyRate(0.00);
|
|
|
if ("1".equals(posOrder.getCollectPayment())) {
|
|
if ("1".equals(posOrder.getCollectPayment())) {
|
|
|
billing.setBehalfAmount(Double.valueOf(posOrder.getAmount()));
|
|
billing.setBehalfAmount(Double.valueOf(posOrder.getAmount()));
|
|
|
}
|
|
}
|