From af6a6f03d3da1303b6fec2cff5dbd0fd10e8ad5c Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Wed, 27 Jan 2021 09:59:32 +0800
Subject: [PATCH] 1、查询产品bug 2、储值卡使用完成不设置为失效
---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 57 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
index 9cfcdec..cd33744 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -1,5 +1,6 @@
package com.matrix.system.hive.service.imp;
+import com.matrix.component.rabbitmq.RabiitMqTemplate;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.PaginationVO;
@@ -27,8 +28,11 @@
import com.matrix.system.hive.pojo.ShoppingCarItem;
import com.matrix.system.hive.pojo.ShoppingCarItemsVo;
import com.matrix.system.hive.service.*;
+import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
+import com.matrix.system.wechart.templateMsg.UniformMsgParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -106,6 +110,13 @@
@Autowired
private SysInstoreInfoService sysInstoreInfoService;
+
+
+ @Value("${evn}")
+ private String evn;
+
+ @Autowired
+ private RabiitMqTemplate rabiitMqTemplate;
@Override
@@ -256,6 +267,12 @@
order.setStatu(Dictionary.ORDER_STATU_YQX);
order.setArrears(0D);
+
+ //发送微信公众号提醒
+ UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_DDQX);
+ uniformMsgParam.put("orderId",order.getId());
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
+
return sysOrderDao.update(order);
} else {
@@ -351,8 +368,11 @@
achieveNewService.removeByModel(achieveNew);
// 取消订单
order.setStatu(Dictionary.ORDER_STATU_YQX);
+
+
return sysOrderDao.update(order);
}
+
}
@@ -609,7 +629,6 @@
if(moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) {
double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue());
moneyCardUse.setGiftMoney(surplus);
-
moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue());
} else {
throw new GlobleException(moneyCardUse.getCardName() + "余额不足");
@@ -618,13 +637,27 @@
if(moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) {
double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue());
moneyCardUse.setRealMoney(surplus);
-
moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue());
} else {
throw new GlobleException(moneyCardUse.getCardName() + "余额不足");
}
}
+ if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) {
+ //余额为0时充值卡变为无效
+ if(moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)){
+ moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y);
+ moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX);
+ }
+ }
+
+ ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId());
+ if (shoppingGoods != null) {
+ Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime());
+ moneyCardUse.setFailTime(invalidTime);
+ }
+ // 更新充值卡信息
+ moneyCardUseDao.update(moneyCardUse);
//设置卡项使用流水
moneyCardUseFlow.setCarUseId(moneyCardUse.getId());
moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo());
@@ -635,26 +668,6 @@
moneyCardUseFlow.setOperationId(user.getSuId());
moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney()+moneyCardUse.getRealMoney());
moneyCardUseFlowDao.insert(moneyCardUseFlow);
-
- // 达到使用次数后自动清空余额
- if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)
- && moneyCardUse.getLastCount() <= 0) {
- moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y);
- moneyCardUse.setLastCount(0);
- moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX);
- }
- if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) {
- moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y);
- moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX);
- }
-
- ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId());
- if (shoppingGoods != null) {
- Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime());
- moneyCardUse.setFailTime(invalidTime);
- }
- // 更新充值卡信息
- moneyCardUseDao.update(moneyCardUse);
}
/**
--
Gitblit v1.9.1