diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java
index 07dd7f9d1..c34919f03 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java
@@ -87,7 +87,6 @@ public class WxCreditHistoryController extends BaseController
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findById");
return new ResultData(Result.SUCCESS,"查询成功",wxCreditHistoryService.getById(id));
}
-
-
-
+
+
}
diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
index bcab26929..a478393a7 100644
--- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
+++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
@@ -71,7 +71,7 @@ public class WxCoupon implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId;
/**券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,100.消费卡)**/
- @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,10.积分券,11积分停车券,100.消费卡)",name="type")
+ @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51积分停车券,100.消费卡)",name="type")
private Integer type;
/**封面图**/
@io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg")
diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java
index 09ac9f2cf..06023f246 100644
--- a/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java
+++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java
@@ -51,7 +51,7 @@ public class WxCreditHistory implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="每笔积分明细",name="creditNum")
private Integer creditNum;
/**积分类型*/
- @io.swagger.annotations.ApiModelProperty(value="积分类型",name="creditType")
+ @io.swagger.annotations.ApiModelProperty(value="积分类型 1每日登录,2消费,3绑车牌,4连接WIFI,5微信用户昵称授权,6微信用户手机授权,7完善个人信息,8积分导入,10消费积分,11积分兑换",name="creditType")
private Integer creditType;
/**创建日期*/
@io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate")
@@ -77,6 +77,9 @@ public class WxCreditHistory implements Serializable {
/**花费*/
@io.swagger.annotations.ApiModelProperty(value="花费",name="spend")
private Integer spend;
+ /**兑换用途*/
+ @io.swagger.annotations.ApiModelProperty(value="兑换用途",name="changePurpose")
+ private String changePurpose;
diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
index 3146d7211..e76c60b2e 100644
--- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
+++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
@@ -24,6 +24,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
@Service
@Slf4j
@@ -129,6 +131,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
}
@Override
+ @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public ResultData saveOrUpdate(WxCreditHistory record) {
WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId());
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId());
@@ -137,7 +140,14 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return new ResultData(ErrorCode.USER_IS_EMPTY);
}
//获取当前用户总积分
- int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId());
+ //int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId());
+ int currentCreditAmount = 0;
+ //获取当前用户总积分规则:优先获取wxCUserBasicInfo中数据 若不存在 再获取wxCUser表中数据
+ if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() > 0) {
+ currentCreditAmount = wxCUserBasicInfo.getCredit();
+ } else if (wxCUser != null && wxCUser.getCredit() > 0) {
+ currentCreditAmount = wxCUser.getCredit();
+ }
//计算出需要新增或减少的积分
int creditChangeNum = creditIncrement(record);
@@ -155,7 +165,14 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
record.setId(idWorker.nextId());
wxCreditHistoryMapper.insertSelective(record);
//将计算出来新的总积分 更新到两张用户表里
- updateCredit(wxCUser,wxCUserBasicInfo,record.getCreditAmount());
+ if (wxCUser != null) {
+ wxCUser.setCredit(record.getCreditAmount());
+ wxCUserMapper.updateByPrimaryKeySelective(wxCUser);
+ }
+ if (wxCUserBasicInfo != null) {
+ wxCUserBasicInfo.setCredit(record.getCreditAmount());
+ wxCUserBasicInfoMapper.updateByPrimaryKeySelective(wxCUserBasicInfo);
+ }
} else {
//wxCreditHistoryMapper.updateByPrimaryKeySelective(record);
}
@@ -327,20 +344,4 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return addCreditNumber;
}
- /**
- * 更新两个表中的最新总积分
- * @param creditAmount 用户最新总积分
- */
- private void updateCredit(WxCUser wxCUser, WxCUserBasicInfo wxCUserBasicInfo, int creditAmount) {
- if (wxCUser != null) {
- wxCUser.setCredit(creditAmount);
- wxCUserMapper.updateByPrimaryKeySelective(wxCUser);
- }
- if (wxCUserBasicInfo != null) {
- wxCUserBasicInfo.setCredit(creditAmount);
- wxCUserBasicInfoMapper.updateByPrimaryKeySelective(wxCUserBasicInfo);
- }
- }
-
-
}
diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml
index 267a882a0..5f3ab8de1 100644
--- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml
@@ -32,6 +32,8 @@
+
+
@@ -81,7 +83,7 @@
`id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,
`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,
`remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`,
- `press_limit_num`, `press_limit_hours`, `auto_refund`
+ `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`
@@ -207,6 +209,14 @@
and `auto_refund` = #{autoRefund}
+
+ and `credit_price` = #{creditPrice}
+
+
+
+ and `credit_refund` = #{creditRefund}
+
+
and id in
diff --git a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml
index c12f8b00b..3ed2c2fe9 100644
--- a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml
@@ -16,10 +16,11 @@
+
- `id`,`tenant_id`,`c_user_id`,`credit_amount`,`credit_num`,`credit_type`,`credate_date`,`receipt_url`,`operator_type`,`operator_id`,`merchant_id`,`coupon_id`,`business_id`,`spend`
+ `id`,`tenant_id`,`c_user_id`,`credit_amount`,`credit_num`,`credit_type`,`credate_date`,`receipt_url`,`operator_type`,`operator_id`,`merchant_id`,`coupon_id`,`business_id`,`spend`,`change_purpose`
@@ -60,6 +61,9 @@
and `spend` = #{spend}
+
+ and `change_purpose` = #{changePurpose}
+
and id in