From 512a2f0fb09b663b8de19b5313c8bd5899f4f74b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 06 Apr 2021 09:44:06 +0800
Subject: [PATCH] Merge branch 'score_shop' of http://120.27.238.55:7000/r/beauty-erp into score_shop
---
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
index f099fdc..3b7c40e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
@@ -1,8 +1,12 @@
package com.matrix.system.shopXcx.mqTask;
-import com.matrix.biz.service.BizUserService;
+import com.matrix.system.hive.service.SysVipInfoService;
import com.matrix.core.tools.LogUtil;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.common.bean.BusParameterSettings;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.score.constant.ScoreSettingConstant;
import com.matrix.system.score.entity.ScoreVipDetail;
import com.matrix.system.score.service.ScoreVipDetailService;
import com.matrix.system.shopXcx.bean.ShopOrder;
@@ -15,6 +19,7 @@
import org.springframework.stereotype.Component;
import java.io.IOException;
+import java.math.BigDecimal;
import java.util.List;
/**
@@ -30,10 +35,15 @@
ShopOrderDetailsDao shopOrderDetailsDao;
@Autowired
- BizUserService bizUserService;
+ SysVipInfoService sysVipInfoService;
+
+
@Autowired
ScoreVipDetailService scoreVipDetailService;
+
+ @Autowired
+ BusParameterSettingsDao busParameterSettingsDao;
@@ -49,22 +59,30 @@
order.setDetails(orderDetails);
//扣除积分
if(order.getScorePay()!=null&&order.getScorePay()>0){
- scoreVipDetailService.deductionScore(order.getUserId(),null,Long.parseLong(order.getStoreId()+""),order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH,"商城积分抵扣");
+ scoreVipDetailService.deductionScore(order.getUserId(),null,
+ Long.parseLong(order.getStoreId()+""),order.getScorePay(),
+ Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH,"商城积分抵扣");
}else{
+
//消费获得积分
int addScore=0;
+ BusParameterSettings cashConsumptionShop = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.CASH_CONSUMPTION_SHOP, order.getCompanyId());
for(ShopOrderDetails shopOrderDetail : orderDetails) {
if(shopOrderDetail.getPayType()==ShopOrderDetails.PAYTYPE_MICRO){
Integer xfkdScore= shopOrderDetail.getShopSku().getScore();
if(xfkdScore!=null && xfkdScore>0){
addScore+=xfkdScore;
+ }else{
+ if(StringUtils.isNotBlank(cashConsumptionShop.getParamValue())){
+ addScore+= shopOrderDetail.getTotalPrice().divide(new BigDecimal(cashConsumptionShop.getParamValue())).intValue();
+ }
}
}
}
if(addScore>0){
//插入新的积分
scoreVipDetailService.addScore(
- order.getUserId(),null,
+ order.getUserId(),
null,
Long.parseLong(order.getStoreId()+""),
addScore,
--
Gitblit v1.9.1