From 7b09a9950f13521190a4aef9bbc2a6163445566c Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 03 三月 2026 18:01:03 +0800
Subject: [PATCH] 小程序 接口开发
---
server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
index 4ffb780..7f9c503 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
@@ -1418,7 +1418,6 @@
if(Objects.isNull(orderGoodsCalculateResponse.getCouponDeductCash())){
orderGoodsCalculateResponse.setCouponDeductCash(BigDecimal.ZERO);
}
-// orderGoodsCalculateResponse.setIntegralDeductCash(BigDecimal.ZERO);
}
//璁㈠崟鎬婚噾棰�
BigDecimal amount = BigDecimal.ZERO;
@@ -1446,6 +1445,9 @@
List<MemberCoupon> memberCouponList = memberCouponService.getApplyCoupon(request.getPayDetailRequestList(),request.getMemberId());
if(CollectionUtils.isNotEmpty(memberCouponList)){
orderPayConfirmResponse.setMemberCouponList(memberCouponList);
+ if(Objects.nonNull(request.getCouponId())&&Constants.equalsInteger(request.getCouponId(),-Constants.ONE)&&Objects.nonNull(memberCouponList)){
+ request.setCouponId(memberCouponList.get(Constants.ZERO).getId());
+ }
//濡傛灉閫夋嫨浜嗕紭鎯犲埜锛屽垯鍒ゆ柇閫夋嫨鐨勪紭鎯犲埜鏄惁鏈夋晥
if(Objects.nonNull(request.getCouponId())){
List<MemberCoupon> memberCoupons = memberCouponList.stream().filter(i->Constants.equalsInteger(i.getId(),request.getCouponId())).collect(Collectors.toList());
@@ -1465,7 +1467,7 @@
//鏌ヨ鐢ㄦ埛鎬荤Н鍒�
Member member = memberMapper.selectById(request.getMemberId());
//鏈�浣庡彲鐢ㄥ惎鐢ㄧН鍒�
- BigDecimal minimumIntegral = new BigDecimal(systemDictDataBiz.queryByCode(Constants.SHOP_CONFIG,Constants.MINIMUM_AVAILABLE_INTEGRAL).getCode());
+ BigDecimal minimumIntegral = new BigDecimal(systemDictDataBiz.queryByCode(Constants.INTEGRAL_SET,Constants.INTERALSET_MININTEGRALPRICELIMIT).getCode());
//绉垎鍙娇鐢ㄧ姸鎬� 澶т簬0 澶т簬鏈�灏忓彲鐢ㄩ厤缃Н鍒嗗��
orderPayConfirmResponse.setIntegralStatus(
(member.getIntegral().compareTo(BigDecimal.ZERO)<=Constants.ZERO||
@@ -1476,6 +1478,8 @@
orderPayConfirmResponse.setIntegralAmount(integralAmount);
if(Constants.equalsInteger(orderPayConfirmResponse.getIntegralStatus(),Constants.ZERO)){
integralAmount = this.calculateIntegralRata(orderPayConfirmResponse,goodsCalculateList,member.getIntegral());
+ }else{
+ orderPayConfirmResponse.setSurplusIntegral(member.getIntegral());
}
//閭垂閲戦
@@ -1489,7 +1493,7 @@
}
Areas areas = areasMapper.selectOne(new QueryWrapper<Areas>().lambda()
.eq(Areas::getIsdeleted,Constants.ZERO)
- .eq(Areas::getId,StringUtils.leftPad(addr.getAreaId().toString().substring(0,2),6,"0"))
+ .eq(Areas::getId,StringUtils.rightPad(addr.getAreaId().toString().substring(0,2),6,"0"))
.isNotNull(Areas::getYunFeeId)
.last(" limit 1 ")
);
@@ -1506,7 +1510,7 @@
BigDecimal totalWeight = goodsCalculateList.stream().map(i->
i.getWeight().multiply(new BigDecimal(i.getGoodsNum().toString()))
).reduce(BigDecimal.ZERO,BigDecimal::add);
- if(totalWeight.compareTo(mailConfigResponse.getWeight0())>=Constants.ZERO){
+ if(totalWeight.compareTo(mailConfigResponse.getWeight0())<=Constants.ZERO){
mailAmount = mailConfigResponse.getFee0();
}else{
//瓒呴噸閲嶉噺
@@ -1581,9 +1585,9 @@
public BigDecimal calculateIntegralRata(OrderPayConfirmResponse orderPayConfirmResponse,List<OrderGoodsCalculateResponse> goodsCalculateList,BigDecimal totalIntegral){
//褰撳墠閫夋嫨鍟嗗搧鏈�澶у彲鐢ㄧН鍒嗘姷鎵g殑閲戦
BigDecimal maxDeductionCash = goodsCalculateList.stream().map(i->i.getSkuAmount().subtract(Objects.isNull(i.getCouponDeductCash())?BigDecimal.ZERO:i.getCouponDeductCash())
- .multiply(i.getDeductRata()).multiply(new BigDecimal("0.01"))).reduce(BigDecimal.ZERO,BigDecimal::add);
+ .multiply(i.getDeductRata()).divide(new BigDecimal("100"),2,RoundingMode.DOWN)).reduce(BigDecimal.ZERO,BigDecimal::add);
//绉垎-鐜伴噾鍏戞崲姣斾緥锛圶XX绉垎鎶垫墸1鍏冿級
- BigDecimal cashToIntegralRata = new BigDecimal(systemDictDataBiz.queryByCode(Constants.SHOP_CONFIG,Constants.INTEGRAL_EXCHANGE_CASH_RATA).getCode());
+ BigDecimal cashToIntegralRata = new BigDecimal(systemDictDataBiz.queryByCode(Constants.INTEGRAL_SET,Constants.INTERALSET_DEDUCTINTEGRALLIMIT).getCode());
//褰撳墠閫夋嫨鍟嗗搧鎶垫墸闇�瑕佷娇鐢ㄧ殑绉垎
BigDecimal maxDeductionIntegral = maxDeductionCash.multiply(cashToIntegralRata);
//鑾峰彇褰撳墠闇�瑕佹敮浠樼殑鐜伴噾鎬婚
@@ -1593,7 +1597,9 @@
//寰幆涓嬪崟鍟嗗搧鍒楄〃 璁$畻搴旇浣跨敤鐨勭Н鍒嗗��
BigDecimal realDeductionCash = BigDecimal.ZERO;
for (int j = 0; j < goodsCalculateList.size(); j++) {
- BigDecimal deductionCash = goodsCalculateList.get(j).getSkuAmount().subtract(goodsCalculateList.get(j).getCouponDeductCash());
+ //鑾峰彇鏈�澶у彲鎶垫墸閲戦
+ BigDecimal deductionCash = goodsCalculateList.get(j).getSkuAmount().subtract(goodsCalculateList.get(j).getCouponDeductCash())
+ .multiply(goodsCalculateList.get(j).getDeductRata()).divide(new BigDecimal("100"),2,RoundingMode.DOWN);
goodsCalculateList.get(j).setIntegralMaxDeductCash(deductionCash);
//濡傛灉鍓╀綑绉垎澶т簬鍙互浣跨敤绉垎 鍒欑洿鎺ユ弧棰濊绠� 鍙嶄箣 鍓╀綑绉垎涓嶈兘婊¤冻鍏ㄩ儴鎶垫墸 鍗曠嫭璁$畻姣忎釜鍟嗗搧鍗犳瘮
if(totalIntegral.compareTo(maxDeductionIntegral)<Constants.ZERO){
--
Gitblit v1.9.3